yikf opened a new issue, #8721:
URL: https://github.com/apache/incubator-gluten/issues/8721

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   Native writer should keep the same compression with vanilla if 
`hive.exec.compress.output` is true.
   
   Let's take a look at the following example. Vanilla Spark will output in the 
zstd format, while Gluten will output in the [default 
snappy](https://github.com/apache/incubator-gluten/blob/main/cpp/velox/operators/writer/VeloxParquetDataSource.cc#L64)
 format.
   ```
   Seq(false, true).foreach {
           enableNativeWrite =>
             withSQLConf("spark.gluten.sql.native.writer.enabled" -> 
enableNativeWrite.toString) {
               withTable("t") {
                 withSQLConf(
                   "spark.sql.hive.convertMetastoreParquet" -> "false",
                   "spark.sql.parquet.compression.codec" -> "gzip") {
                   spark.sql("SET hive.exec.compress.output=true")
                   spark.sql("SET parquet.compression=gzip")
                   spark.sql(
                     "SET 
mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec")
                   checkNativeWrite(
                     "CREATE TABLE t STORED AS PARQUET TBLPROPERTIES 
('parquet.compression'='zstd') " +
                       "AS SELECT 1 as c",
                     checkNative = enableNativeWrite)
                   val tableDir = new 
Path(s"${conf.getConf(StaticSQLConf.WAREHOUSE_PATH)}/t")
                   val configuration = spark.sessionState.newHadoopConf()
                   val files = tableDir
                     .getFileSystem(configuration)
                     .listStatus(tableDir)
                     .filterNot(_.getPath.getName.startsWith("\\."))
                   assert(files.nonEmpty)
                   val in = HadoopInputFile.fromStatus(files.head, 
spark.sessionState.newHadoopConf())
                   Utils.tryWithResource(ParquetFileReader.open(in)) {
                     reader =>
                       val compression =
                         
reader.getFooter.getBlocks.get(0).getColumns.get(0).getCodec.toString
                       // native writer and vanilla spark hive writer should be 
consistent
                       logWarning(s"Enable native writer ?$enableNativeWrite, 
compression: $compression")
                   }
                 }
               }
             }
         }
   ```
   
   log
   ```
   25/02/13 16:23:01 WARN VeloxParquetWriteForHiveSuite: Enable native writer 
?false, compression: ZSTD
   25/02/13 16:23:02 WARN VeloxParquetWriteForHiveSuite: Enable native writer 
?true, compression: SNAPPY
   ```
   
   ### Spark version
   
   Spark-3.2.x
   
   ### Spark configurations
   
   _No response_
   
   ### System information
   
   _No response_
   
   ### Relevant logs
   
   ```bash
   
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to