github-actions[bot] commented on code in PR #68579:
URL: https://github.com/apache/doris/pull/68579#discussion_r4229227750
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayApply.java:
##########
@@ -56,22 +58,25 @@ public class ArrayApply extends ScalarFunction
*/
public ArrayApply(Expression arg0, Expression arg1, Expression arg2) {
super("array_apply", arg0, arg1, arg2);
- checkArguments(arg0, arg1, arg2);
}
/** constructor for withChildren and reuse signature */
private ArrayApply(ScalarFunctionParams functionParams) {
super(functionParams);
- checkArguments(
- functionParams.arguments.get(0),
functionParams.arguments.get(1), functionParams.arguments.get(2)
- );
}
- private void checkArguments(Expression arg0, Expression arg1, Expression
arg2) {
- if (!(arg1 instanceof StringLikeLiteral)) {
+ @Override
+ public void checkLegalityBeforeTypeCoercion() {
+ // validate the op FE can evaluate here, because constant folding may
remove this function before any
+ // later check
+ Expression arg1 = ExpressionUtils.foldConstantArgument(getArgument(1));
+ Expression arg2 = getArgument(2);
+ if (!arg1.isConstant() || (arg1 instanceof Literal && !(arg1
instanceof StringLikeLiteral))) {
Review Comment:
[P2] Validate a BE-evaluated NULL required argument before scalar NULL
propagation. `array_apply([1,2], if(crc32('') = 0, cast(NULL AS STRING), '>'),
1)` passes this new constant gate, but BE's default nullable wrapper returns
NULL before checking the operator; a literal NULL operator is rejected. The
same BE-only path affects `sha2` digest length and `split_by_regexp` limit
despite their FE typed-NULL fixes. Validate evaluated required values before
the generic NULL shortcut and add regressions for all three.
##########
be/src/exprs/aggregate/aggregate_function_null.h:
##########
@@ -711,6 +711,11 @@ class AggregateFunctionNullVariadicInline final
void check_input_columns_type(const IColumn** columns) const override {
IAggregateFunction::check_input_columns_type(columns);
+ if constexpr (requires(NestFuction& function, const IColumn**
input_columns) {
+ function.check_nullable_input_columns(input_columns);
Review Comment:
[P2] Validate BE-evaluated sequence patterns before skipping nullable rows.
`sequence_count(if(crc32('') = 0, cast(NULL as STRING), '(?1)'), dt, k = 1)`
passes FE, then this wrapper skips every row and returns 0 instead of rejecting
the NULL pattern. A non-NULL invalid pattern such as `lpad('(?9)', 4, '(')`
also avoids parsing when all `dt` values are NULL. The existing typed-NULL
thread covered only FE-folded values. Validate NULLness and syntax before row
filtering for both `sequence_count` and `sequence_match`.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/DateTimeWithPrecision.java:
##########
@@ -43,6 +44,12 @@ public DateTimeWithPrecision(ScalarFunctionParams
functionParams) {
super(functionParams);
}
+ @Override
+ public Expression prepareBeforeTypeCoercion() {
Review Comment:
[P2] Check the full precision value before narrowing it to `int`. This new
preparation folds `now(cast(4294967299 as bigint) + cast(0 as bigint))` to a
BIGINT literal, but `getIntValue()` wraps 4294967299 to 3, so the range check
accepts an invalid precision and derives DATETIMEV2(3). Under default
non-strict casting, the later BIGINT-to-INT overflow becomes NULL, so the query
returns NULL instead of a precision error. The arithmetic form was rejected
before this change. Validate the original integer before signature/coercion and
cover a wide BIGINT expression.
--
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]