You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "melihsozdinler (via GitHub)" <gi...@apache.org> on 2023/08/07 12:48:06 UTC

[GitHub] [spark] melihsozdinler commented on a diff in pull request #42336: [SPARK-44669][SQL][HIVE] Parquet/ORC files written using Hive Serde should has file extension

melihsozdinler commented on code in PR #42336:
URL: https://github.com/apache/spark/pull/42336#discussion_r1285819479


##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveFileFormat.scala:
##########
@@ -122,6 +130,23 @@ class HiveFileFormat(fileSinkConf: FileSinkDesc)
       case _ => true
     }
   }
+
+  private def configureFileExtension(conf: Configuration): Unit = {
+    fileSinkConf.getTableInfo.getOutputFileFormatClassName match {
+      case "org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat"
+        if SQLConf.get.getConf(HiveUtils.HIVE_PARQUET_FILE_EXTENSION_ENABLED) =>
+        conf.set("hive.output.file.extension",
+          CodecConfig.from(new JobConf(conf)).getCodec.getExtension + ".parquet")

Review Comment:
   .parquet and .orc are repeated in many places as a magic string, there are classes like OrcUtils and ParquetUtils can provide the file extension with a new function.



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org