codope commented on code in PR #9872: URL: https://github.com/apache/hudi/pull/9872#discussion_r1379941270
########## hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/index/functional/HoodieSparkFunctionalIndex.java: ########## @@ -0,0 +1,229 @@ +/* + * 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.hudi.index.functional; + +import org.apache.hudi.common.util.CollectionUtils; +import org.apache.hudi.common.util.collection.Pair; + +import org.apache.spark.sql.Column; +import org.apache.spark.sql.functions; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +public class HoodieSparkFunctionalIndex implements HoodieFunctionalIndex<Column, Column>, Serializable { + + /** + * Custom interface to support Spark functions + */ + @FunctionalInterface + interface SparkFunction { + Column apply(List<Column> columns, Map<String, String> options); + } + + /** + * Map of Spark functions to their implementations. + * NOTE: This is not an exhaustive list of spark-sql functions. Only the common date/timestamp and string functions have been added. + * Add more functions as needed. However, keep the key should match the exact spark-sql function name in lowercase. + */ + private static final Map<String, SparkFunction> SPARK_FUNCTION_MAP = CollectionUtils.createImmutableMap( Review Comment: Didn't consider. Will add. -- 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]
