scxwhite commented on code in PR #7415: URL: https://github.com/apache/hudi/pull/7415#discussion_r1045351350
########## 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: @YannByron I see what you mean. You want to propose some public parameters and use set to configure them. However, we usually join multiple tables in one SQL statement. The parameters you listed that are configured using set may have different configurations for different tables, such as REALTIME_ MERGE 、INCREMENTAL_ FALLBACK_ TO_ FULL_ TABLE_ SCAN_ FOR_ NON_ EXISTING_ FILES、READ_ PATHS、INCR_ PATH_ GLOB、PUSH_ DOWN_ INCR_ FILTERS, etc. The original intention of adding the kv mode is to use different configurations for different tables when joining multiple tables. When different tables need to use different configurations, there will be many different combinations of non kv fixed location parameters, which is also difficult for users to accept. -- 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]
