JingDas commented on code in PR #21855:
URL: https://github.com/apache/doris/pull/21855#discussion_r1357713148


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/trino/TrinoFnCallTransformers.java:
##########
@@ -0,0 +1,130 @@
+// 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.doris.nereids.parser.trino;
+
+import org.apache.doris.nereids.analyzer.PlaceholderExpression;
+import org.apache.doris.nereids.analyzer.UnboundFunction;
+import org.apache.doris.nereids.parser.ParserContext;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.functions.Function;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * The builder and factory for {@link 
org.apache.doris.nereids.parser.trino.TrinoFnCallTransformer},
+ * and supply transform facade ability.
+ */
+public class TrinoFnCallTransformers {
+
+    private static ImmutableListMultimap<String, AbstractFnCallTransformer> 
TRANSFORMER_MAP;

Review Comment:
   The difference between `Transformer` and `ComplexTransformer` is that the 
mapping relation way from source trino function to target doris function.
   
   Lest's see one example for `Transformer` as following:
   `ascii('a') `function is in **doris** and `codepoint('a')` funtion in 
**trino**, they have the same feature and have the same method signature, so we 
can use 
[TrinoFnCallTransformer](https://github.com/apache/doris/blob/3b37b76886b33da02ab0ead1985c428c5c89dc94/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/trino/TrinoFnCallTransformer.java)
 to handle them.
   
   another example for `ComplexTransformer` as following:
   `date_diff('second', TIMESTAMP '2020-12-25 22:00:00', TIMESTAMP '2020-12-25 
21:00:00')"` fuction in **trino**
   and `seconds_diff(2020-12-25 22:00:00, 2020-12-25 21:00:00)")` fuction in 
**doris**. They have different method signature, we cant not handle it by 
`TrinoFnCallTransformer` simply  and we should handle it by individual complex 
transformer 
[DateDiffFnCallTransformer](https://github.com/apache/doris/blob/3b37b76886b33da02ab0ead1985c428c5c89dc94/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/trino/DateDiffFnCallTransformer.java)
   
   we want use `Transformer` to handle function transfromation, if can not, 
then use `ComplexTransformer`. So I split them to `TRANSFORMER_MAP` and 
`COMPLEX_TRANSFORMER_MAP` to distinguish them.
   
   
   
   
   
   



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to