YannByron commented on code in PR #7415:
URL: https://github.com/apache/hudi/pull/7415#discussion_r1044490930


##########
hudi-spark-datasource/hudi-spark3.2plus-common/src/main/scala/org/apache/spark/sql/catalyst/plans/logcal/HoodieQueryWithKV.scala:
##########
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.catalyst.plans.logcal
+
+import org.apache.hudi.{DataSourceReadOptions, DefaultSource}
+import org.apache.spark.sql.catalyst.TableIdentifier
+import org.apache.spark.sql.catalyst.catalog.CatalogTable
+import org.apache.spark.sql.catalyst.expressions.{Attribute, Expression}
+import org.apache.spark.sql.catalyst.plans.logical.{LeafNode, LogicalPlan}
+import org.apache.spark.sql.execution.datasources.LogicalRelation
+import org.apache.spark.sql.sources.BaseRelation
+import org.apache.spark.sql.{AnalysisException, SparkSession}
+
+import java.util.Locale
+import scala.collection.immutable.HashSet
+import scala.collection.mutable
+
+
+case class HoodieQueryWithKV(args: Seq[Expression]) extends LeafNode {
+
+  override def output: Seq[Attribute] = Nil
+
+  override lazy val resolved: Boolean = false
+
+}
+
+object HoodieQueryWithKV {
+
+  val FUNC_NAME = "hudi_query_with_kv"
+
+  private val KV_SPLIT = "=>"
+
+  // Add a white list to the key to prevent users adding other parameters
+  val KeyWhiteSet: HashSet[String] = 
HashSet(DataSourceReadOptions.QUERY_TYPE_SNAPSHOT_OPT_VAL
+    , DataSourceReadOptions.INCREMENTAL_FORMAT.key()
+    , DataSourceReadOptions.QUERY_TYPE.key()
+    , DataSourceReadOptions.REALTIME_MERGE.key()
+    , DataSourceReadOptions.READ_PATHS.key()
+    , DataSourceReadOptions.READ_PRE_COMBINE_FIELD.key()
+    , DataSourceReadOptions.ENABLE_HOODIE_FILE_INDEX.key()
+    , DataSourceReadOptions.BEGIN_INSTANTTIME.key()
+    , DataSourceReadOptions.END_INSTANTTIME.key()
+    , DataSourceReadOptions.INCREMENTAL_READ_SCHEMA_USE_END_INSTANTTIME.key()
+    , DataSourceReadOptions.PUSH_DOWN_INCR_FILTERS.key()
+    , DataSourceReadOptions.INCR_PATH_GLOB.key()
+    , DataSourceReadOptions.TIME_TRAVEL_AS_OF_INSTANT.key()
+    , DataSourceReadOptions.ENABLE_DATA_SKIPPING.key()
+    , DataSourceReadOptions.EXTRACT_PARTITION_VALUES_FROM_PARTITION_PATH.key()
+    , 
DataSourceReadOptions.INCREMENTAL_FALLBACK_TO_FULL_TABLE_SCAN_FOR_NON_EXISTING_FILES.key()
+    , DataSourceReadOptions.SCHEMA_EVOLUTION_ENABLED.key()
+  )

Review Comment:
   @scxwhite I think some of options are not suitable to pass as arguments of 
TVF, should be used as the common spark sql conf, like `REALTIME_MERGE`, 
`ENABLE_HOODIE_FILE_INDEX`, `INCREMENTAL_READ_SCHEMA_USE_END_INSTANTTIME`, 
`PUSH_DOWN_INCR_FILTERS`, `ENABLE_DATA_SKIPPING`, 
`EXTRACT_PARTITION_VALUES_FROM_PARTITION_PATH`, 
`INCREMENTAL_FALLBACK_TO_FULL_TABLE_SCAN_FOR_NON_EXISTING_FILES`, 
`SCHEMA_EVOLUTION_ENABLED `, `READ_PATHS` and `INCR_PATH_GLOB`.
   
   furthermore, `ENABLE_HOODIE_FILE_INDEX` and  `READ_PRE_COMBINE_FIELD` have 
not been used any more in codes. 
   
   the options left can be used as arguments of TVF, including `QUERY_TYPE`, 
`INCREMENTAL_FORMAT`, `BEGIN_INSTANTTIME`, `END_INSTANTTIME`, 
`TIME_TRAVEL_AS_OF_INSTANT`.
   
   Also, using the KV way to pass arguments is too flexible to check and 
control the conflict between options.



-- 
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-unsubscr...@hudi.apache.org

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

Reply via email to