-
Notifications
You must be signed in to change notification settings - Fork 0
/
Spark_logs
179 lines (174 loc) · 8.05 KB
/
Spark_logs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# 2files have quotes enclosed fields, 1 file have no quotes enclosing fields
>>> df = spark.read.csv(hdfs+'/data/satya/ml_rd/*.csv', header=True, inferSchema=True)
>>> df.count()
18/05/16 15:41:14 WARN Utils: Truncated the string representation of a plan since it was too large. This behavior can be adjusted by setting 'spark.debug.maxToStringFields' in SparkEnv.conf.
69
>>> df.printSchema()
root
|-- City_V: string (nullable = true)
|-- Country_V: string (nullable = true)
|-- Country_Code_V: string (nullable = true)
|-- Region_V: string (nullable = true)
|-- defaultRole_V: string (nullable = true)
|-- business_V: string (nullable = true)
|-- tenantId_V: string (nullable = true)
|-- Sales_F: string (nullable = true) ########### SHOULD BE DOUBLE BUT Become String????????
|-- OrderDate_D: string (nullable = true)
|-- CallID_N: string (nullable = true)
|-- DateINTCreated_V: string (nullable = true)
|-- DimBusinessProgramID_N: string (nullable = true)
|-- Dim_BusinessID_N: string (nullable = true)
|-- DimSiteID_N: string (nullable = true)
|-- DimSite_V: string (nullable = true)
|-- DimLanguageID_N: string (nullable = true)
|-- DimLanguage_V: string (nullable = true)
|-- DimContactchannelID_N: string (nullable = true)
|-- DATE_KEY_V: string (nullable = true)
|-- DimApplicationID_N: string (nullable = true)
|-- ApplicationNumber_N: string (nullable = true)
|-- ApplicationName_V: string (nullable = true)
|-- WaitingTime_N: string (nullable = true)
|-- TalkTime_N: string (nullable = true)
|-- HoldTime_N: string (nullable = true)
|-- WrapupTime_N: string (nullable = true)
|-- AgentNameACD_V: string (nullable = true)
|-- IsAnswered_N: string (nullable = true)
|-- SkillID_N: string (nullable = true)
|-- QUEUETIME_N: string (nullable = true)
|-- RINGTIME_N: string (nullable = true)
|-- OrderID_N: string (nullable = true)
|-- Profit_F: string (nullable = true)
|-- SubOrder_ID_N: string (nullable = true)
|-- ShipDate_D: string (nullable = true)
|-- CityLatitude_V: string (nullable = true)
|-- CityLongitude_V: string (nullable = true)
|-- CountryLatitude_V: string (nullable = true)
|-- CountryLongitude_V: string (nullable = true)
#### READ file with quote Enclosed.......Result is as expected, schema inferred correctly
>>> df_wq1 = spark.read.csv(hdfs+'/data/satya/ml_rd/TransactionDataApril2019_withQ.csv', header=True, inferSchema=True)
>>> df_wq1.printSchema()
root
|-- City_V: string (nullable = true)
|-- Country_V: string (nullable = true)
|-- Country_Code_V: string (nullable = true)
|-- Region_V: string (nullable = true)
|-- defaultRole_V: string (nullable = true)
|-- business_V: string (nullable = true)
|-- tenantId_V: integer (nullable = true)
|-- Sales_F: double (nullable = true) ################## DOUBLE AS EXPECTED
|-- OrderDate_D: string (nullable = true)
|-- CallID_N: integer (nullable = true)
|-- DateINTCreated_V: integer (nullable = true)
|-- DimBusinessProgramID_N: integer (nullable = true)
|-- Dim_BusinessID_N: integer (nullable = true)
|-- DimSiteID_N: integer (nullable = true)
|-- DimSite_V: string (nullable = true)
|-- DimLanguageID_N: integer (nullable = true)
|-- DimLanguage_V: string (nullable = true)
|-- DimContactchannelID_N: integer (nullable = true)
|-- DATE_KEY_V: integer (nullable = true)
|-- DimApplicationID_N: integer (nullable = true)
|-- ApplicationNumber_N: integer (nullable = true)
|-- ApplicationName_V: string (nullable = true)
|-- WaitingTime_N: integer (nullable = true)
|-- TalkTime_N: integer (nullable = true)
|-- HoldTime_N: integer (nullable = true)
|-- WrapupTime_N: integer (nullable = true)
|-- AgentNameACD_V: string (nullable = true)
|-- IsAnswered_N: integer (nullable = true)
|-- SkillID_N: integer (nullable = true)
|-- QUEUETIME_N: integer (nullable = true)
|-- RINGTIME_N: integer (nullable = true)
|-- OrderID_N: integer (nullable = true)
|-- Profit_F: double (nullable = true)
|-- SubOrder_ID_N: integer (nullable = true)
|-- ShipDate_D: string (nullable = true)
|-- CityLatitude_V: double (nullable = true)
|-- CityLongitude_V: double (nullable = true)
|-- CountryLatitude_V: double (nullable = true)
|-- CountryLongitude_V: double (nullable = true)
# Reading file without any quote enclosed file.............Result is as expected, schema inferred correctly
>>> df_wtq = spark.read.csv(hdfs+'/data/satya/ml_rd/TransactionDataApril2021_withoutQ.csv', header=True, inferSchema=True)
>>> df_wtq.printSchema()
root
|-- City_V: string (nullable = true)
|-- Country_V: string (nullable = true)
|-- Country_Code_V: string (nullable = true)
|-- Region_V: string (nullable = true)
|-- defaultRole_V: string (nullable = true)
|-- business_V: string (nullable = true)
|-- tenantId_V: integer (nullable = true)
|-- Sales_F: double (nullable = true) ################ DOUBLE AS EXPECTED
|-- OrderDate_D: string (nullable = true)
|-- CallID_N: integer (nullable = true)
|-- DateINTCreated_V: integer (nullable = true)
|-- DimBusinessProgramID_N: integer (nullable = true)
|-- Dim_BusinessID_N: integer (nullable = true)
|-- DimSiteID_N: integer (nullable = true)
|-- DimSite_V: string (nullable = true)
|-- DimLanguageID_N: integer (nullable = true)
|-- DimLanguage_V: string (nullable = true)
|-- DimContactchannelID_N: integer (nullable = true)
|-- DATE_KEY_V: integer (nullable = true)
|-- DimApplicationID_N: integer (nullable = true)
|-- ApplicationNumber_N: integer (nullable = true)
|-- ApplicationName_V: string (nullable = true)
|-- WaitingTime_N: integer (nullable = true)
|-- TalkTime_N: integer (nullable = true)
|-- HoldTime_N: integer (nullable = true)
|-- WrapupTime_N: integer (nullable = true)
|-- AgentNameACD_V: string (nullable = true)
|-- IsAnswered_N: integer (nullable = true)
|-- SkillID_N: integer (nullable = true)
|-- QUEUETIME_N: integer (nullable = true)
|-- RINGTIME_N: integer (nullable = true)
|-- OrderID_N: integer (nullable = true)
|-- Profit_F: double (nullable = true)
|-- SubOrder_ID_N: integer (nullable = true)
|-- ShipDate_D: string (nullable = true)
|-- CityLatitude_V: double (nullable = true)
|-- CityLongitude_V: double (nullable = true)
|-- CountryLatitude_V: double (nullable = true)
|-- CountryLongitude_V: double (nullable = true)
>>> df_app = df_wq1.union(df_wtq) # read separately and appended by union, works AS EXPECTED(schema inferred correctly)
>>> df_app.printSchema()
root
|-- City_V: string (nullable = true)
|-- Country_V: string (nullable = true)
|-- Country_Code_V: string (nullable = true)
|-- Region_V: string (nullable = true)
|-- defaultRole_V: string (nullable = true)
|-- business_V: string (nullable = true)
|-- tenantId_V: integer (nullable = true)
|-- Sales_F: double (nullable = true) ################## DOUBLE AS EXpected
|-- OrderDate_D: string (nullable = true)
|-- CallID_N: integer (nullable = true)
|-- DateINTCreated_V: integer (nullable = true)
|-- DimBusinessProgramID_N: integer (nullable = true)
|-- Dim_BusinessID_N: integer (nullable = true)
|-- DimSiteID_N: integer (nullable = true)
|-- DimSite_V: string (nullable = true)
|-- DimLanguageID_N: integer (nullable = true)
|-- DimLanguage_V: string (nullable = true)
|-- DimContactchannelID_N: integer (nullable = true)
|-- DATE_KEY_V: integer (nullable = true)
|-- DimApplicationID_N: integer (nullable = true)
|-- ApplicationNumber_N: integer (nullable = true)
|-- ApplicationName_V: string (nullable = true)
|-- WaitingTime_N: integer (nullable = true)
|-- TalkTime_N: integer (nullable = true)
|-- HoldTime_N: integer (nullable = true)
|-- WrapupTime_N: integer (nullable = true)
|-- AgentNameACD_V: string (nullable = true)
|-- IsAnswered_N: integer (nullable = true)
|-- SkillID_N: integer (nullable = true)
|-- QUEUETIME_N: integer (nullable = true)
|-- RINGTIME_N: integer (nullable = true)
|-- OrderID_N: integer (nullable = true)
|-- Profit_F: double (nullable = true)
|-- SubOrder_ID_N: integer (nullable = true)
|-- ShipDate_D: string (nullable = true)
|-- CityLatitude_V: double (nullable = true)
|-- CityLongitude_V: double (nullable = true)
|-- CountryLatitude_V: double (nullable = true)
|-- CountryLongitude_V: double (nullable = true)