Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
fix test
  • Loading branch information
dtenedor committed Nov 25, 2024
1 parent fb91c15 commit 256a5b5
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1030,10 +1030,10 @@ namedExpression
;

namedExpressionSeq
: namedExpression
{optional_trailing_comma_in_named_expression_lists}? (COMMA namedExpression)* COMMA?
| namedExpression
{!optional_trailing_comma_in_named_expression_lists}? (COMMA namedExpression)*
: {optional_trailing_comma_in_named_expression_lists}?
namedExpression (COMMA namedExpression)* COMMA?
| {!optional_trailing_comma_in_named_expression_lists}?
namedExpression (COMMA namedExpression)*
;

partitionFieldList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ class PlanParserSuite extends AnalysisTest {
checkError(
exception = parseException(sql1),
condition = "PARSE_SYNTAX_ERROR",
parameters = Map("error" -> "'b'", "hint" -> ": extra input 'b'"))
parameters = Map("error" -> "'b'", "hint" -> ""))
}

test("limit") {
Expand Down Expand Up @@ -1978,12 +1978,14 @@ class PlanParserSuite extends AnalysisTest {
test("SPARK-50418: Support an optional trailing comma at the end of SELECT lists") {
withSQLConf(SQLConf.OPTIONAL_TRAILING_COMMA_IN_NAMED_EXPRESSION_LISTS.key -> "true") {
assertEqual("select 1, ", OneRowRelation().select(1))
assertEqual("select 1, 2", OneRowRelation().select(1, 2))
}
withSQLConf(SQLConf.OPTIONAL_TRAILING_COMMA_IN_NAMED_EXPRESSION_LISTS.key -> "false") {
assertEqual("select 1, 2", OneRowRelation().select(1, 2))
checkError(
exception = parseException("select 1,"),
condition = "PARSE_SYNTAX_ERROR",
parameters = Map("error" -> "','", "hint" -> ""))
parameters = Map("error" -> "'1'", "hint" -> ""))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ org.apache.spark.sql.catalyst.parser.ParseException
"sqlState" : "42601",
"messageParameters" : {
"error" : "'BY'",
"hint" : ": extra input 'BY'"
"hint" : ""
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ org.apache.spark.sql.catalyst.parser.ParseException
"errorClass" : "PARSE_SYNTAX_ERROR",
"sqlState" : "42601",
"messageParameters" : {
"error" : "'('",
"error" : "'c1'",
"hint" : ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ org.apache.spark.sql.catalyst.parser.ParseException
"sqlState" : "42601",
"messageParameters" : {
"error" : "'BY'",
"hint" : ": extra input 'BY'"
"hint" : ""
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,7 @@ org.apache.spark.sql.catalyst.parser.ParseException
"errorClass" : "PARSE_SYNTAX_ERROR",
"sqlState" : "42601",
"messageParameters" : {
"error" : "'('",
"error" : "'c1'",
"hint" : ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,10 @@ class QueryCompilationErrorsSuite
sql(s"SELECT from from FROM from from")
sql(s"SELECT c1, from FROM VALUES(1, 2) AS T(c1, from)")

intercept[ParseException] {
sql("SELECT 1,")
withSQLConf(SQLConf.OPTIONAL_TRAILING_COMMA_IN_NAMED_EXPRESSION_LISTS.key -> "false") {
intercept[ParseException] {
sql("SELECT 1,")
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ class QueryParsingErrorsSuite extends QueryTest with SharedSparkSession with SQL
exception = parseException("SELECT CAST(struct(1,2,3) AS STRUCT<INT>)"),
condition = "PARSE_SYNTAX_ERROR",
sqlState = "42601",
parameters = Map("error" -> "'<'", "hint" -> ": missing ')'"))
parameters = Map("error" -> "'>'", "hint" -> ""))
// Create column of struct type without specifying field type in lowercase
checkError(
exception = parseException("CREATE TABLE tbl_120691 (col1 struct)"),
Expand All @@ -707,7 +707,7 @@ class QueryParsingErrorsSuite extends QueryTest with SharedSparkSession with SQL
exception = parseException("SELECT CAST(map('1',2) AS MAP<STRING>)"),
condition = "PARSE_SYNTAX_ERROR",
sqlState = "42601",
parameters = Map("error" -> "'<'", "hint" -> ": missing ')'"))
parameters = Map("error" -> "'>'", "hint" -> ""))
// Create column of map type without specifying key/value types in lowercase
checkError(
exception = parseException("SELECT CAST(map('1',2) AS map)"),
Expand Down

0 comments on commit 256a5b5

Please sign in to comment.