[feature](variable) enables views, materialized views, generated columns, and alias functions to persist session variables#58031
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
TPC-H: Total hot run time: 33958 ms |
TPC-DS: Total hot run time: 180135 ms |
|
run buildall |
1 similar comment
|
run buildall |
FE UT Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 33798 ms |
TPC-DS: Total hot run time: 181914 ms |
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
TPC-H: Total hot run time: 33656 ms |
TPC-DS: Total hot run time: 188127 ms |
ClickBench: Total hot run time: 27.61 s |
|
run buildall |
TPC-H: Total hot run time: 34165 ms |
TPC-DS: Total hot run time: 188856 ms |
ClickBench: Total hot run time: 27.65 s |
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
1 similar comment
|
run buildall |
TPC-H: Total hot run time: 34060 ms |
TPC-DS: Total hot run time: 187928 ms |
ClickBench: Total hot run time: 27.66 s |
|
run cloud_p0 |
FE Regression Coverage ReportIncrement line coverage |
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
FE Regression Coverage ReportIncrement line coverage |
…mns, and alias functions to persist session variables (apache#58031) Problem Summary: When creating views, generated columns, materialized views, or alias functions, session variables that affect query results (e.g., `enable_decimal256`) are not persisted. This causes inconsistent query results when session variables differ between creation and query time. This PR persists session variables marked with `affectQueryResult()` annotation for: - Views - Generated Columns - Materialized Views - Alias Functions When querying these objects, the system automatically uses the persisted session variables from creation time, ensuring consistent results. - Added `sessionVariables` field to `View`, `Column`, `MTMV`, and `AliasFunction` classes - Created `AutoCloseSessionVariable` utility to temporarily apply persisted variables during query processing - Modified view/column/MV/function parsing logic to use persisted session variables - Added `SessionVarGuardExpr` to protect expressions that depend on session variables --------- Co-authored-by: jacktengg <tengjianping@selectdb.com>
…mns, and alias functions to persist session variables (apache#58031) Problem Summary: When creating views, generated columns, materialized views, or alias functions, session variables that affect query results (e.g., `enable_decimal256`) are not persisted. This causes inconsistent query results when session variables differ between creation and query time. This PR persists session variables marked with `affectQueryResult()` annotation for: - Views - Generated Columns - Materialized Views - Alias Functions When querying these objects, the system automatically uses the persisted session variables from creation time, ensuring consistent results. - Added `sessionVariables` field to `View`, `Column`, `MTMV`, and `AliasFunction` classes - Created `AutoCloseSessionVariable` utility to temporarily apply persisted variables during query processing - Modified view/column/MV/function parsing logic to use persisted session variables - Added `SessionVarGuardExpr` to protect expressions that depend on session variables --------- Co-authored-by: jacktengg <tengjianping@selectdb.com>
…mns, and alias functions to persist session variables (apache#58031) Problem Summary: When creating views, generated columns, materialized views, or alias functions, session variables that affect query results (e.g., `enable_decimal256`) are not persisted. This causes inconsistent query results when session variables differ between creation and query time. This PR persists session variables marked with `affectQueryResult()` annotation for: - Views - Generated Columns - Materialized Views - Alias Functions When querying these objects, the system automatically uses the persisted session variables from creation time, ensuring consistent results. - Added `sessionVariables` field to `View`, `Column`, `MTMV`, and `AliasFunction` classes - Created `AutoCloseSessionVariable` utility to temporarily apply persisted variables during query processing - Modified view/column/MV/function parsing logic to use persisted session variables - Added `SessionVarGuardExpr` to protect expressions that depend on session variables --------- Co-authored-by: jacktengg <tengjianping@selectdb.com>
…mns, and alias functions to persist session variables (apache#58031) ### What problem does this PR solve? Problem Summary: When creating views, generated columns, materialized views, or alias functions, session variables that affect query results (e.g., `enable_decimal256`) are not persisted. This causes inconsistent query results when session variables differ between creation and query time. This PR persists session variables marked with `affectQueryResult()` annotation for: - Views - Generated Columns - Materialized Views - Alias Functions When querying these objects, the system automatically uses the persisted session variables from creation time, ensuring consistent results. #### Key Changes - Added `sessionVariables` field to `View`, `Column`, `MTMV`, and `AliasFunction` classes - Created `AutoCloseSessionVariable` utility to temporarily apply persisted variables during query processing - Modified view/column/MV/function parsing logic to use persisted session variables - Added `SessionVarGuardExpr` to protect expressions that depend on session variables --------- Co-authored-by: jacktengg <tengjianping@selectdb.com>
…mv cache (apache#58863) mtmvCache is globally reused, and each query shares the same instance of mtmvCache. When generating the cache, it should not include any attributes that are specific to an individual query. current code has no problem, just add some ut Related PR: apache#58031
Problem Summary: FunctionIf in BE is only reached through nullif because SQL if is rewritten to VectorizedIfExpr. The nullif semantics can be represented as if(first = second, null, first), so this adds a Nereids expression normalization rule to rewrite remaining NullIf expressions to If after existing constant folding. The nullable-dependent conditional simplification also falls back to the same rewrite so NullIf does not survive that path. Rewriting nullif to if must not be controlled by disable_nereids_expression_rules, otherwise users could disable the rewrite and still require BE FunctionIf support for nullif. This changes NullIfToIf from a pattern rule with an ExpressionRuleType bit into a direct visitor-based expression rewrite rule, and adds coverage that the rewrite still runs when all expression rule bits are disabled. Alse delete stale file be/src/exprs/function/function_ifnull.h which is deleted by apache#58125 but accidentally add back by apache#58031
Problem Summary: BE FunctionIf is only needed by the legacy nullif execution path because SQL if() has already been rewritten to VectorizedIfExpr. The nullif expression is semantically equivalent to if(first = second, null, first), so Nereids now rewrites ordinary builtin nullif(first, second) calls in LogicalPlanBuilder before function binding and expression rewrite rules run. This makes the rewrite unconditional and independent of disable_nereids_expression_rules, while preserving normal analysis for non-builtin or invalid forms such as qualified names, DISTINCT, window specs, hints, and wrong arity. Alse delete stale file be/src/exprs/function/function_ifnull.h which is deleted by apache#58125 but accidentally add back by apache#58031
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
When creating views, generated columns, materialized views, or alias functions, session variables that affect query results (e.g.,
enable_decimal256) are not persisted. This causes inconsistent query results when session variables differ between creation and query time.This PR persists session variables marked with
affectQueryResult()annotation for:When querying these objects, the system automatically uses the persisted session variables from creation time, ensuring consistent results.
Key Changes
sessionVariablesfield toView,Column,MTMV, andAliasFunctionclassesAutoCloseSessionVariableutility to temporarily apply persisted variables during query processingSessionVarGuardExprto protect expressions that depend on session variablesRelease note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)