@@ -538,39 +538,6 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
538538 sql(" SELECT 1, 2, sum(b) FROM testData2" ))
539539 }
540540
541- test(" Group By Ordinal - negative cases" ) {
542- intercept[UnresolvedException [Aggregate ]] {
543- sql(" SELECT a, b FROM testData2 GROUP BY -1" )
544- }
545-
546- intercept[UnresolvedException [Aggregate ]] {
547- sql(" SELECT a, b FROM testData2 GROUP BY 3" )
548- }
549-
550- var e = intercept[UnresolvedException [Aggregate ]](
551- sql(" SELECT SUM(a) FROM testData2 GROUP BY 1" ))
552- assert(e.getMessage contains
553- " Invalid call to Group by position: the '1'th column in the select contains " +
554- " an aggregate function" )
555-
556- e = intercept[UnresolvedException [Aggregate ]](
557- sql(" SELECT SUM(a) + 1 FROM testData2 GROUP BY 1" ))
558- assert(e.getMessage contains
559- " Invalid call to Group by position: the '1'th column in the select contains " +
560- " an aggregate function" )
561-
562- var ae = intercept[AnalysisException ](
563- sql(" SELECT a, rand(0), sum(b) FROM testData2 GROUP BY a, 2" ))
564- assert(ae.getMessage contains
565- " nondeterministic expression rand(0) should not appear in grouping expression" )
566-
567- ae = intercept[AnalysisException ](
568- sql(" SELECT * FROM testData2 GROUP BY a, b, 1" ))
569- assert(ae.getMessage contains
570- " Group by position: star is not allowed to use in the select list " +
571- " when using ordinals in group by" )
572- }
573-
574541 test(" Group By Ordinal: spark.sql.groupByOrdinal=false" ) {
575542 withSQLConf(SQLConf .GROUP_BY_ORDINAL .key -> " false" ) {
576543 // If spark.sql.groupByOrdinal=false, ignore the position number.
@@ -2467,18 +2434,6 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
24672434 Seq (Row (1 , 1 ), Row (1 , 2 ), Row (2 , 1 ), Row (2 , 2 ), Row (3 , 1 ), Row (3 , 2 )))
24682435 }
24692436
2470- test(" order by ordinal number - negative cases" ) {
2471- intercept[UnresolvedException [SortOrder ]] {
2472- sql(" SELECT * FROM testData2 ORDER BY 0" )
2473- }
2474- intercept[UnresolvedException [SortOrder ]] {
2475- sql(" SELECT * FROM testData2 ORDER BY -1 DESC, b ASC" )
2476- }
2477- intercept[UnresolvedException [SortOrder ]] {
2478- sql(" SELECT * FROM testData2 ORDER BY 3 DESC, b ASC" )
2479- }
2480- }
2481-
24822437 test(" order by ordinal number with conf spark.sql.orderByOrdinal=false" ) {
24832438 withSQLConf(SQLConf .ORDER_BY_ORDINAL .key -> " false" ) {
24842439 // If spark.sql.orderByOrdinal=false, ignore the position number.
0 commit comments