This is an automated email from the ASF dual-hosted git repository.
philo-he pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 52e9f8baed [FLINK][VL] Add Support for FROM_UNIXTIME / UNIX_TIMESTAMP
/ TIMESTAMPADD (#13491)
52e9f8baed is described below
commit 52e9f8baed76e0657d4d1f0adf0c1218a4a5a272
Author: 1111_nit <[email protected]>
AuthorDate: Mon Nov 9 16:11:58 2026 +0800
[FLINK][VL] Add Support for FROM_UNIXTIME / UNIX_TIMESTAMP / TIMESTAMPADD
(#13491)
---
.../plan/nodes/exec/stream/StreamExecExchange.java | 9 +-
.../exec/stream/StreamExecWatermarkAssigner.java | 12 +
.../apache/gluten/rexnode/RexNodeConverter.java | 24 +-
.../rexnode/functions/BaseRexCallConverters.java | 5 +
.../functions/FromUnixtimeRexCallConverter.java | 101 ++++++
.../IntervalArithmeticRexCallConverter.java | 180 +++++++++++
.../functions/IntervalCompareRexCallConverter.java | 77 +++++
.../IntervalMultiplyRexCallConverter.java | 103 +++++++
.../rexnode/functions/RexCallConverterFactory.java | 25 +-
.../functions/SubstractRexCallConverter.java | 4 +-
.../functions/UnixTimestampRexCallConverter.java | 59 ++++
.../apache/gluten/util/LogicalTypeConverter.java | 4 +
.../FromUnixtimeUnixTimestampConverterTest.java | 170 +++++++++++
.../rexnode/IntervalArithmeticConverterTest.java | 338 +++++++++++++++++++++
.../runtime/stream/custom/ScalarFunctionsTest.java | 32 ++
15 files changed, 1130 insertions(+), 13 deletions(-)
diff --git
a/gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecExchange.java
b/gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecExchange.java
index 371df26924..9edff9a17d 100644
---
a/gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecExchange.java
+++
b/gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecExchange.java
@@ -139,8 +139,13 @@ public class StreamExecExchange extends CommonExecExchange
implements StreamExec
KeySelectorUtil.getRowDataSelector(
planner.getFlinkContext().getClassLoader(), keys, inputType);
// --- Begin Gluten-specific code changes ---
- OneInputTransformation oneInputTransform = (OneInputTransformation)
inputTransform;
- if (oneInputTransform.getOperator() instanceof GlutenOperator) {
+ // The gluten exchange optimization below only applies when the input
is
+ // already a gluten operator wrapped in a OneInputTransformation; other
+ // shapes (e.g. a SourceTransformation feeding the hash exchange in a
+ // plain GROUP BY) must take the vanilla Flink fallback instead of
+ // failing with a ClassCastException.
+ if (inputTransform instanceof OneInputTransformation
+ && ((OneInputTransformation) inputTransform).getOperator()
instanceof GlutenOperator) {
// TODO: velox's parallelism need to be set here, as some nodes need
it.
// should set it when operator init.
parallelism = inputTransform.getParallelism();
diff --git
a/gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWatermarkAssigner.java
b/gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWatermarkAssigner.java
index 1d07e93f28..0c69df74c8 100644
---
a/gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWatermarkAssigner.java
+++
b/gluten-flink/planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecWatermarkAssigner.java
@@ -23,12 +23,15 @@ import
org.apache.gluten.table.runtime.operators.GlutenOneInputOperator;
import org.apache.gluten.util.LogicalTypeConverter;
import org.apache.gluten.util.PlanNodeIdGenerator;
+import io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
import io.github.zhztheplayer.velox4j.expression.TypedExpr;
import io.github.zhztheplayer.velox4j.plan.EmptyNode;
import io.github.zhztheplayer.velox4j.plan.PlanNode;
import io.github.zhztheplayer.velox4j.plan.ProjectNode;
import io.github.zhztheplayer.velox4j.plan.StatefulPlanNode;
import io.github.zhztheplayer.velox4j.plan.WatermarkAssignerNode;
+import io.github.zhztheplayer.velox4j.type.BigIntType;
+import io.github.zhztheplayer.velox4j.type.TimestampType;
import org.apache.flink.FlinkVersion;
import org.apache.flink.api.dag.Transformation;
@@ -136,6 +139,15 @@ public class StreamExecWatermarkAssigner extends
ExecNodeBase<RowData>
List<String> inNames =
Utils.getNamesFromRowType(inputEdge.getOutputType());
RexConversionContext conversionContext = new RexConversionContext(inNames);
TypedExpr watermarkExprs = RexNodeConverter.toTypedExpr(watermarkExpr,
conversionContext);
+ // The native WatermarkAssigner reads the expression result as a flat
+ // int64 millis vector. The legacy conversion produced BIGINT
+ // (unix_millis(ts) - millis) directly; TIMESTAMP-typed results (e.g. the
+ // flinksql ts - interval minus) carry a Timestamp C++ type, which the
+ // assigner's asFlatVector<int64_t> cannot read. Wrap TIMESTAMP results
+ // with unix_millis to keep the int64 millis contract.
+ if (watermarkExprs.getReturnType() instanceof TimestampType) {
+ watermarkExprs = new CallTypedExpr(new BigIntType(),
List.of(watermarkExprs), "unix_millis");
+ }
io.github.zhztheplayer.velox4j.type.RowType outputType =
(io.github.zhztheplayer.velox4j.type.RowType)
LogicalTypeConverter.toVLType(getOutputType());
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java
index 9e79797be3..74a320c078 100644
---
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java
@@ -157,15 +157,33 @@ public class RexNodeConverter {
return VarBinaryValue.create(
literal.getValue().toString().getBytes(StandardCharsets.UTF_8));
case DECIMAL:
- case INTERVAL_SECOND:
- // interval is used as decimal.
- // TODO: fix precision check
BigDecimal bigDecimal = literal.getValueAs(BigDecimal.class);
if (bigDecimal.precision() <= 18) {
return new BigIntValue(bigDecimal.unscaledValue().longValueExact());
} else {
return new HugeIntValue(bigDecimal.unscaledValue());
}
+ // Interval literals: Calcite stores day-time family values in
+ // milliseconds and year-month family values in months. The day-time
+ // value feeds plus/minus/multiply with BIGINT storage, and the
+ // year-month value feeds IntervalYearMonth (int32 storage).
+ case INTERVAL_DAY:
+ case INTERVAL_DAY_HOUR:
+ case INTERVAL_DAY_MINUTE:
+ case INTERVAL_DAY_SECOND:
+ case INTERVAL_HOUR:
+ case INTERVAL_HOUR_MINUTE:
+ case INTERVAL_HOUR_SECOND:
+ case INTERVAL_MINUTE:
+ case INTERVAL_MINUTE_SECOND:
+ case INTERVAL_SECOND:
+ return new BigIntValue(
+
literal.getValueAs(BigDecimal.class).unscaledValue().longValueExact());
+ case INTERVAL_YEAR:
+ case INTERVAL_MONTH:
+ case INTERVAL_YEAR_MONTH:
+ return new IntegerValue(
+
literal.getValueAs(BigDecimal.class).unscaledValue().intValueExact());
case SYMBOL:
return new VarCharValue(literal.getValue().toString());
case TIMESTAMP:
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/BaseRexCallConverters.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/BaseRexCallConverters.java
index fdc1ac5370..7522c805fa 100644
---
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/BaseRexCallConverters.java
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/BaseRexCallConverters.java
@@ -99,6 +99,11 @@ class BasicArithmeticOperatorRexCallConverter extends
BaseRexCallConverter {
boolean typesValidate =
callNode.getOperands().stream()
.allMatch(param ->
TypeUtils.isNumericType(RexNodeConverter.toType(param.getType())));
+ if (typesValidate
+ && callNode.getOperands().stream()
+ .anyMatch(IntervalArithmeticRexCallConverter::isIntervalOperand)) {
+ typesValidate = false;
+ }
if (!typesValidate) {
String message =
String.format(
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/FromUnixtimeRexCallConverter.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/FromUnixtimeRexCallConverter.java
new file mode 100644
index 0000000000..481b97ff69
--- /dev/null
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/FromUnixtimeRexCallConverter.java
@@ -0,0 +1,101 @@
+/*
+ * 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 org.apache.gluten.rexnode.RexNodeConverter;
+import org.apache.gluten.rexnode.ValidationResult;
+
+import io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.CastTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.TypedExpr;
+import io.github.zhztheplayer.velox4j.type.BigIntType;
+import io.github.zhztheplayer.velox4j.type.IntegerType;
+import io.github.zhztheplayer.velox4j.type.SmallIntType;
+import io.github.zhztheplayer.velox4j.type.TinyIntType;
+import io.github.zhztheplayer.velox4j.type.Type;
+import io.github.zhztheplayer.velox4j.type.VarCharType;
+
+import org.apache.calcite.rex.RexCall;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Converts Flink FROM_UNIXTIME to the velox flinksql from_unixtime function.
+ *
+ * <p>Flink SQL accepts the whole INTEGER family (TINYINT/SMALLINT/INT/BIGINT)
for the first operand
+ * and evaluates it as long; the velox flinksql function only registers the
bigint signature, so
+ * non-bigint first operands are cast to BIGINT — mirroring Flink codegen,
which maps every integral
+ * type to the long-based builtin method.
+ */
+public class FromUnixtimeRexCallConverter extends BaseRexCallConverter {
+
+ public FromUnixtimeRexCallConverter() {
+ super("from_unixtime");
+ }
+
+ @Override
+ public ValidationResult isSuitable(RexCall callNode, RexConversionContext
context) {
+ List<Type> operandTypes =
+ callNode.getOperands().stream()
+ .map(param -> RexNodeConverter.toType(param.getType()))
+ .collect(Collectors.toList());
+ if (operandTypes.isEmpty() || operandTypes.size() > 2) {
+ return ValidationResult.failure(
+ String.format(
+ "FROM_UNIXTIME expects 1 or 2 operands, but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ if (!isIntegralType(operandTypes.get(0))) {
+ return ValidationResult.failure(
+ String.format(
+ "FROM_UNIXTIME requires an integral first operand, but found:
%s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ if (operandTypes.size() == 2 && !(operandTypes.get(1) instanceof
VarCharType)) {
+ return ValidationResult.failure(
+ String.format(
+ "FROM_UNIXTIME format operand must be a string, but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ return ValidationResult.success();
+ }
+
+ @Override
+ public TypedExpr toTypedExpr(RexCall callNode, RexConversionContext context)
{
+ List<TypedExpr> params = getParams(callNode, context);
+ List<TypedExpr> callParams = new ArrayList<>();
+ TypedExpr unixtime = params.get(0);
+ if (!(unixtime.getReturnType() instanceof BigIntType)) {
+ unixtime = CastTypedExpr.create(new BigIntType(), unixtime, false);
+ }
+ callParams.add(unixtime);
+ if (params.size() == 2) {
+ callParams.add(params.get(1));
+ }
+ return new CallTypedExpr(getResultType(callNode), callParams,
functionName);
+ }
+
+ private static boolean isIntegralType(Type type) {
+ return type instanceof TinyIntType
+ || type instanceof SmallIntType
+ || type instanceof IntegerType
+ || type instanceof BigIntType;
+ }
+}
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalArithmeticRexCallConverter.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalArithmeticRexCallConverter.java
new file mode 100644
index 0000000000..62b770c195
--- /dev/null
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalArithmeticRexCallConverter.java
@@ -0,0 +1,180 @@
+/*
+ * 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 org.apache.gluten.rexnode.RexNodeConverter;
+import org.apache.gluten.rexnode.ValidationResult;
+
+import io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.CastTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.ConstantTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.TypedExpr;
+import io.github.zhztheplayer.velox4j.type.DateType;
+import io.github.zhztheplayer.velox4j.type.IntervalDayTimeType;
+import io.github.zhztheplayer.velox4j.type.IntervalYearMonthType;
+import io.github.zhztheplayer.velox4j.type.TimestampType;
+import io.github.zhztheplayer.velox4j.type.Type;
+import io.github.zhztheplayer.velox4j.variant.BigIntValue;
+import io.github.zhztheplayer.velox4j.variant.IntegerValue;
+
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.sql.type.SqlTypeName;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Converts Flink timestamp/date +/- interval arithmetic to the velox flinksql
plus/minus functions.
+ * TIMESTAMPADD is rewritten by Calcite into this shape, so is handwritten
{@code ts + INTERVAL 'n'
+ * UNIT}.
+ */
+public class IntervalArithmeticRexCallConverter extends BaseRexCallConverter {
+
+ // Whether the interval may appear on the left (plus is commutative, minus
is not).
+ private final boolean allowIntervalLeft;
+
+ public IntervalArithmeticRexCallConverter(String functionName, boolean
allowIntervalLeft) {
+ super(functionName);
+ this.allowIntervalLeft = allowIntervalLeft;
+ }
+
+ @Override
+ public ValidationResult isSuitable(RexCall callNode, RexConversionContext
context) {
+ if (callNode.getOperands().size() != 2) {
+ return ValidationResult.failure(
+ String.format(
+ "Interval arithmetic expects 2 operands, but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ List<Type> paramTypes =
+ callNode.getOperands().stream()
+ .map(param -> RexNodeConverter.toType(param.getType()))
+ .collect(Collectors.toList());
+ boolean firstDateTime = isDateTime(paramTypes.get(0));
+ boolean secondDateTime = isDateTime(paramTypes.get(1));
+ boolean firstInterval =
+ isInterval(paramTypes.get(0)) ||
isIntervalOperand(callNode.getOperands().get(0));
+ boolean secondInterval =
+ isInterval(paramTypes.get(1)) ||
isIntervalOperand(callNode.getOperands().get(1));
+ boolean suitable =
+ (firstDateTime && secondInterval) || (allowIntervalLeft &&
firstInterval && secondDateTime);
+ if (!suitable) {
+ return ValidationResult.failure(
+ String.format(
+ "Interval arithmetic requires a timestamp/date and an interval
operand, but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ return ValidationResult.success();
+ }
+
+ @Override
+ public TypedExpr toTypedExpr(RexCall callNode, RexConversionContext context)
{
+ List<TypedExpr> params = getParams(callNode, context);
+ // Normalize to (datetime, interval): the velox signatures only register
+ // the datetime-on-left order, so an interval-on-left plus is flipped
+ // here (plus is commutative for these types).
+ boolean firstIsInterval =
+ isInterval(params.get(0).getReturnType())
+ || isIntervalOperand(callNode.getOperands().get(0));
+ if (firstIsInterval) {
+ params = List.of(params.get(1), params.get(0));
+ }
+
+ // Re-type the interval operand from BigIntType to the proper interval
+ // velox type. LogicalTypeConverter maps intervals to BigIntType globally;
+ // we override here so velox resolves our flinksql signatures.
+ RexNode intervalRexNode =
+ firstIsInterval ? callNode.getOperands().get(0) :
callNode.getOperands().get(1);
+ TypedExpr intervalExpr = retypeInterval(params.get(1), intervalRexNode);
+ List<TypedExpr> newParams = new ArrayList<>();
+ newParams.add(params.get(0));
+ newParams.add(intervalExpr);
+ params = newParams;
+ // Flink's TIMESTAMPADD with sub-day units on a DATE returns a TIMESTAMP
+ // (e.g. TIMESTAMPADD(HOUR, 5, DATE '2025-03-15') = TIMESTAMP
+ // '2025-03-15 05:00:00'). Velox only has plus(Date, IntervalDayTime) ->
+ // Date, so when the expected result type is TIMESTAMP and the datetime
+ // operand is a DATE, cast it to TIMESTAMP before the plus/minus call.
+ // The cast is pure arithmetic (days * micros_per_day, no timezone) and
+ // semantically equivalent to Flink's result.
+ if (params.get(0).getReturnType() instanceof DateType
+ && getResultType(callNode) instanceof TimestampType) {
+ params =
+ List.of(CastTypedExpr.create(new TimestampType(), params.get(0),
false), params.get(1));
+ }
+ return new CallTypedExpr(getResultType(callNode), params, functionName);
+ }
+
+ static boolean isDateTime(Type type) {
+ return type instanceof TimestampType || type instanceof DateType;
+ }
+
+ static boolean isInterval(Type type) {
+ return type instanceof IntervalDayTimeType || type instanceof
IntervalYearMonthType;
+ }
+
+ /** Checks the Calcite SqlTypeName for interval types (catches BigInt-mapped
intervals). */
+ static boolean isIntervalOperand(RexNode node) {
+ SqlTypeName name = node.getType().getSqlTypeName();
+ return name == SqlTypeName.INTERVAL_YEAR
+ || name == SqlTypeName.INTERVAL_MONTH
+ || name == SqlTypeName.INTERVAL_YEAR_MONTH
+ || name == SqlTypeName.INTERVAL_DAY
+ || name == SqlTypeName.INTERVAL_DAY_HOUR
+ || name == SqlTypeName.INTERVAL_DAY_MINUTE
+ || name == SqlTypeName.INTERVAL_DAY_SECOND
+ || name == SqlTypeName.INTERVAL_HOUR
+ || name == SqlTypeName.INTERVAL_HOUR_MINUTE
+ || name == SqlTypeName.INTERVAL_HOUR_SECOND
+ || name == SqlTypeName.INTERVAL_MINUTE
+ || name == SqlTypeName.INTERVAL_MINUTE_SECOND
+ || name == SqlTypeName.INTERVAL_SECOND;
+ }
+
+ static Type getIntervalVeloxType(RexNode node) {
+ SqlTypeName name = node.getType().getSqlTypeName();
+ if (name == SqlTypeName.INTERVAL_YEAR
+ || name == SqlTypeName.INTERVAL_MONTH
+ || name == SqlTypeName.INTERVAL_YEAR_MONTH) {
+ return new IntervalYearMonthType();
+ }
+ return new IntervalDayTimeType();
+ }
+
+ static TypedExpr retypeInterval(TypedExpr converted, RexNode rexNode) {
+ Type intervalType = getIntervalVeloxType(rexNode);
+ if (converted.getReturnType().getClass().equals(intervalType.getClass())) {
+ return converted;
+ }
+ if (rexNode instanceof RexLiteral) {
+ RexLiteral literal = (RexLiteral) rexNode;
+ if (intervalType instanceof IntervalYearMonthType) {
+ int months =
literal.getValueAs(java.math.BigDecimal.class).unscaledValue().intValueExact();
+ return new ConstantTypedExpr(intervalType, new IntegerValue(months),
null);
+ } else {
+ long millis =
+
literal.getValueAs(java.math.BigDecimal.class).unscaledValue().longValueExact();
+ return new ConstantTypedExpr(intervalType, new BigIntValue(millis),
null);
+ }
+ }
+ return CastTypedExpr.create(intervalType, converted, false);
+ }
+}
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalCompareRexCallConverter.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalCompareRexCallConverter.java
new file mode 100644
index 0000000000..873ef2b8b7
--- /dev/null
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalCompareRexCallConverter.java
@@ -0,0 +1,77 @@
+/*
+ * 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 org.apache.gluten.rexnode.ValidationResult;
+
+import io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.TypedExpr;
+
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexNode;
+
+import java.util.List;
+
+/**
+ * Converts interval-to-interval comparisons (e.g. {@code INTERVAL '1' HOUR *
n > INTERVAL '2'
+ * HOUR}) to the velox flinksql interval comparison functions. The runtime
path is owned by the
+ * flinksql registration: the interval comparisons reuse the prestosql
comparison implementations
+ * but are registered in the flinksql namespace under dedicated interval_*
names, because the
+ * sparksql baseline already owns the standard comparison names as vector
functions with
+ * interval-covering signatures (vector functions take precedence over simple
functions at
+ * resolution). Only the operand typing lives here: day-time intervals are
mapped to BIGINT by the
+ * global type converter, so the operands are re-typed to the proper interval
velox types first.
+ */
+public class IntervalCompareRexCallConverter extends BaseRexCallConverter {
+
+ public IntervalCompareRexCallConverter(String functionName) {
+ super(functionName);
+ }
+
+ @Override
+ public ValidationResult isSuitable(RexCall callNode, RexConversionContext
context) {
+ if (callNode.getOperands().size() != 2) {
+ return ValidationResult.failure(
+ String.format(
+ "Interval comparison expects 2 operands, but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ List<RexNode> operands = callNode.getOperands();
+ boolean bothInterval =
+ IntervalArithmeticRexCallConverter.isIntervalOperand(operands.get(0))
+ &&
IntervalArithmeticRexCallConverter.isIntervalOperand(operands.get(1));
+ if (!bothInterval) {
+ return ValidationResult.failure(
+ String.format(
+ "Interval comparison requires two interval operands, but found:
%s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ return ValidationResult.success();
+ }
+
+ @Override
+ public TypedExpr toTypedExpr(RexCall callNode, RexConversionContext context)
{
+ List<TypedExpr> params = getParams(callNode, context);
+ List<RexNode> operands = callNode.getOperands();
+ TypedExpr left =
+ IntervalArithmeticRexCallConverter.retypeInterval(params.get(0),
operands.get(0));
+ TypedExpr right =
+ IntervalArithmeticRexCallConverter.retypeInterval(params.get(1),
operands.get(1));
+ return new CallTypedExpr(getResultType(callNode), List.of(left, right),
functionName);
+ }
+}
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalMultiplyRexCallConverter.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalMultiplyRexCallConverter.java
new file mode 100644
index 0000000000..66104ae1de
--- /dev/null
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/IntervalMultiplyRexCallConverter.java
@@ -0,0 +1,103 @@
+/*
+ * 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 org.apache.gluten.rexnode.RexNodeConverter;
+import org.apache.gluten.rexnode.TypeUtils;
+import org.apache.gluten.rexnode.ValidationResult;
+
+import io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.CastTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.TypedExpr;
+import io.github.zhztheplayer.velox4j.type.BigIntType;
+import io.github.zhztheplayer.velox4j.type.Type;
+
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexNode;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Converts interval * numeric (TIMESTAMPADD with a column amount rewrites to
{@code ts + (interval
+ * * n)}) to the velox flinksql multiply. The numeric operand is cast to
BIGINT and the interval is
+ * passed on the left. The output type is the interval velox type
(IntervalDayTime /
+ * IntervalYearMonth), not the BigIntType the global LogicalTypeConverter maps
day-time intervals
+ * to, so the result can feed the velox flinksql plus/minus signatures
directly.
+ */
+public class IntervalMultiplyRexCallConverter extends BaseRexCallConverter {
+
+ public IntervalMultiplyRexCallConverter() {
+ super("multiply");
+ }
+
+ @Override
+ public ValidationResult isSuitable(RexCall callNode, RexConversionContext
context) {
+ if (callNode.getOperands().size() != 2) {
+ return ValidationResult.failure(
+ String.format(
+ "Interval multiply expects 2 operands, but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ List<Type> paramTypes =
+ callNode.getOperands().stream()
+ .map(param -> RexNodeConverter.toType(param.getType()))
+ .collect(Collectors.toList());
+ // Day-time intervals map to BigIntType globally, so also check the
+ // Calcite type to catch them.
+ boolean firstInterval =
+ IntervalArithmeticRexCallConverter.isInterval(paramTypes.get(0))
+ ||
IntervalArithmeticRexCallConverter.isIntervalOperand(callNode.getOperands().get(0));
+ boolean secondInterval =
+ IntervalArithmeticRexCallConverter.isInterval(paramTypes.get(1))
+ ||
IntervalArithmeticRexCallConverter.isIntervalOperand(callNode.getOperands().get(1));
+ boolean suitable =
+ (firstInterval && TypeUtils.isNumericType(paramTypes.get(1)))
+ || (secondInterval && TypeUtils.isNumericType(paramTypes.get(0)));
+ if (!suitable) {
+ return ValidationResult.failure(
+ String.format(
+ "Interval multiply requires an interval and a numeric operand,
but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ return ValidationResult.success();
+ }
+
+ @Override
+ public TypedExpr toTypedExpr(RexCall callNode, RexConversionContext context)
{
+ List<TypedExpr> params = getParams(callNode, context);
+ // Normalize to (interval, BIGINT): the velox signatures take the numeric
+ // operand as BIGINT and keep interval on the left.
+ boolean firstIsInterval =
+
IntervalArithmeticRexCallConverter.isInterval(params.get(0).getReturnType())
+ ||
IntervalArithmeticRexCallConverter.isIntervalOperand(callNode.getOperands().get(0));
+ TypedExpr interval = params.get(firstIsInterval ? 0 : 1);
+ TypedExpr numeric = params.get(firstIsInterval ? 1 : 0);
+ RexNode intervalRexNode = callNode.getOperands().get(firstIsInterval ? 0 :
1);
+ // Re-type the interval operand from BigIntType to the proper interval
+ // velox type (literals are rebuilt as interval constants, other
+ // expressions are cast).
+ interval = IntervalArithmeticRexCallConverter.retypeInterval(interval,
intervalRexNode);
+ if (!(numeric.getReturnType() instanceof BigIntType)) {
+ numeric = CastTypedExpr.create(new BigIntType(), numeric, false);
+ }
+ Type resultType =
IntervalArithmeticRexCallConverter.getIntervalVeloxType(callNode);
+ return new CallTypedExpr(resultType, new ArrayList<>(List.of(interval,
numeric)), functionName);
+ }
+}
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java
index f452842617..b299f564f3 100644
---
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java
@@ -44,6 +44,7 @@ public class RexCallConverterFactory {
() -> new
BasicArithmeticOperatorRexCallConverter("greaterthan"),
() -> new StringCompareRexCallConverter("greaterthan"),
() -> new StringNumberCompareRexCallConverter("greaterthan"),
+ () -> new
IntervalCompareRexCallConverter("interval_greaterthan"),
() -> new
DecimalArithmeticOperatorRexCallConverters("greaterthan", true))),
Map.entry(
"<",
@@ -51,34 +52,40 @@ public class RexCallConverterFactory {
() -> new
BasicArithmeticOperatorRexCallConverter("lessthan"),
() -> new StringCompareRexCallConverter("lessthan"),
() -> new StringNumberCompareRexCallConverter("lessthan"),
+ () -> new
IntervalCompareRexCallConverter("interval_lessthan"),
() -> new
DecimalArithmeticOperatorRexCallConverters("lessthan", true))),
Map.entry(
"=",
Arrays.asList(
() -> new BasicArithmeticOperatorRexCallConverter("equalto"),
() -> new StringCompareRexCallConverter("equalto"),
- () -> new StringNumberCompareRexCallConverter("equalto"))),
+ () -> new StringNumberCompareRexCallConverter("equalto"),
+ () -> new
IntervalCompareRexCallConverter("interval_equalto"))),
Map.entry(
"<>",
Arrays.asList(
- () -> new
DecimalArithmeticOperatorRexCallConverters("decimal_notequalto"))),
+ () -> new
DecimalArithmeticOperatorRexCallConverters("decimal_notequalto"),
+ () -> new
IntervalCompareRexCallConverter("interval_notequalto"))),
Map.entry(
"/", Arrays.asList(() -> new
DecimalArithmeticOperatorRexCallConverters("divide"))),
Map.entry(
"*",
Arrays.asList(
() -> new
BasicArithmeticOperatorRexCallConverter("multiply"),
- () -> new
DecimalArithmeticOperatorRexCallConverters("multiply"))),
+ () -> new
DecimalArithmeticOperatorRexCallConverters("multiply"),
+ () -> new IntervalMultiplyRexCallConverter())),
Map.entry(
"-",
Arrays.asList(
() -> new SubtractRexCallConverter(),
- () -> new
DecimalArithmeticOperatorRexCallConverters("subtract"))),
+ () -> new
DecimalArithmeticOperatorRexCallConverters("subtract"),
+ () -> new IntervalArithmeticRexCallConverter("minus",
false))),
Map.entry(
"+",
Arrays.asList(
() -> new BasicArithmeticOperatorRexCallConverter("add"),
- () -> new
DecimalArithmeticOperatorRexCallConverters("add"))),
+ () -> new DecimalArithmeticOperatorRexCallConverters("add"),
+ () -> new IntervalArithmeticRexCallConverter("plus", true))),
Map.entry("MOD", Arrays.asList(() -> new ModRexCallConverter())),
Map.entry("Reinterpret", Arrays.asList(() -> new
ReinterpretRexCallConverter())),
Map.entry("CAST", Arrays.asList(() -> new
DefaultRexCallConverter("cast"))),
@@ -87,20 +94,24 @@ public class RexCallConverterFactory {
Map.entry("SPLIT_INDEX", Arrays.asList(() -> new
SplitIndexRexCallConverter())),
Map.entry("SEARCH", Arrays.asList(() -> new
SearchRexCallConverter())),
Map.entry("DATE_FORMAT", Arrays.asList(() -> new
DefaultRexCallConverter("date_format"))),
+ Map.entry("FROM_UNIXTIME", Arrays.asList(() -> new
FromUnixtimeRexCallConverter())),
+ Map.entry("UNIX_TIMESTAMP", Arrays.asList(() -> new
UnixTimestampRexCallConverter())),
Map.entry(
">=",
Arrays.asList(
() -> new
BasicArithmeticOperatorRexCallConverter("greaterthanorequal"),
() -> new
StringCompareRexCallConverter("greaterthanorequal"),
() -> new
StringNumberCompareRexCallConverter("greaterthanorequal"),
- () -> new
TimestampIntervalRexCallConverter("greaterthanorequal"))),
+ () -> new
TimestampIntervalRexCallConverter("greaterthanorequal"),
+ () -> new
IntervalCompareRexCallConverter("interval_greaterthanorequal"))),
Map.entry(
"<=",
Arrays.asList(
() -> new
BasicArithmeticOperatorRexCallConverter("lessthanorequal"),
() -> new StringCompareRexCallConverter("lessthanorequal"),
() -> new
StringNumberCompareRexCallConverter("lessthanorequal"),
- () -> new
TimestampIntervalRexCallConverter("lessthanorequal"))),
+ () -> new
TimestampIntervalRexCallConverter("lessthanorequal"),
+ () -> new
IntervalCompareRexCallConverter("interval_lessthanorequal"))),
Map.entry("PROCTIME", Arrays.asList(() -> new
DefaultRexCallConverter("unix_timestamp"))),
Map.entry("OR", Arrays.asList(() -> new
DefaultRexCallConverter("or"))),
Map.entry("IS NOT NULL", Arrays.asList(() -> new
DefaultRexCallConverter("isnotnull"))),
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/SubstractRexCallConverter.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/SubstractRexCallConverter.java
index f2e99df962..2fb51fd0b2 100644
---
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/SubstractRexCallConverter.java
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/SubstractRexCallConverter.java
@@ -49,7 +49,9 @@ class SubtractRexCallConverter extends BaseRexCallConverter {
callNode.getOperands().size() == 2
&& (paramTypes.stream().allMatch(TypeUtils::isNumericType)
|| (paramTypes.get(0) instanceof TimestampType
- && paramTypes.get(1) instanceof BigIntType));
+ && paramTypes.get(1) instanceof BigIntType))
+ && !IntervalArithmeticRexCallConverter.isIntervalOperand(
+ callNode.getOperands().get(callNode.getOperands().size() - 1));
if (!validate) {
String message =
String.format(
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/UnixTimestampRexCallConverter.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/UnixTimestampRexCallConverter.java
new file mode 100644
index 0000000000..aec8ff3f19
--- /dev/null
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/UnixTimestampRexCallConverter.java
@@ -0,0 +1,59 @@
+/*
+ * 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 org.apache.gluten.rexnode.RexNodeConverter;
+import org.apache.gluten.rexnode.ValidationResult;
+
+import io.github.zhztheplayer.velox4j.type.VarCharType;
+
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexNode;
+
+/**
+ * Converts Flink UNIX_TIMESTAMP to the velox flinksql unix_timestamp function.
+ *
+ * <p>Flink SQL accepts zero, one or two string operands; every operand must
be a string (the
+ * timestamp overloads belong to the Table API only). The result type is
forced to BIGINT by
+ * DefaultRexCallConverter.
+ */
+public class UnixTimestampRexCallConverter extends DefaultRexCallConverter {
+
+ public UnixTimestampRexCallConverter() {
+ super("unix_timestamp");
+ }
+
+ @Override
+ public ValidationResult isSuitable(RexCall callNode, RexConversionContext
context) {
+ if (callNode.getOperands().size() > 2) {
+ return ValidationResult.failure(
+ String.format(
+ "UNIX_TIMESTAMP expects at most 2 operands, but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ for (RexNode operand : callNode.getOperands()) {
+ if (!(RexNodeConverter.toType(operand.getType()) instanceof
VarCharType)) {
+ return ValidationResult.failure(
+ String.format(
+ "UNIX_TIMESTAMP operands must be strings, but found: %s",
+ getFunctionProtoTypeName(callNode)));
+ }
+ }
+ return ValidationResult.success();
+ }
+}
diff --git
a/gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java
b/gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java
index c5cdc1c84d..6f52e80d39 100644
---
a/gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java
+++
b/gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java
@@ -36,6 +36,7 @@ import org.apache.flink.table.types.logical.TimeType;
import org.apache.flink.table.types.logical.TimestampType;
import org.apache.flink.table.types.logical.TinyIntType;
import org.apache.flink.table.types.logical.VarCharType;
+import org.apache.flink.table.types.logical.YearMonthIntervalType;
import java.util.List;
import java.util.Map;
@@ -80,6 +81,9 @@ public class LogicalTypeConverter {
Map.entry(
DayTimeIntervalType.class,
logicalType -> new
io.github.zhztheplayer.velox4j.type.BigIntType()),
+ Map.entry(
+ YearMonthIntervalType.class,
+ logicalType -> new
io.github.zhztheplayer.velox4j.type.IntervalYearMonthType()),
Map.entry(
DateType.class, logicalType -> new
io.github.zhztheplayer.velox4j.type.DateType()),
Map.entry(
diff --git
a/gluten-flink/ut/src/test/java/org/apache/gluten/rexnode/FromUnixtimeUnixTimestampConverterTest.java
b/gluten-flink/ut/src/test/java/org/apache/gluten/rexnode/FromUnixtimeUnixTimestampConverterTest.java
new file mode 100644
index 0000000000..0d6b60aa75
--- /dev/null
+++
b/gluten-flink/ut/src/test/java/org/apache/gluten/rexnode/FromUnixtimeUnixTimestampConverterTest.java
@@ -0,0 +1,170 @@
+/*
+ * 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;
+
+import org.apache.gluten.rexnode.functions.FromUnixtimeRexCallConverter;
+import org.apache.gluten.rexnode.functions.RexCallConverter;
+import org.apache.gluten.rexnode.functions.RexCallConverterFactory;
+import org.apache.gluten.rexnode.functions.UnixTimestampRexCallConverter;
+
+import io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.CastTypedExpr;
+import io.github.zhztheplayer.velox4j.expression.TypedExpr;
+import io.github.zhztheplayer.velox4j.type.BigIntType;
+import io.github.zhztheplayer.velox4j.type.VarCharType;
+
+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.RexCall;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class FromUnixtimeUnixTimestampConverterTest {
+
+ private static FlinkTypeFactory typeFactory;
+ private static FlinkRexBuilder rexBuilder;
+ private static RexConversionContext context;
+
+ @BeforeAll
+ public static void setUp() {
+ typeFactory =
+ new FlinkTypeFactory(
+ Thread.currentThread().getContextClassLoader(),
FlinkTypeSystem.INSTANCE);
+ rexBuilder = new FlinkRexBuilder(typeFactory);
+ context = new RexConversionContext(List.of("c0", "c1"));
+ }
+
+ private RexNode intInputRef() {
+ return
rexBuilder.makeInputRef(typeFactory.createSqlType(SqlTypeName.INTEGER), 0);
+ }
+
+ private RexNode bigintInputRef() {
+ return
rexBuilder.makeInputRef(typeFactory.createSqlType(SqlTypeName.BIGINT), 0);
+ }
+
+ private RexNode varcharInputRef() {
+ return
rexBuilder.makeInputRef(typeFactory.createSqlType(SqlTypeName.VARCHAR), 1);
+ }
+
+ private RexNode varcharLiteral(String value) {
+ return rexBuilder.makeLiteral(value,
typeFactory.createSqlType(SqlTypeName.VARCHAR), false);
+ }
+
+ @Test
+ public void fromUnixtimeIntOperandIsCastToBigint() {
+ RexCall call =
+ (RexCall) rexBuilder.makeCall(FlinkSqlOperatorTable.FROM_UNIXTIME,
intInputRef());
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ assertThat(converter).isInstanceOf(FromUnixtimeRexCallConverter.class);
+ assertThat(converter.isSuitable(call, context).isOk()).isTrue();
+
+ TypedExpr expr = converter.toTypedExpr(call, context);
+ assertThat(expr).isInstanceOf(CallTypedExpr.class);
+ CallTypedExpr callExpr = (CallTypedExpr) expr;
+ assertThat(callExpr.getFunctionName()).isEqualTo("from_unixtime");
+ assertThat(callExpr.getReturnType()).isInstanceOf(VarCharType.class);
+ assertThat(callExpr.getInputs()).hasSize(1);
+ assertThat(callExpr.getInputs().get(0)).isInstanceOf(CastTypedExpr.class);
+
assertThat(callExpr.getInputs().get(0).getReturnType()).isInstanceOf(BigIntType.class);
+ }
+
+ @Test
+ public void fromUnixtimeBigintOperandPassesThrough() {
+ RexCall call =
+ (RexCall) rexBuilder.makeCall(FlinkSqlOperatorTable.FROM_UNIXTIME,
bigintInputRef());
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ assertThat(converter.isSuitable(call, context).isOk()).isTrue();
+
+ CallTypedExpr callExpr = (CallTypedExpr) converter.toTypedExpr(call,
context);
+
assertThat(callExpr.getInputs().get(0)).isNotInstanceOf(CastTypedExpr.class);
+
assertThat(callExpr.getInputs().get(0).getReturnType()).isInstanceOf(BigIntType.class);
+ }
+
+ @Test
+ public void fromUnixtimeWithFormatKeepsFormatOperand() {
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ FlinkSqlOperatorTable.FROM_UNIXTIME,
+ bigintInputRef(),
+ varcharLiteral("yyyy-MM-dd"));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ assertThat(converter.isSuitable(call, context).isOk()).isTrue();
+
+ CallTypedExpr callExpr = (CallTypedExpr) converter.toTypedExpr(call,
context);
+ assertThat(callExpr.getInputs()).hasSize(2);
+
assertThat(callExpr.getInputs().get(1).getReturnType()).isInstanceOf(VarCharType.class);
+ }
+
+ @Test
+ public void fromUnixtimeRejectsNonIntegralFirstOperand() {
+ RexCall call =
+ (RexCall) rexBuilder.makeCall(FlinkSqlOperatorTable.FROM_UNIXTIME,
varcharInputRef());
+ // The factory throws when no converter is suitable (GFV has no fallback);
+ // assert on the converter directly for the negative case.
+ assertThat(new FromUnixtimeRexCallConverter().isSuitable(call,
context).isOk()).isFalse();
+ }
+
+ @Test
+ public void unixTimestampNoOperands() {
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ FlinkSqlOperatorTable.UNIX_TIMESTAMP,
Collections.<RexNode>emptyList());
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ assertThat(converter).isInstanceOf(UnixTimestampRexCallConverter.class);
+ assertThat(converter.isSuitable(call, context).isOk()).isTrue();
+
+ CallTypedExpr callExpr = (CallTypedExpr) converter.toTypedExpr(call,
context);
+ assertThat(callExpr.getFunctionName()).isEqualTo("unix_timestamp");
+ assertThat(callExpr.getReturnType()).isInstanceOf(BigIntType.class);
+ assertThat(callExpr.getInputs()).isEmpty();
+ }
+
+ @Test
+ public void unixTimestampStringAndFormatOperands() {
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ FlinkSqlOperatorTable.UNIX_TIMESTAMP,
+ varcharInputRef(),
+ varcharLiteral("yyyy-MM-dd"));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ assertThat(converter.isSuitable(call, context).isOk()).isTrue();
+
+ CallTypedExpr callExpr = (CallTypedExpr) converter.toTypedExpr(call,
context);
+ assertThat(callExpr.getInputs()).hasSize(2);
+ assertThat(callExpr.getReturnType()).isInstanceOf(BigIntType.class);
+ }
+
+ @Test
+ public void unixTimestampRejectsNonStringOperand() {
+ RexCall call =
+ (RexCall) rexBuilder.makeCall(FlinkSqlOperatorTable.UNIX_TIMESTAMP,
bigintInputRef());
+ assertThat(new UnixTimestampRexCallConverter().isSuitable(call,
context).isOk()).isFalse();
+ }
+}
diff --git
a/gluten-flink/ut/src/test/java/org/apache/gluten/rexnode/IntervalArithmeticConverterTest.java
b/gluten-flink/ut/src/test/java/org/apache/gluten/rexnode/IntervalArithmeticConverterTest.java
new file mode 100644
index 0000000000..955e85e6c1
--- /dev/null
+++
b/gluten-flink/ut/src/test/java/org/apache/gluten/rexnode/IntervalArithmeticConverterTest.java
@@ -0,0 +1,338 @@
+/*
+ * 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;
+
+import org.apache.gluten.rexnode.functions.RexCallConverter;
+import org.apache.gluten.rexnode.functions.RexCallConverterFactory;
+
+import io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
+import io.github.zhztheplayer.velox4j.type.BigIntType;
+import io.github.zhztheplayer.velox4j.type.BooleanType;
+import io.github.zhztheplayer.velox4j.type.DateType;
+import io.github.zhztheplayer.velox4j.type.IntervalDayTimeType;
+import io.github.zhztheplayer.velox4j.type.IntervalYearMonthType;
+import io.github.zhztheplayer.velox4j.type.TimestampType;
+import io.github.zhztheplayer.velox4j.variant.BigIntValue;
+import io.github.zhztheplayer.velox4j.variant.Variant;
+
+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.calcite.avatica.util.TimeUnit;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.sql.SqlIntervalQualifier;
+import org.apache.calcite.sql.parser.SqlParserPos;
+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.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class IntervalArithmeticConverterTest {
+
+ private static FlinkTypeFactory typeFactory;
+ private static FlinkRexBuilder rexBuilder;
+ private static RexConversionContext context;
+
+ @BeforeAll
+ public static void setUp() {
+ typeFactory =
+ new FlinkTypeFactory(
+ Thread.currentThread().getContextClassLoader(),
FlinkTypeSystem.INSTANCE);
+ rexBuilder = new FlinkRexBuilder(typeFactory);
+ context = new RexConversionContext(List.of("c0", "c1"));
+ }
+
+ private RexNode tsInputRef() {
+ return
rexBuilder.makeInputRef(typeFactory.createSqlType(SqlTypeName.TIMESTAMP, 3), 0);
+ }
+
+ private RexNode dateInputRef() {
+ return
rexBuilder.makeInputRef(typeFactory.createSqlType(SqlTypeName.DATE), 0);
+ }
+
+ private RexNode bigintInputRef() {
+ return
rexBuilder.makeInputRef(typeFactory.createSqlType(SqlTypeName.BIGINT), 1);
+ }
+
+ private RexNode hourInterval(long millis) {
+ SqlIntervalQualifier qualifier =
+ new SqlIntervalQualifier(TimeUnit.HOUR, null, SqlParserPos.ZERO);
+ return rexBuilder.makeIntervalLiteral(BigDecimal.valueOf(millis),
qualifier);
+ }
+
+ private RexNode monthInterval(int months) {
+ SqlIntervalQualifier qualifier =
+ new SqlIntervalQualifier(TimeUnit.MONTH, null, SqlParserPos.ZERO);
+ return rexBuilder.makeIntervalLiteral(BigDecimal.valueOf(months),
qualifier);
+ }
+
+ @Test
+ public void logicalTypeConverterMapsIntervals() {
+ // The global mapping keeps the legacy behavior: day-time intervals map
+ // to BIGINT (millis) so existing paths stay untouched; interval velox
+ // types are only produced by the interval converters.
+ org.apache.flink.table.types.logical.DayTimeIntervalType dayTime =
+ new org.apache.flink.table.types.logical.DayTimeIntervalType(
+
org.apache.flink.table.types.logical.DayTimeIntervalType.DayTimeResolution
+ .DAY_TO_SECOND,
+ 2,
+ 6);
+ org.apache.flink.table.types.logical.YearMonthIntervalType yearMonth =
+ new org.apache.flink.table.types.logical.YearMonthIntervalType(
+
org.apache.flink.table.types.logical.YearMonthIntervalType.YearMonthResolution.YEAR,
2);
+ assertThat(org.apache.gluten.util.LogicalTypeConverter.toVLType(dayTime))
+ .isInstanceOf(BigIntType.class);
+ assertThat(org.apache.gluten.util.LogicalTypeConverter.toVLType(yearMonth))
+ .isInstanceOf(IntervalYearMonthType.class);
+ }
+
+ @Test
+ public void toVariantReadsIntervalLiterals() {
+ RexLiteral hour = (RexLiteral) hourInterval(3600000);
+ Variant variant = RexNodeConverter.toVariant(hour);
+ assertThat(variant).isInstanceOf(BigIntValue.class);
+ assertThat(((BigIntValue) variant).getValue()).isEqualTo(3600000L);
+ }
+
+ @Test
+ public void timestampPlusIntervalDayTime() {
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS,
+ tsInputRef(),
+ hourInterval(3600000));
+ assertThat(call.getOperator().getName()).isEqualTo("+");
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(call, context);
+ assertThat(expr.getFunctionName()).isEqualTo("plus");
+ assertThat(expr.getInputs()).hasSize(2);
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+ }
+
+ @Test
+ public void timestampPlusIntervalYearMonth() {
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS,
+ tsInputRef(),
+ monthInterval(1));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(call, context);
+ assertThat(expr.getFunctionName()).isEqualTo("plus");
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(IntervalYearMonthType.class);
+ }
+
+ @Test
+ public void intervalOnLeftPlusIsFlipped() {
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS,
+ hourInterval(3600000),
+ tsInputRef());
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(call, context);
+ assertThat(expr.getFunctionName()).isEqualTo("plus");
+ // Interval flipped to the right: velox only registers (datetime,
interval).
+
assertThat(expr.getInputs().get(0).getReturnType()).isInstanceOf(TimestampType.class);
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+ }
+
+ @Test
+ public void datePlusIntervalDayTimeToTimestamp() {
+ // Flink: TIMESTAMPADD(HOUR, 5, DATE '2025-03-15') returns a TIMESTAMP.
+ // The converter should cast the DATE to TIMESTAMP before calling plus.
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS,
+ dateInputRef(),
+ hourInterval(5 * 3600000));
+ // Override the result type to TIMESTAMP (what Calcite would infer).
+ org.apache.calcite.rex.RexCall resultCall =
+ (org.apache.calcite.rex.RexCall)
+ rexBuilder.makeCall(
+ typeFactory.createSqlType(SqlTypeName.TIMESTAMP, 3),
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS,
+ java.util.List.of(dateInputRef(), hourInterval(5 * 3600000)));
+ RexCallConverter converter =
RexCallConverterFactory.getConverter(resultCall, context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(resultCall,
context);
+ assertThat(expr.getFunctionName()).isEqualTo("plus");
+ assertThat(expr.getReturnType()).isInstanceOf(TimestampType.class);
+ // First operand should be CAST(DATE AS TIMESTAMP).
+ assertThat(expr.getInputs().get(0))
+
.isInstanceOf(io.github.zhztheplayer.velox4j.expression.CastTypedExpr.class);
+
assertThat(expr.getInputs().get(0).getReturnType()).isInstanceOf(TimestampType.class);
+ // Second operand stays as the interval.
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+ }
+
+ @Test
+ public void datePlusInterval() {
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS,
+ dateInputRef(),
+ monthInterval(1));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(call, context);
+ assertThat(expr.getFunctionName()).isEqualTo("plus");
+ assertThat(expr.getReturnType()).isInstanceOf(DateType.class);
+ }
+
+ @Test
+ public void timestampMinusInterval() {
+ RexCall minus =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.MINUS,
+ tsInputRef(),
+ hourInterval(3600000));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(minus,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(minus, context);
+ assertThat(expr.getFunctionName()).isEqualTo("minus");
+ }
+
+ @Test
+ public void intervalMultiplyBigint() {
+ RexCall multiply =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.MULTIPLY,
+ hourInterval(3600000),
+ bigintInputRef());
+ RexCallConverter converter =
RexCallConverterFactory.getConverter(multiply, context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(multiply,
context);
+ assertThat(expr.getFunctionName()).isEqualTo("multiply");
+ // The interval operand is re-typed from the global BigIntType mapping to
+ // the proper interval velox type, and the result keeps the interval type
+ // so it can feed plus/minus directly.
+
assertThat(expr.getInputs().get(0).getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(BigIntType.class);
+ assertThat(expr.getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+ }
+
+ @Test
+ public void bigintMultiplyIntervalIsNormalized() {
+ RexCall multiply =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.MULTIPLY,
+ bigintInputRef(),
+ monthInterval(1));
+ RexCallConverter converter =
RexCallConverterFactory.getConverter(multiply, context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(multiply,
context);
+ assertThat(expr.getFunctionName()).isEqualTo("multiply");
+ // Numeric-on-left is normalized to (interval, BIGINT).
+
assertThat(expr.getInputs().get(0).getReturnType()).isInstanceOf(IntervalYearMonthType.class);
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(BigIntType.class);
+ assertThat(expr.getReturnType()).isInstanceOf(IntervalYearMonthType.class);
+ }
+
+ @Test
+ public void numericPlusStillUsesArithmeticConverter() {
+ RexCall call =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS,
+ bigintInputRef(),
+
rexBuilder.makeInputRef(typeFactory.createSqlType(SqlTypeName.BIGINT), 0));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(call,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(call, context);
+ // Plain numeric plus must keep mapping to "add", not the interval branch.
+ assertThat(expr.getFunctionName()).isEqualTo("add");
+ }
+
+ @Test
+ public void intervalMultiplyCompareInterval() {
+ // INTERVAL '1' HOUR * n > INTERVAL '2' HOUR: the comparison operands are
+ // the interval-typed multiply output and a day-time interval literal.
+ RexNode multiply =
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.MULTIPLY,
+ hourInterval(3600000),
+ bigintInputRef());
+ RexCall cmp =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.GREATER_THAN,
+ multiply,
+ hourInterval(2 * 3600000));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(cmp,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(cmp, context);
+ assertThat(expr.getFunctionName()).isEqualTo("interval_greaterthan");
+ assertThat(expr.getReturnType()).isInstanceOf(BooleanType.class);
+ // The multiply output keeps the interval type and the literal operand is
+ // re-typed from the global BIGINT mapping to the interval velox type.
+
assertThat(expr.getInputs().get(0).getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+ assertThat(expr.getInputs().get(1))
+
.isInstanceOf(io.github.zhztheplayer.velox4j.expression.ConstantTypedExpr.class);
+ }
+
+ @Test
+ public void intervalMultiplyCompareYearMonth() {
+ RexNode multiply =
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.MULTIPLY,
+ monthInterval(1),
+ bigintInputRef());
+ RexCall cmp =
+ (RexCall)
+ rexBuilder.makeCall(
+
org.apache.calcite.sql.fun.SqlStdOperatorTable.LESS_THAN_OR_EQUAL,
+ multiply,
+ monthInterval(2));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(cmp,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(cmp, context);
+ assertThat(expr.getFunctionName()).isEqualTo("interval_lessthanorequal");
+
assertThat(expr.getInputs().get(0).getReturnType()).isInstanceOf(IntervalYearMonthType.class);
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(IntervalYearMonthType.class);
+ }
+
+ @Test
+ public void intervalNotEqual() {
+ RexNode multiply =
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.MULTIPLY,
+ hourInterval(3600000),
+ bigintInputRef());
+ RexCall cmp =
+ (RexCall)
+ rexBuilder.makeCall(
+ org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT_EQUALS,
+ multiply,
+ hourInterval(3600000));
+ RexCallConverter converter = RexCallConverterFactory.getConverter(cmp,
context);
+ CallTypedExpr expr = (CallTypedExpr) converter.toTypedExpr(cmp, context);
+ // NOT EQUAL maps to the dedicated flinksql interval_notequalto signature.
+ assertThat(expr.getFunctionName()).isEqualTo("interval_notequalto");
+ assertThat(expr.getReturnType()).isInstanceOf(BooleanType.class);
+
assertThat(expr.getInputs().get(0).getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+
assertThat(expr.getInputs().get(1).getReturnType()).isInstanceOf(IntervalDayTimeType.class);
+ }
+}
diff --git
a/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java
b/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java
index 750d06648f..d10444a598 100644
---
a/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java
+++
b/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java
@@ -447,4 +447,36 @@ class ScalarFunctionsTest extends GlutenStreamingTestBase {
runAndCheck(
literalQuery, Arrays.asList("+I[2024-03-15T10:15:30.000]",
"+I[2024-03-15T10:15:30.000]"));
}
+
+ @Test
+ void testTimestampAddSubDayOnDate() {
+ // Flink: TIMESTAMPADD with sub-day units on a DATE returns a TIMESTAMP;
+ // the converter casts DATE -> TIMESTAMP before the plus call. DATE_FORMAT
+ // with a second-precision pattern keeps the expectation rendering-stable
+ // (the sub-day results are whole seconds by construction).
+ // The DATE input is derived via CAST from a string: the values connector
+ // round-trips rows through their string form, whose DATE parsing is not
+ // implemented in the connector's formatter yet (a pre-existing gap,
+ // unrelated to this path; the GFV e2e suite covers real DATE sources).
+ List<Row> rows =
+ Arrays.asList(Row.of(1, "2017-11-29"), Row.of(2, "2025-01-31"),
Row.of(3, "2025-12-31"));
+ createSimpleBoundedValuesTable("tblDateSubday", "a int, d string", rows);
+ String query =
+ "select DATE_FORMAT(TIMESTAMPADD(HOUR, 5, CAST(d AS DATE)),
'yyyy-MM-dd HH:mm:ss'), "
+ + "DATE_FORMAT(TIMESTAMPADD(MINUTE, -90, CAST(d AS DATE)),
'yyyy-MM-dd HH:mm:ss'), "
+ + "DATE_FORMAT(TIMESTAMPADD(SECOND, 30, CAST(d AS DATE)),
'yyyy-MM-dd HH:mm:ss') "
+ + "from tblDateSubday";
+ runAndCheck(
+ query,
+ Arrays.asList(
+ "+I[2017-11-29 05:00:00, 2017-11-28 22:30:00, 2017-11-29
00:00:30]",
+ "+I[2025-01-31 05:00:00, 2025-01-30 22:30:00, 2025-01-31
00:00:30]",
+ "+I[2025-12-31 05:00:00, 2025-12-30 22:30:00, 2025-12-31
00:00:30]"));
+
+ // A handwritten DATE + day-time interval keeps the DATE type in Flink;
+ // rendered via CAST to stay independent of raw DATE rendering.
+ String handwritten =
+ "select CAST(CAST(d AS DATE) + INTERVAL '8' HOUR AS STRING) from
tblDateSubday";
+ runAndCheck(handwritten, Arrays.asList("+I[2017-11-29]", "+I[2025-01-31]",
"+I[2025-12-31]"));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]