diff --git a/backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxParquetWriteForHiveSuite.scala b/backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxParquetWriteForHiveSuite.scala index 412548de9c44..8c2b98988ea2 100644 --- a/backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxParquetWriteForHiveSuite.scala +++ b/backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxParquetWriteForHiveSuite.scala @@ -176,4 +176,13 @@ class VeloxParquetWriteForHiveSuite extends GlutenQueryTest with SQLTestUtils { checkAnswer(sql("SELECT * FROM t"), Row(1)) } } + + test("native writer support CreateHiveTableAsSelectCommand") { + withTable("t") { + withSQLConf("spark.sql.hive.convertMetastoreParquet" -> "false") { + checkNativeWrite("CREATE TABLE t STORED AS PARQUET AS SELECT 1 as c", checkNative = true) + } + checkAnswer(spark.table("t"), Row(1)) + } + } } diff --git a/gluten-substrait/src/main/scala/org/apache/spark/sql/execution/datasources/GlutenWriterColumnarRules.scala b/gluten-substrait/src/main/scala/org/apache/spark/sql/execution/datasources/GlutenWriterColumnarRules.scala index d33e779eb332..917f6c03dfe0 100644 --- a/gluten-substrait/src/main/scala/org/apache/spark/sql/execution/datasources/GlutenWriterColumnarRules.scala +++ b/gluten-substrait/src/main/scala/org/apache/spark/sql/execution/datasources/GlutenWriterColumnarRules.scala @@ -121,8 +121,10 @@ object GlutenWriterColumnarRules { command.table.storage.outputFormat .flatMap(formatMapping.get) .filter(GlutenFormatFactory.isRegistered) - case _: CreateHiveTableAsSelectCommand => - None + case command: CreateHiveTableAsSelectCommand => + command.tableDesc.storage.outputFormat + .flatMap(formatMapping.get) + .filter(GlutenFormatFactory.isRegistered) case _ => None }