Builder populate2()

in modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java [546:848]


        Builder populate2() {
            // datetime
            map.put(DATETIME_PLUS, new DatetimeArithmeticImplementor());
            map.put(MINUS_DATE, new DatetimeArithmeticImplementor());
            map.put(EXTRACT, new ExtractImplementor());
            map.put(FLOOR,
                    new FloorImplementor(BuiltInMethod.FLOOR.method.getName(),
                            BuiltInMethod.UNIX_TIMESTAMP_FLOOR.method,
                            BuiltInMethod.UNIX_DATE_FLOOR.method,
                            BuiltInMethod.CUSTOM_TIMESTAMP_FLOOR.method,
                            BuiltInMethod.CUSTOM_DATE_FLOOR.method));
            map.put(CEIL,
                    new FloorImplementor(BuiltInMethod.CEIL.method.getName(),
                            BuiltInMethod.UNIX_TIMESTAMP_CEIL.method,
                            BuiltInMethod.UNIX_DATE_CEIL.method,
                            BuiltInMethod.CUSTOM_TIMESTAMP_CEIL.method,
                            BuiltInMethod.CUSTOM_DATE_CEIL.method));
            map.put(TIMESTAMP_ADD,
                    new TimestampAddImplementor("timestampAdd",
                            BuiltInMethod.CUSTOM_TIMESTAMP_ADD.method,
                            BuiltInMethod.CUSTOM_DATE_ADD.method));
            map.put(DATEADD, map.get(TIMESTAMP_ADD));
            map.put(TIMESTAMP_DIFF,
                    new TimestampDiffImplementor("timestampDiff",
                            BuiltInMethod.CUSTOM_TIMESTAMP_DIFF.method,
                            BuiltInMethod.CUSTOM_DATE_DIFF.method));

            // TIMESTAMP_TRUNC and TIME_TRUNC methods are syntactic sugar for standard
            // datetime FLOOR.
            map.put(DATE_TRUNC, map.get(FLOOR));
            map.put(TIMESTAMP_TRUNC, map.get(FLOOR));
            map.put(TIME_TRUNC, map.get(FLOOR));

            map.put(LAST_DAY,
                    new LastDayImplementor("lastDay", BuiltInMethod.LAST_DAY));
            map.put(DAYNAME,
                    new PeriodNameImplementor("dayName",
                            BuiltInMethod.DAYNAME_WITH_TIMESTAMP,
                            BuiltInMethod.DAYNAME_WITH_DATE));
            map.put(MONTHNAME,
                    new PeriodNameImplementor("monthName",
                            BuiltInMethod.MONTHNAME_WITH_TIMESTAMP,
                            BuiltInMethod.MONTHNAME_WITH_DATE));
            defineMethod(TIMESTAMP_SECONDS, "timestampSeconds", NullPolicy.STRICT);
            defineMethod(TIMESTAMP_MILLIS, "timestampMillis", NullPolicy.STRICT);
            defineMethod(TIMESTAMP_MICROS, "timestampMicros", NullPolicy.STRICT);
            defineMethod(UNIX_SECONDS, "unixSeconds", NullPolicy.STRICT);
            defineMethod(UNIX_MILLIS, "unixMillis", NullPolicy.STRICT);
            defineMethod(UNIX_MICROS, "unixMicros", NullPolicy.STRICT);
            defineMethod(DATE_FROM_UNIX_DATE, "dateFromUnixDate", NullPolicy.STRICT);
            defineMethod(UNIX_DATE, "unixDate", NullPolicy.STRICT);

            // Datetime constructors
            defineMethod(DATE, "date", NullPolicy.STRICT);
            defineMethod(DATETIME, "datetime", NullPolicy.STRICT);
            defineMethod(TIMESTAMP, "timestamp", NullPolicy.STRICT);
            defineMethod(TIME, "time", NullPolicy.STRICT);

            // Datetime formatting methods
            final FormatDatetimeImplementor datetimeFormatImpl = new FormatDatetimeImplementor();
            map.put(FORMAT_TIMESTAMP, datetimeFormatImpl);
            map.put(FORMAT_DATE, datetimeFormatImpl);
            map.put(FORMAT_TIME, datetimeFormatImpl);
            map.put(FORMAT_DATETIME, datetimeFormatImpl);

            // Boolean operators
            map.put(IS_NULL, new IsNullImplementor());
            map.put(IS_NOT_NULL, new IsNotNullImplementor());
            map.put(IS_TRUE, new IsTrueImplementor());
            map.put(IS_NOT_TRUE, new IsNotTrueImplementor());
            map.put(IS_FALSE, new IsFalseImplementor());
            map.put(IS_NOT_FALSE, new IsNotFalseImplementor());

            // LIKE, ILIKE and SIMILAR
            map.put(LIKE,
                    new MethodImplementor(BuiltInMethod.LIKE.method, NullPolicy.STRICT,
                            false));
            map.put(ILIKE,
                    new MethodImplementor(BuiltInMethod.ILIKE.method, NullPolicy.STRICT,
                            false));
            map.put(RLIKE,
                    new MethodImplementor(BuiltInMethod.RLIKE.method, NullPolicy.STRICT,
                            false));
            map.put(SIMILAR_TO,
                    new MethodImplementor(BuiltInMethod.SIMILAR.method, NullPolicy.STRICT,
                            false));

            // POSIX REGEX
            final MethodImplementor posixRegexImplementorCaseSensitive =
                    new PosixRegexMethodImplementor(true);
            final MethodImplementor posixRegexImplementorCaseInsensitive =
                    new PosixRegexMethodImplementor(false);
            map.put(SqlStdOperatorTable.POSIX_REGEX_CASE_INSENSITIVE,
                    posixRegexImplementorCaseInsensitive);
            map.put(SqlStdOperatorTable.POSIX_REGEX_CASE_SENSITIVE,
                    posixRegexImplementorCaseSensitive);
            map.put(SqlStdOperatorTable.NEGATED_POSIX_REGEX_CASE_INSENSITIVE,
                    NotImplementor.of(posixRegexImplementorCaseInsensitive));
            map.put(SqlStdOperatorTable.NEGATED_POSIX_REGEX_CASE_SENSITIVE,
                    NotImplementor.of(posixRegexImplementorCaseSensitive));
            map.put(REGEXP_REPLACE, new RegexpReplaceImplementor());

            // Multisets & arrays
            defineMethod(CARDINALITY, BuiltInMethod.COLLECTION_SIZE.method,
                    NullPolicy.STRICT);
            defineMethod(ARRAY_LENGTH, BuiltInMethod.COLLECTION_SIZE.method,
                    NullPolicy.STRICT);
            defineMethod(SLICE, BuiltInMethod.SLICE.method, NullPolicy.NONE);
            defineMethod(ELEMENT, BuiltInMethod.ELEMENT.method, NullPolicy.STRICT);
            defineMethod(STRUCT_ACCESS, BuiltInMethod.STRUCT_ACCESS.method, NullPolicy.ANY);
            defineMethod(MEMBER_OF, BuiltInMethod.MEMBER_OF.method, NullPolicy.NONE);
            defineMethod(ARRAY_REVERSE, BuiltInMethod.ARRAY_REVERSE.method, NullPolicy.STRICT);
            map.put(ARRAY_CONCAT, new ArrayConcatImplementor());
            final MethodImplementor isEmptyImplementor =
                    new MethodImplementor(BuiltInMethod.IS_EMPTY.method, NullPolicy.NONE,
                            false);
            map.put(IS_EMPTY, isEmptyImplementor);
            map.put(IS_NOT_EMPTY, NotImplementor.of(isEmptyImplementor));
            final MethodImplementor isASetImplementor =
                    new MethodImplementor(BuiltInMethod.IS_A_SET.method, NullPolicy.NONE,
                            false);
            map.put(IS_A_SET, isASetImplementor);
            map.put(IS_NOT_A_SET, NotImplementor.of(isASetImplementor));
            defineMethod(MULTISET_INTERSECT_DISTINCT,
                    BuiltInMethod.MULTISET_INTERSECT_DISTINCT.method, NullPolicy.NONE);
            defineMethod(MULTISET_INTERSECT,
                    BuiltInMethod.MULTISET_INTERSECT_ALL.method, NullPolicy.NONE);
            defineMethod(MULTISET_EXCEPT_DISTINCT,
                    BuiltInMethod.MULTISET_EXCEPT_DISTINCT.method, NullPolicy.NONE);
            defineMethod(MULTISET_EXCEPT, BuiltInMethod.MULTISET_EXCEPT_ALL.method, NullPolicy.NONE);
            defineMethod(MULTISET_UNION_DISTINCT,
                    BuiltInMethod.MULTISET_UNION_DISTINCT.method, NullPolicy.NONE);
            defineMethod(MULTISET_UNION, BuiltInMethod.MULTISET_UNION_ALL.method, NullPolicy.NONE);
            final MethodImplementor subMultisetImplementor =
                    new MethodImplementor(BuiltInMethod.SUBMULTISET_OF.method, NullPolicy.NONE, false);
            map.put(SUBMULTISET_OF, subMultisetImplementor);
            map.put(NOT_SUBMULTISET_OF, NotImplementor.of(subMultisetImplementor));

            map.put(COALESCE, new CoalesceImplementor());
            map.put(CAST, new CastImplementor());

            map.put(REINTERPRET, new ReinterpretImplementor());

            final RexCallImplementor value = new ValueConstructorImplementor();
            map.put(MAP_VALUE_CONSTRUCTOR, value);
            map.put(ARRAY_VALUE_CONSTRUCTOR, value);
            map.put(ITEM, new ItemImplementor());

            map.put(DEFAULT, new DefaultImplementor());

            // Sequences
            defineMethod(CURRENT_VALUE, BuiltInMethod.SEQUENCE_CURRENT_VALUE.method,
                    NullPolicy.STRICT);
            defineMethod(NEXT_VALUE, BuiltInMethod.SEQUENCE_NEXT_VALUE.method,
                    NullPolicy.STRICT);

            // Compression Operators
            defineMethod(COMPRESS, BuiltInMethod.COMPRESS.method, NullPolicy.ARG0);

            // Xml Operators
            defineMethod(EXTRACT_VALUE, BuiltInMethod.EXTRACT_VALUE.method, NullPolicy.ARG0);
            defineMethod(XML_TRANSFORM, BuiltInMethod.XML_TRANSFORM.method, NullPolicy.ARG0);
            defineMethod(EXTRACT_XML, BuiltInMethod.EXTRACT_XML.method, NullPolicy.ARG0);
            defineMethod(EXISTS_NODE, BuiltInMethod.EXISTS_NODE.method, NullPolicy.ARG0);

            // Json Operators
            defineMethod(JSON_VALUE_EXPRESSION,
                    BuiltInMethod.JSON_VALUE_EXPRESSION.method, NullPolicy.STRICT);
            defineMethod(JSON_TYPE_OPERATOR,
                    BuiltInMethod.JSON_VALUE_EXPRESSION.method, NullPolicy.STRICT);
            defineMethod(JSON_EXISTS, BuiltInMethod.JSON_EXISTS.method, NullPolicy.ARG0);
            map.put(JSON_VALUE,
                    new JsonValueImplementor(BuiltInMethod.JSON_VALUE.method));
            defineMethod(JSON_QUERY, BuiltInMethod.JSON_QUERY.method, NullPolicy.ARG0);
            defineMethod(JSON_TYPE, BuiltInMethod.JSON_TYPE.method, NullPolicy.ARG0);
            defineMethod(JSON_DEPTH, BuiltInMethod.JSON_DEPTH.method, NullPolicy.ARG0);
            defineMethod(JSON_INSERT, BuiltInMethod.JSON_INSERT.method, NullPolicy.ARG0);
            defineMethod(JSON_KEYS, BuiltInMethod.JSON_KEYS.method, NullPolicy.ARG0);
            defineMethod(JSON_PRETTY, BuiltInMethod.JSON_PRETTY.method, NullPolicy.ARG0);
            defineMethod(JSON_LENGTH, BuiltInMethod.JSON_LENGTH.method, NullPolicy.ARG0);
            defineMethod(JSON_REMOVE, BuiltInMethod.JSON_REMOVE.method, NullPolicy.ARG0);
            defineMethod(JSON_STORAGE_SIZE, BuiltInMethod.JSON_STORAGE_SIZE.method, NullPolicy.ARG0);
            defineMethod(JSON_REPLACE, BuiltInMethod.JSON_REPLACE.method, NullPolicy.ARG0);
            defineMethod(JSON_SET, BuiltInMethod.JSON_SET.method, NullPolicy.ARG0);
            defineMethod(JSON_OBJECT, BuiltInMethod.JSON_OBJECT.method, NullPolicy.NONE);
            defineMethod(JSON_ARRAY, BuiltInMethod.JSON_ARRAY.method, NullPolicy.NONE);
            aggMap.put(JSON_OBJECTAGG.with(SqlJsonConstructorNullClause.ABSENT_ON_NULL),
                    JsonObjectAggImplementor
                            .supplierFor(BuiltInMethod.JSON_OBJECTAGG_ADD.method));
            aggMap.put(JSON_OBJECTAGG.with(SqlJsonConstructorNullClause.NULL_ON_NULL),
                    JsonObjectAggImplementor
                            .supplierFor(BuiltInMethod.JSON_OBJECTAGG_ADD.method));
            aggMap.put(JSON_ARRAYAGG.with(SqlJsonConstructorNullClause.ABSENT_ON_NULL),
                    JsonArrayAggImplementor
                            .supplierFor(BuiltInMethod.JSON_ARRAYAGG_ADD.method));
            aggMap.put(JSON_ARRAYAGG.with(SqlJsonConstructorNullClause.NULL_ON_NULL),
                    JsonArrayAggImplementor
                            .supplierFor(BuiltInMethod.JSON_ARRAYAGG_ADD.method));
            map.put(IS_JSON_VALUE,
                    new MethodImplementor(BuiltInMethod.IS_JSON_VALUE.method,
                            NullPolicy.NONE, false));
            map.put(IS_JSON_OBJECT,
                    new MethodImplementor(BuiltInMethod.IS_JSON_OBJECT.method,
                            NullPolicy.NONE, false));
            map.put(IS_JSON_ARRAY,
                    new MethodImplementor(BuiltInMethod.IS_JSON_ARRAY.method,
                            NullPolicy.NONE, false));
            map.put(IS_JSON_SCALAR,
                    new MethodImplementor(BuiltInMethod.IS_JSON_SCALAR.method,
                            NullPolicy.NONE, false));
            map.put(IS_NOT_JSON_VALUE,
                    NotImplementor.of(
                            new MethodImplementor(BuiltInMethod.IS_JSON_VALUE.method,
                                    NullPolicy.NONE, false)));
            map.put(IS_NOT_JSON_OBJECT,
                    NotImplementor.of(
                            new MethodImplementor(BuiltInMethod.IS_JSON_OBJECT.method,
                                    NullPolicy.NONE, false)));
            map.put(IS_NOT_JSON_ARRAY,
                    NotImplementor.of(
                            new MethodImplementor(BuiltInMethod.IS_JSON_ARRAY.method,
                                    NullPolicy.NONE, false)));
            map.put(IS_NOT_JSON_SCALAR,
                    NotImplementor.of(
                            new MethodImplementor(BuiltInMethod.IS_JSON_SCALAR.method,
                                    NullPolicy.NONE, false)));

            // System functions
            final SystemFunctionImplementor systemFunctionImplementor =
                    new SystemFunctionImplementor();
            map.put(USER, systemFunctionImplementor);
            map.put(CURRENT_USER, systemFunctionImplementor);
            map.put(SESSION_USER, systemFunctionImplementor);
            map.put(SYSTEM_USER, systemFunctionImplementor);
            map.put(CURRENT_PATH, systemFunctionImplementor);
            map.put(CURRENT_ROLE, systemFunctionImplementor);
            map.put(CURRENT_CATALOG, systemFunctionImplementor);

            // Current time functions
            map.put(CURRENT_TIME, systemFunctionImplementor);
            map.put(CURRENT_TIMESTAMP, systemFunctionImplementor);
            map.put(CURRENT_DATE, systemFunctionImplementor);
            map.put(LOCALTIME, systemFunctionImplementor);
            map.put(LOCALTIMESTAMP, systemFunctionImplementor);

            aggMap.put(COUNT, constructorSupplier(CountImplementor.class));
            aggMap.put(REGR_COUNT, constructorSupplier(CountImplementor.class));
            aggMap.put(SUM0, constructorSupplier(SumImplementor.class));
            aggMap.put(SUM, constructorSupplier(SumImplementor.class));
            Supplier<MinMaxImplementor> minMax =
                    constructorSupplier(MinMaxImplementor.class);
            aggMap.put(MIN, minMax);
            aggMap.put(MAX, minMax);
            aggMap.put(ARG_MIN, constructorSupplier(ArgMinMaxImplementor.class));
            aggMap.put(ARG_MAX, constructorSupplier(ArgMinMaxImplementor.class));
            aggMap.put(MIN_BY, constructorSupplier(ArgMinMaxImplementor.class));
            aggMap.put(MAX_BY, constructorSupplier(ArgMinMaxImplementor.class));
            aggMap.put(ANY_VALUE, minMax);
            aggMap.put(SOME, minMax);
            aggMap.put(EVERY, minMax);
            aggMap.put(BOOL_AND, minMax);
            aggMap.put(BOOL_OR, minMax);
            aggMap.put(LOGICAL_AND, minMax);
            aggMap.put(LOGICAL_OR, minMax);
            final Supplier<BitOpImplementor> bitop =
                    constructorSupplier(BitOpImplementor.class);
            aggMap.put(BIT_AND, bitop);
            aggMap.put(BIT_OR, bitop);
            aggMap.put(BIT_XOR, bitop);
            aggMap.put(SINGLE_VALUE, constructorSupplier(SingleValueImplementor.class));
            aggMap.put(COLLECT, constructorSupplier(CollectImplementor.class));
            aggMap.put(ARRAY_AGG, constructorSupplier(CollectImplementor.class));
            aggMap.put(LISTAGG, constructorSupplier(ListaggImplementor.class));
            aggMap.put(FUSION, constructorSupplier(FusionImplementor.class));
            aggMap.put(MODE, constructorSupplier(ModeImplementor.class));
            aggMap.put(ARRAY_CONCAT_AGG, constructorSupplier(FusionImplementor.class));
            aggMap.put(INTERSECTION, constructorSupplier(IntersectionImplementor.class));
            final Supplier<GroupingImplementor> grouping =
                    constructorSupplier(GroupingImplementor.class);
            aggMap.put(GROUPING, grouping);
            aggMap.put(GROUPING_ID, grouping);
            winAggMap.put(RANK, constructorSupplier(RankImplementor.class));
            winAggMap.put(DENSE_RANK, constructorSupplier(DenseRankImplementor.class));
            winAggMap.put(ROW_NUMBER, constructorSupplier(RowNumberImplementor.class));
            /*winAggMap.put(FIRST_VALUE,
                    constructorSupplier(FirstValueImplementor.class));
            winAggMap.put(NTH_VALUE, constructorSupplier(NthValueImplementor.class));
            winAggMap.put(LAST_VALUE, constructorSupplier(LastValueImplementor.class));
            winAggMap.put(LEAD, constructorSupplier(LeadImplementor.class));
            winAggMap.put(LAG, constructorSupplier(LagImplementor.class));
            winAggMap.put(NTILE, constructorSupplier(NtileImplementor.class));
            winAggMap.put(COUNT, constructorSupplier(CountWinImplementor.class));*/
            winAggMap.put(REGR_COUNT, constructorSupplier(CountWinImplementor.class));

            // Functions for MATCH_RECOGNIZE
            matchMap.put(CLASSIFIER, ClassifierImplementor::new);
            //matchMap.put(LAST, LastImplementor::new);

            /*tvfImplementorMap.put(TUMBLE, TumbleImplementor::new);
            tvfImplementorMap.put(HOP, HopImplementor::new);
            tvfImplementorMap.put(SESSION, SessionImplementor::new);*/
            return populateIgnite();
        }