You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/01/22 05:11:03 UTC

[GitHub] [hudi] danny0405 commented on a change in pull request #4649: [HUDI-2941] Show _hoodie_operation in spark sql results

danny0405 commented on a change in pull request #4649:
URL: https://github.com/apache/hudi/pull/4649#discussion_r790104796



##########
File path: hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadIncrementalRelation.scala
##########
@@ -74,7 +74,8 @@ class MergeOnReadIncrementalRelation(val sqlContext: SQLContext,
     optParams.getOrElse(DataSourceReadOptions.END_INSTANTTIME.key, lastInstant.getTimestamp))
   log.debug(s"${commitsTimelineToReturn.getInstants.iterator().toList.map(f => f.toString).mkString(",")}")
   private val commitsToReturn = commitsTimelineToReturn.getInstants.iterator().toList
-  private val schemaUtil = new TableSchemaResolver(metaClient)
+  private val withOperationField: Boolean = new TableSchemaResolver(metaClient).hasOperationField
+  private val schemaUtil = new TableSchemaResolver(metaClient, withOperationField)

Review comment:
       We need to make things more clear here, `withOperationField` flag can actually be eliminated if we have assumption:
   `always show the __hoodie_operation field when the schema contains that`. Then the resolve `withOperationField` can be made builtin in `TableSchemaResolver`.
   
   To make sure the assumption, you should check all the use cases that pass `true` as `withOperationField` for `TableSchemaResolver`.

##########
File path: hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/TestInsertTable.scala
##########
@@ -17,7 +17,7 @@
 
 package org.apache.spark.sql.hudi
 
-import org.apache.hudi.DataSourceWriteOptions.{KEYGENERATOR_CLASS_NAME, MOR_TABLE_TYPE_OPT_VAL, PARTITIONPATH_FIELD, PRECOMBINE_FIELD, RECORDKEY_FIELD, TABLE_TYPE}
+import org.apache.hudi.DataSourceWriteOptions._

Review comment:
       We better not import star (*)




-- 
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: commits-unsubscribe@hudi.apache.org

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