[Enhancement](udf) support volatility for udaf && udtf#63611
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
/review |
|
run buildall |
There was a problem hiding this comment.
Automated review completed. I did not find blocking correctness issues in the changed UDAF/UDTF volatility paths.
Critical checkpoint conclusions:
- Goal/test coverage: The PR extends volatility parsing, SHOW/SHOW CREATE emission, and Nereids catalog-function conversion for Java/Python UDAF and UDTF. Added unit tests cover default UDAF volatility, explicit UDTF volatility, SHOW properties, SHOW CREATE SQL, and Nereids conversion preservation.
- Scope/focus: The implementation is small and localized to function creation, display, replay SQL, and UDF expression wrappers.
- Concurrency/lifecycle: No new shared mutable state, locks, threads, static initialization, or lifecycle-sensitive ownership were introduced.
- Config/compatibility: No new config items. Existing functions without persisted volatility still use Function.getVolatility() fallback to IMMUTABLE, and replay SQL now includes a property that CreateFunctionCommand accepts for Java/Python UDAF/UDTF.
- Parallel paths: Java/Python and UDAF/UDTF conversion paths appear updated consistently; RPC/non-Java/Python paths still reject volatility.
- Error handling: Invalid volatility continues through FunctionVolatility.fromString and is converted to AnalysisException.
- Transaction/persistence/data correctness: No transaction or storage visibility paths are touched.
- Performance/observability: No hot-path or observability concerns found for these metadata-only changes.
User focus: No additional user-provided review focus was supplied.
TPC-H: Total hot run time: 31897 ms |
TPC-DS: Total hot run time: 172942 ms |
FE Regression Coverage ReportIncrement line coverage |
|
|
||
| @Override | ||
| public boolean isDeterministic() { | ||
| return volatility == FunctionVolatility.IMMUTABLE; |
|
/review |
|
run buildall |
d1c79a3 to
6114612
Compare
|
run buildall |
|
/review |
There was a problem hiding this comment.
Review result: no blocking findings found in the PR diff.
Critical checkpoint conclusions:
- Goal and coverage: The PR extends volatility metadata handling from scalar UDFs to UDAF/UDTF creation, Nereids function wrappers, SHOW FUNCTIONS, and SHOW CREATE FUNCTION. The changed paths appear to accomplish that goal, with unit coverage added for parser/default behavior, SQL rendering, SHOW FUNCTIONS properties, and Nereids wrapper propagation.
- Scope/focus: The implementation is small and focused. The existing review thread about moving deterministic logic to the common UDF layer is already addressed by the final patch, so I did not duplicate it.
- Concurrency/lifecycle: No new shared mutable state, threads, locks, static initialization dependencies, or non-obvious lifecycle management were introduced.
- Configuration/compatibility: No new config items or storage-format changes. Function volatility is already represented in function metadata; this PR primarily allows and propagates it for aggregate/table UDF forms.
- Parallel code paths: Java/Python and UDAF/UDTF paths were updated consistently for create, catalog conversion, and display.
- Error handling: Existing analysis exception patterns are preserved; invalid volatility still fails through FunctionVolatility parsing.
- Tests/results: Added FE unit coverage is relevant. I attempted to run mvn -pl fe-core -am test -Dtest=CreateFunctionTest,FunctionToSqlConverterTest,UdfVolatilityTest,ShowFunctionsCommandTest -DfailIfNoTests=false -Dskip.doc=true, but this runner is missing thirdparty/installed/bin/thrift, so Maven failed in fe-thrift before reaching fe-core tests.
- Observability/performance/data correctness: No runtime data read/write, transaction, memory tracking, or observability-sensitive path is changed; no performance concern found.
User focus: No additional user-provided review focus was specified.
FE UT Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 31327 ms |
TPC-DS: Total hot run time: 171602 ms |
FE Regression Coverage ReportIncrement line coverage |
|
PR approved by anyone and no changes requested. |
There was a problem hiding this comment.
Udf also extends VolatileExpression ?
| @@ -50,6 +51,7 @@ public class JavaUdaf extends AggregateFunction implements ExplicitlyCastableSig | |||
| private final FunctionSignature signature; | |||
| private final DataType intermediateType; | |||
| private final NullableMode nullableMode; | |||
| private final FunctionVolatility volatility; | |||
There was a problem hiding this comment.
need add VolatileIdentity field for case FunctionValatility.VOLATILE
| @@ -49,6 +50,7 @@ public class JavaUdtf extends TableGeneratingFunction implements ExplicitlyCasta | |||
| private final Function.BinaryType binaryType; | |||
| private final FunctionSignature signature; | |||
| private final NullableMode nullableMode; | |||
| private final FunctionVolatility volatility; | |||
There was a problem hiding this comment.
need add VolatileIdentity field for case FunctionValatility.VOLATILE
| @@ -50,6 +51,7 @@ public class PythonUdaf extends AggregateFunction implements ExplicitlyCastableS | |||
| private final FunctionSignature signature; | |||
| private final DataType intermediateType; | |||
| private final NullableMode nullableMode; | |||
| private final FunctionVolatility volatility; | |||
There was a problem hiding this comment.
need add VolatileIdentity field for case FunctionValatility.VOLATILE
Related PR: #62698
Problem Summary:
Add volatility metadata support for UDAF and UDTF definitions, so user-defined aggregate and table functions can preserve and expose their volatility semantics consistently with UDFs.