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

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   Expected to collect  column stats of column, but we found that stat  
timestamp column is missing.
   
   with setting `spark.gluten.sql.native.writer.enabled=true`, we write a 
parquet file.
   
   ```scala
   import org.apache.spark.sql.{SparkSession, Row}
   import org.apache.spark.sql.types.{StructType, StructField, TimestampType}
   import java.sql.Timestamp
   
   val data = Seq(
     Row(Timestamp.valueOf("2022-01-01 00:00:00")),
     Row(Timestamp.valueOf("2022-01-02 00:00:00"))
   )
   
   val schema = List(
     StructField("timestamp", TimestampType, true)
   )
   
   val df = spark.createDataFrame(
     spark.sparkContext.parallelize(data),
     StructType(schema)
   )
   
   df.show()
   df.coalesce(1).write.mode("overwrite").parquet("/data/test_parquet")
   ```
   
   Then we find a parquet file 
   
   ```
   part-00000-3d1e02c1-9fea-4203-a423-019dfc0d9f6d-c000.snappy.parquet
   ```
   
   however the timestamp stat is not collected.
   
   ```scala
   import org.apache.hadoop.conf.Configuration
   import org.apache.hadoop.fs.Path
   import org.apache.parquet.hadoop.ParquetFileReader
   import org.apache.parquet.hadoop.util.HadoopInputFile
   import scala.collection.JavaConverters._
   
   
   val conf = new Configuration()
   val path = new 
Path("/data/test_parquet/part-00000-3d1e02c1-9fea-4203-a423-019dfc0d9f6d-c000.snappy.parquet")
   val file = HadoopInputFile.fromPath(path, conf)
   val reader = ParquetFileReader.open(file)
   
   val group = reader.getRowGroups.asScala.head
   val columns = group.getColumns.asScala
   columns.foreach(c => println(c.getStatistics))
   ```
   
   the output is 
   
   ```
   no stats for this column
   ```
   
   <img width="730" alt="Image" 
src="https://github.com/user-attachments/assets/1c3cd7a3-26e6-4d58-a1d6-a9362b7814f9";
 />
   
   ### Spark version
   
   None
   
   ### 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