ggjh-159 commented on code in PR #13412:
URL: https://github.com/apache/gluten/pull/13412#discussion_r4387055189
##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java:
##########
@@ -119,6 +120,14 @@ public class RexCallConverterFactory {
// substring returns an empty string. Start semantics (0 counts as 1,
// negative counts from the end) already match Flink.
Map.entry("SUBSTRING", Arrays.asList(() -> new
SubstringRexCallConverter())),
+ // Offload targets implemented in velox's flinksql namespace. ABS/
+ // FLOOR/CEIL/ROUND arrive upper-cased from the operator table;
+ // unary minus arrives as a one-operand "-" (see above).
+ Map.entry("ABS", Arrays.asList(() -> new
DefaultRexCallConverter("abs"))),
+ Map.entry("FLOOR", Arrays.asList(() -> new
DefaultRexCallConverter("floor"))),
Review Comment:
The datetime form of FLOOR/CEIL and the interval form of unary minus are
accepted by the mapping but cannot produce an executable plan:
`DefaultRexCallConverter` does not override `isSuitable` (unconditional
success), so `FLOOR(ts TO DAY)` — a form Flink supports
(FunctionGenerator.scala:245-261) — gets converted with the SYMBOL literal
mapped via SymbolType→VarCharType (LogicalTypeConverter.java:120-122) into
`floor(timestamp, varchar)`, which fails at velox runtime signature resolution;
unary minus over a year-month interval (arity-only guard) likewise fails at
`toType` (no YearMonthIntervalType mapping). GFV expression mapping has no
fallback (a miss fails the whole job), while pre-PR both forms were cleanly
rejected at planning time as "Function not supported". Please add a
numeric-operand guard to the floor/ceil and unary-minus converters (return
`ValidationResult.failure` for non-numeric operands) so unconvertible forms
stay planning-time rejections.
##########
gluten-flink/ut/src/test/java/org/apache/gluten/rexnode/functions/RexCallConverterFactoryTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.gluten.rexnode.functions;
+
+import org.apache.gluten.rexnode.RexConversionContext;
+
+import io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.CastTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.TypedExpr;
+
+import org.apache.flink.table.planner.calcite.FlinkRexBuilder;
+import org.apache.flink.table.planner.calcite.FlinkTypeFactory;
+import org.apache.flink.table.planner.calcite.FlinkTypeSystem;
+import org.apache.flink.table.planner.functions.sql.FlinkSqlOperatorTable;
+
+import org.apache.calcite.rex.RexBuilder;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.sql.SqlFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.fun.SqlStdOperatorTable;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigDecimal;
+import java.util.Collections;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class RexCallConverterFactoryTest {
Review Comment:
Please add the SQL details of the dual-run to the PR description — the
queries run against Flink 1.19.2 and how the results were compared.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]