github-actions[bot] commented on code in PR #62698:
URL: https://github.com/apache/doris/pull/62698#discussion_r3130512611
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/udf/JavaUdf.java:
##########
@@ -99,6 +99,11 @@ public NullableMode getNullableMode() {
return nullableMode;
}
+ @Override
+ public boolean isDeterministic() {
Review Comment:
This blanket `false` is much broader than the UUID-style bug described in
the PR. The changed regression coverage itself is using pure helper functions
(`regression-test/java-udf-src/src/main/java/org/apache/doris/udf/IntTest.java`,
`MySumInt.java`, `FloatTest.java`, and
`regression-test/suites/pythonudf_p0/udf_scripts/float_test.py`), so after this
change even deterministic external UDFs are rejected from MV/MTMV and the
existing float MV tests had to be rewritten to opt into
`enable_nondeterministic_function = 'true'` and stop using the MV. Unless Doris
is intentionally declaring that *all* Java/Python UDF/UDAF/UDTFs are
non-deterministic, this needs a finer-grained determinism flag instead of
hardcoding `false` here and in the sibling classes.
##########
be/src/core/data_type_serde/data_type_decimal_serde.cpp:
##########
@@ -372,8 +372,9 @@ Status
DataTypeDecimalSerDe<T>::read_column_from_arrow(IColumn& column,
} else if constexpr (T == TYPE_DECIMAL256) {
const auto* concrete_array = dynamic_cast<const
arrow::Decimal256Array*>(arrow_array);
for (auto value_i = start; value_i < end; ++value_i) {
- column_data.emplace_back(
- *reinterpret_cast<const
FieldType*>(concrete_array->Value(value_i)));
+ FieldType decimal_value {};
+ memcpy(&decimal_value, concrete_array->Value(value_i),
sizeof(FieldType));
Review Comment:
Good catch for `TYPE_DECIMAL256`, but can we fold the same fix into
`TYPE_DECIMALV2` above while we're here? That branch still does
`*reinterpret_cast<const Decimal128V2*>(concrete_array->Value(value_i))`, which
has the same unaligned-Arrow-buffer UB that this hunk just removed for
Decimal256. Otherwise the misaligned-load risk remains for DECIMALV2.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/udf/PythonUdf.java:
##########
@@ -104,6 +104,11 @@ public NullableMode getNullableMode() {
return nullableMode;
}
+ @Override
+ public boolean isDeterministic() {
Review Comment:
This override only fixes the call sites that look at `isDeterministic()`.
Several Nereids rewrites that can duplicate or relocate expressions still guard
only on `containsUniqueFunction()`, e.g. `PushDownFilterThroughProject`,
`PushDownFilterThroughJoin`, `PushDownFilterThroughAggregation`, and
`PlanUtils.canMergeWithProjections()`. For example, `SELECT a FROM (SELECT
py_uuid_token(id) AS a FROM t) s WHERE a LIKE '1-%'` can still be pushed below
the project and evaluate `py_uuid_token(id)` twice with different results. So
the CTE case is fixed, but the optimizer bug is not closed end-to-end.
--
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]