mbutrovich commented on code in PR #1103:
URL: https://github.com/apache/datafusion-comet/pull/1103#discussion_r1850288853


##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -3191,9 +3191,25 @@ object QueryPlanSerde extends Logging with 
ShimQueryPlanSerde with CometExprShim
 
   private def partition2Proto(
       partition: FilePartition,
-      nativeScanBuilder: OperatorOuterClass.NativeScan.Builder): Unit = {
+      nativeScanBuilder: OperatorOuterClass.NativeScan.Builder,
+      scan: CometScanExec): Unit = {
     val partitionBuilder = OperatorOuterClass.SparkFilePartition.newBuilder()
+    val sparkContext = scan.session.sparkContext
+    var schema_saved: Boolean = false;
     partition.files.foreach(file => {
+      if (!schema_saved) {
+        // TODO: This code shouldn't be here, but for POC it's fine.
+        // Extract the schema and stash it.
+        val hadoopConf =
+          
scan.relation.sparkSession.sessionState.newHadoopConfWithOptions(scan.relation.options)
+        val broadcastedHadoopConf =
+          sparkContext.broadcast(new SerializableConfiguration(hadoopConf))
+        val sharedConf = broadcastedHadoopConf.value.value
+        val footer = FooterReader.readFooter(sharedConf, file)

Review Comment:
   In theory it's just replacing the call that currently takes place during the 
`fileReader` instantiation, but yeah I'm still curious if it's already cached 
somewhere. I see references within Spark to a `footersCache` so I'm curious to 
look for that as well.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to