cloud-fan commented on a change in pull request #30869: URL: https://github.com/apache/spark/pull/30869#discussion_r669675979
########## File path: external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala ########## @@ -2158,6 +2158,46 @@ abstract class AvroSuite } } } + + test("SPARK-33865: Hive DDL with avro should check col name") { + withTable("test_ddl") { + withView("v") { + spark.range(1).createTempView("v") + withTempDir { dir => + val e1 = intercept[SchemaParseException] { + spark.sql( + s""" + |CREATE TABLE test_ddl USING AVRO + |LOCATION '${dir}' + |AS SELECT ID, ABS(ID) FROM v""".stripMargin) + }.getMessage + assert(e1.contains("Illegal character in: abs(ID)")) + } + + withTempDir { dir => + val e2 = intercept[SchemaParseException] { + spark.sql( + s""" + |CREATE TABLE test_ddl USING AVRO + |LOCATION '${dir}' + |AS SELECT ID, IF(ID=1,1,0) FROM v""".stripMargin) + }.getMessage + assert(e2.contains("Illegal initial character: (IF((ID = 1), 1, 0))")) Review comment: I don't see a big difference compared to the test above. Can we remove one of them? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org