maropu commented on a change in pull request #29045: URL: https://github.com/apache/spark/pull/29045#discussion_r453170193
########## File path: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReaderSuite.scala ########## @@ -77,4 +77,43 @@ class OrcColumnarBatchReaderSuite extends QueryTest with SharedSparkSession { assert(p1.getUTF8String(0) === partitionValues.getUTF8String(0)) } } + + test("SPARK-32234: orc data created by the hive tables having _col fields name") { + var error: Throwable = null + withTable("test_date_hive_orc") { + spark.sql( + """ + |CREATE TABLE `test_date_hive_orc` + | (`_col1` INT,`_col2` STRING,`_col3` INT) + | USING orc + """.stripMargin) + spark.sql( + """insert into + | test_date_hive_orc + | values(9, '12', 2020) + """.stripMargin) + + val df = spark.sql("select _col2 from test_date_hive_orc") + checkAnswer(df, Row("12")) + } + } + + test("SPARK-32234: orc data created by the spark having proper fields name") { + withTable("test_date_spark_orc") { + spark.sql( + """ + |CREATE TABLE `test_date_spark_orc` + | (`d_date_sk` INT,`d_date_id` STRING,`d_year` INT) + | USING orc + """.stripMargin) + spark.sql( + """insert into + | test_date_spark_orc + | values(9, '12', 2020) + """.stripMargin) + + val df = spark.sql("select d_date_id from test_date_spark_orc") Review comment: nit: please use the uppercases for SQL keywrods (e.g., SELECT) where possible ---------------------------------------------------------------- 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. 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