@@ -112,32 +112,32 @@ class AnalysisErrorSuite extends AnalysisTest {
112
112
errorTest(
113
113
" scalar subquery with 2 columns" ,
114
114
testRelation.select(
115
- (ScalarSubquery (testRelation.select(' a , dateLit.as(' b ))) + Literal (1 )).as(' a )),
115
+ (ScalarSubquery (testRelation.select($ " a " , dateLit.as(" b " ))) + Literal (1 )).as(" a " )),
116
116
" Scalar subquery must return only one column, but got 2" :: Nil )
117
117
118
118
errorTest(
119
119
" scalar subquery with no column" ,
120
- testRelation.select(ScalarSubquery (LocalRelation ()).as(' a )),
120
+ testRelation.select(ScalarSubquery (LocalRelation ()).as(" a " )),
121
121
" Scalar subquery must return only one column, but got 0" :: Nil )
122
122
123
123
errorTest(
124
124
" single invalid type, single arg" ,
125
- testRelation.select(TestFunction (dateLit :: Nil , IntegerType :: Nil ).as(' a )),
125
+ testRelation.select(TestFunction (dateLit :: Nil , IntegerType :: Nil ).as(" a " )),
126
126
" cannot resolve" :: " testfunction(CAST(NULL AS DATE))" :: " argument 1" :: " requires int type" ::
127
127
" 'CAST(NULL AS DATE)' is of date type" :: Nil )
128
128
129
129
errorTest(
130
130
" single invalid type, second arg" ,
131
131
testRelation.select(
132
- TestFunction (dateLit :: dateLit :: Nil , DateType :: IntegerType :: Nil ).as(' a )),
132
+ TestFunction (dateLit :: dateLit :: Nil , DateType :: IntegerType :: Nil ).as(" a " )),
133
133
" cannot resolve" :: " testfunction(CAST(NULL AS DATE), CAST(NULL AS DATE))" ::
134
134
" argument 2" :: " requires int type" ::
135
135
" 'CAST(NULL AS DATE)' is of date type" :: Nil )
136
136
137
137
errorTest(
138
138
" multiple invalid type" ,
139
139
testRelation.select(
140
- TestFunction (dateLit :: dateLit :: Nil , IntegerType :: IntegerType :: Nil ).as(' a )),
140
+ TestFunction (dateLit :: dateLit :: Nil , IntegerType :: IntegerType :: Nil ).as(" a " )),
141
141
" cannot resolve" :: " testfunction(CAST(NULL AS DATE), CAST(NULL AS DATE))" ::
142
142
" argument 1" :: " argument 2" :: " requires int type" ::
143
143
" 'CAST(NULL AS DATE)' is of date type" :: Nil )
@@ -150,7 +150,7 @@ class AnalysisErrorSuite extends AnalysisTest {
150
150
WindowSpecDefinition (
151
151
UnresolvedAttribute (" a" ) :: Nil ,
152
152
SortOrder (UnresolvedAttribute (" b" ), Ascending ) :: Nil ,
153
- UnspecifiedFrame )).as(' window )),
153
+ UnspecifiedFrame )).as(" window" )),
154
154
" not supported within a window function" :: Nil )
155
155
156
156
errorTest(
@@ -161,7 +161,7 @@ class AnalysisErrorSuite extends AnalysisTest {
161
161
WindowSpecDefinition (
162
162
UnresolvedAttribute (" a" ) :: Nil ,
163
163
SortOrder (UnresolvedAttribute (" b" ), Ascending ) :: Nil ,
164
- UnspecifiedFrame )).as(' window )),
164
+ UnspecifiedFrame )).as(" window" )),
165
165
" Distinct window functions are not supported" :: Nil )
166
166
167
167
errorTest(
@@ -176,7 +176,7 @@ class AnalysisErrorSuite extends AnalysisTest {
176
176
177
177
errorTest(
178
178
" nested aggregate functions" ,
179
- testRelation.groupBy(' a )(
179
+ testRelation.groupBy($ " a " )(
180
180
AggregateExpression (
181
181
Max (AggregateExpression (Count (Literal (1 )), Complete , isDistinct = false )),
182
182
Complete ,
@@ -192,39 +192,39 @@ class AnalysisErrorSuite extends AnalysisTest {
192
192
WindowSpecDefinition (
193
193
UnresolvedAttribute (" a" ) :: Nil ,
194
194
SortOrder (UnresolvedAttribute (" b" ), Ascending ) :: Nil ,
195
- SpecifiedWindowFrame (RangeFrame , Literal (1 ), Literal (2 )))).as(' window )),
195
+ SpecifiedWindowFrame (RangeFrame , Literal (1 ), Literal (2 )))).as(" window" )),
196
196
" window frame" :: " must match the required frame" :: Nil )
197
197
198
198
errorTest(
199
199
" too many generators" ,
200
- listRelation.select(Explode (' list ).as(' a ), Explode (' list ).as(' b )),
200
+ listRelation.select(Explode ($ " list" ).as(" a " ), Explode ($ " list" ).as(" b " )),
201
201
" only one generator" :: " explode" :: Nil )
202
202
203
203
errorTest(
204
204
" unresolved attributes" ,
205
- testRelation.select(' abcd ),
205
+ testRelation.select($ " abcd" ),
206
206
" cannot resolve" :: " abcd" :: Nil )
207
207
208
208
errorTest(
209
209
" unresolved attributes with a generated name" ,
210
- testRelation2.groupBy(' a )(max(' b ))
211
- .where(sum(' b ) > 0 )
212
- .orderBy(' havingCondition .asc),
210
+ testRelation2.groupBy($ " a " )(max($ " b " ))
211
+ .where(sum($ " b " ) > 0 )
212
+ .orderBy($ " havingCondition" .asc),
213
213
" cannot resolve" :: " havingCondition" :: Nil )
214
214
215
215
errorTest(
216
216
" unresolved star expansion in max" ,
217
- testRelation2.groupBy(' a )(sum(UnresolvedStar (None ))),
217
+ testRelation2.groupBy($ " a " )(sum(UnresolvedStar (None ))),
218
218
" Invalid usage of '*'" :: " in expression 'sum'" :: Nil )
219
219
220
220
errorTest(
221
221
" sorting by unsupported column types" ,
222
- mapRelation.orderBy(' map .asc),
222
+ mapRelation.orderBy($ " map" .asc),
223
223
" sort" :: " type" :: " map<int,int>" :: Nil )
224
224
225
225
errorTest(
226
226
" sorting by attributes are not from grouping expressions" ,
227
- testRelation2.groupBy(' a , ' c )( ' a , ' c , count(' a ).as(" a3" )).orderBy(' b .asc),
227
+ testRelation2.groupBy($ " a " , $ " c " )($ " a " , $ " c " , count($ " a " ).as(" a3" )).orderBy($ " b " .asc),
228
228
" cannot resolve" :: " '`b`'" :: " given input columns" :: " [a, a3, c]" :: Nil )
229
229
230
230
errorTest(
@@ -239,7 +239,7 @@ class AnalysisErrorSuite extends AnalysisTest {
239
239
240
240
errorTest(
241
241
" missing group by" ,
242
- testRelation2.groupBy(' a )( ' b ),
242
+ testRelation2.groupBy($ " a " )($ " b " ),
243
243
" '`b`'" :: " group by" :: Nil
244
244
)
245
245
@@ -317,7 +317,7 @@ class AnalysisErrorSuite extends AnalysisTest {
317
317
errorTest(
318
318
" SPARK-9955: correct error message for aggregate" ,
319
319
// When parse SQL string, we will wrap aggregate expressions with UnresolvedAlias.
320
- testRelation2.where(' bad_column > 1 ).groupBy(' a )(UnresolvedAlias (max(' b ))),
320
+ testRelation2.where($ " bad_column" > 1 ).groupBy($ " a " )(UnresolvedAlias (max($ " b " ))),
321
321
" cannot resolve '`bad_column`'" :: Nil )
322
322
323
323
errorTest(
@@ -385,14 +385,14 @@ class AnalysisErrorSuite extends AnalysisTest {
385
385
386
386
errorTest(
387
387
" generator nested in expressions" ,
388
- listRelation.select(Explode (' list ) + 1 ),
388
+ listRelation.select(Explode ($ " list" ) + 1 ),
389
389
" Generators are not supported when it's nested in expressions, but got: (explode(list) + 1)"
390
390
:: Nil
391
391
)
392
392
393
393
errorTest(
394
394
" generator appears in operator which is not Project" ,
395
- listRelation.sortBy(Explode (' list ).asc),
395
+ listRelation.sortBy(Explode ($ " list" ).asc),
396
396
" Generators are not supported outside the SELECT clause, but got: Sort" :: Nil
397
397
)
398
398
@@ -410,7 +410,7 @@ class AnalysisErrorSuite extends AnalysisTest {
410
410
411
411
errorTest(
412
412
" more than one generators in SELECT" ,
413
- listRelation.select(Explode (' list ), Explode (' list )),
413
+ listRelation.select(Explode ($ " list" ), Explode ($ " list" )),
414
414
" Only one generator allowed per select clause but found 2: explode(list), explode(list)" :: Nil
415
415
)
416
416
@@ -510,20 +510,20 @@ class AnalysisErrorSuite extends AnalysisTest {
510
510
}
511
511
512
512
test(" Join can work on binary types but can't work on map types" ) {
513
- val left = LocalRelation (' a .binary, ' b .map(StringType , StringType ))
514
- val right = LocalRelation (' c .binary, ' d .map(StringType , StringType ))
513
+ val left = LocalRelation (Symbol ( " a " ) .binary, Symbol ( " b " ) .map(StringType , StringType ))
514
+ val right = LocalRelation (Symbol ( " c " ) .binary, Symbol ( " d " ) .map(StringType , StringType ))
515
515
516
516
val plan1 = left.join(
517
517
right,
518
518
joinType = Cross ,
519
- condition = Some (' a === ' c ))
519
+ condition = Some (Symbol ( " a " ) === Symbol ( " c " ) ))
520
520
521
521
assertAnalysisSuccess(plan1)
522
522
523
523
val plan2 = left.join(
524
524
right,
525
525
joinType = Cross ,
526
- condition = Some (' b === ' d ))
526
+ condition = Some (Symbol ( " b " ) === Symbol ( " d " ) ))
527
527
assertAnalysisError(plan2, " EqualTo does not support ordering on type map" :: Nil )
528
528
}
529
529
@@ -596,7 +596,7 @@ class AnalysisErrorSuite extends AnalysisTest {
596
596
val plan5 = Filter (
597
597
Exists (
598
598
Sample (0.0 , 0.5 , false , 1L ,
599
- Filter (EqualTo (UnresolvedAttribute (" a" ), b), LocalRelation (b))).select(' b )
599
+ Filter (EqualTo (UnresolvedAttribute (" a" ), b), LocalRelation (b))).select(" b " )
600
600
),
601
601
LocalRelation (a))
602
602
assertAnalysisError(plan5,
@@ -606,7 +606,7 @@ class AnalysisErrorSuite extends AnalysisTest {
606
606
test(" Error on filter condition containing aggregate expressions" ) {
607
607
val a = AttributeReference (" a" , IntegerType )()
608
608
val b = AttributeReference (" b" , IntegerType )()
609
- val plan = Filter (' a === UnresolvedFunction (" max" , Seq (b), true ), LocalRelation (a, b))
609
+ val plan = Filter (Symbol ( " a " ) === UnresolvedFunction (" max" , Seq (b), true ), LocalRelation (a, b))
610
610
assertAnalysisError(plan,
611
611
" Aggregate/Window/Generate expressions are not valid in where clause of the query" :: Nil )
612
612
}
0 commit comments