twalthr commented on a change in pull request #7664: [FLINK-11449][table] Uncouple the Expression class from RexNodes. URL: https://github.com/apache/flink/pull/7664#discussion_r257757819
########## File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/expressions/FunctionDefinitions.java ########## @@ -0,0 +1,236 @@ +/* + * 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.flink.table.expressions; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.table.api.TableException; + +import java.lang.reflect.Field; +import java.util.LinkedList; +import java.util.List; + +import static org.apache.flink.table.expressions.FunctionType.AGGREGATION; +import static org.apache.flink.table.expressions.FunctionType.COMPARISON; +import static org.apache.flink.table.expressions.FunctionType.LOGICAL; +import static org.apache.flink.table.expressions.FunctionType.OTHER; + +/** + * FunctionDefinitions is like a dictionary, defining all FunctionDefinitions as constants. + */ +@PublicEvolving +public final class FunctionDefinitions { + + public static final FunctionDefinition CAST = new FunctionDefinition("cast", OTHER); + public static final FunctionDefinition AS = new FunctionDefinition("as", OTHER); + public static final FunctionDefinition FLATTEN = new FunctionDefinition("flatten", OTHER); + public static final FunctionDefinition GET_COMPOSITE_FIELD = new FunctionDefinition("getCompositeField", OTHER); + + // logic functions + public static final FunctionDefinition AND = new FunctionDefinition("and", LOGICAL); + public static final FunctionDefinition OR = new FunctionDefinition("or", LOGICAL); + public static final FunctionDefinition NOT = new FunctionDefinition("not", LOGICAL); + + // comparison functions + public static final FunctionDefinition EQUALS = new FunctionDefinition("equals", COMPARISON); + public static final FunctionDefinition GREATER_THAN = new FunctionDefinition("greaterThan", COMPARISON); + public static final FunctionDefinition GREATER_THAN_OR_EQUAL = + new FunctionDefinition("greaterThanOrEqual", COMPARISON); + public static final FunctionDefinition LESS_THAN = new FunctionDefinition("lessThan", COMPARISON); + public static final FunctionDefinition LESS_THAN_OR_EQUAL = new FunctionDefinition("lessThanOrEqual", COMPARISON); + public static final FunctionDefinition NOT_EQUALS = new FunctionDefinition("notEquals", COMPARISON); + + public static final FunctionDefinition IN = new FunctionDefinition("in", OTHER); + public static final FunctionDefinition IS_NULL = new FunctionDefinition("isNull", OTHER); + public static final FunctionDefinition IS_NOT_NULL = new FunctionDefinition("isNotNull", OTHER); + public static final FunctionDefinition IS_TRUE = new FunctionDefinition("isTrue", OTHER); + public static final FunctionDefinition IS_FALSE = new FunctionDefinition("isFalse", OTHER); + public static final FunctionDefinition IS_NOT_TRUE = new FunctionDefinition("isNotTrue", OTHER); + public static final FunctionDefinition IS_NOT_FALSE = new FunctionDefinition("isNotFalse", OTHER); + public static final FunctionDefinition IF = new FunctionDefinition("if", OTHER); + public static final FunctionDefinition BETWEEN = new FunctionDefinition("between", OTHER); Review comment: I like the idea of categorizing the functions but we should discuss the categories. Why is "between" not a comparison? Maybe we should find a different classification such as `CORE_PREDICATE` which includes only the core functions such as: <>=!== ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services