Uh oh!
There was an error while loading. Please reload this page.
[improvement](mtmv) Support to use current_date() when create async mv - #36111
Conversation
doris-robot
commented
Jun 11, 2024
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
seawinde
commented
Jun 11, 2024
run buildall |
doris-robot
commented
Jun 11, 2024
TPC-H: Total hot run time: 39959 ms |
doris-robot
commented
Jun 11, 2024
TPC-DS: Total hot run time: 169159 ms |
doris-robot
commented
Jun 11, 2024
ClickBench: Total hot run time: 30.71 s |
seawinde
commented
Jun 11, 2024
run buildall |
doris-robot
commented
Jun 11, 2024
TPC-H: Total hot run time: 40702 ms |
doris-robot
commented
Jun 11, 2024
TPC-DS: Total hot run time: 173055 ms |
doris-robot
commented
Jun 11, 2024
ClickBench: Total hot run time: 30.72 s |
morrySnow
commented
Jun 12, 2024
support all nondeterministic function ? |
seawinde
commented
Jun 12, 2024
run buildall |
doris-robot
commented
Jun 12, 2024
TPC-H: Total hot run time: 39864 ms |
doris-robot
commented
Jun 12, 2024
TPC-DS: Total hot run time: 170309 ms |
doris-robot
commented
Jun 12, 2024
ClickBench: Total hot run time: 30.39 s |
| * Identify the function is deterministic or not, such as UnixTimestamp, when it's children is not empty | ||
| * it's deterministic | ||
| */ | ||
| boolean isDeterministic(); |
There was a problem hiding this comment.
add this interface to expression with default implement check all check isDeterministic. Nondeterministic default return false. unixTimestamp do not implement Nondeterministic anymore. all check isntance of Nondeterministic change to check expression.isDeterministic().
| * the expression in whiteFunctionSet would not be collected | ||
| */ | ||
| public static class FunctionCollectContext { | ||
| private final List<Expression> collectedExpressions = new LinkedList<>(); |
There was a problem hiding this comment.
do not use java's linkedList in any case. it has poor perf with no adv with ArrayList
| return collectedExpressions; | ||
| } | ||
| expressions.forEach(expression -> { | ||
| collectedExpressions.addAll(expression.collect(Nondeterministic.class::isInstance)); |
There was a problem hiding this comment.
i think u could collected isDeterministic == true after move this interface into expression
seawinde
commented
Jun 12, 2024
run buildall |
doris-robot
commented
Jun 12, 2024
TPC-H: Total hot run time: 39478 ms |
doris-robot
commented
Jun 12, 2024
TPC-DS: Total hot run time: 174267 ms |
doris-robot
commented
Jun 12, 2024
ClickBench: Total hot run time: 30.69 s |
| * Identify the expression is deterministic or not | ||
| */ | ||
| default boolean isDeterministic() { | ||
| return true; |
There was a problem hiding this comment.
recursive call children's isDeterministic
seawinde
commented
Jun 17, 2024
run buildall |
doris-robot
commented
Jun 17, 2024
TPC-H: Total hot run time: 40459 ms |
seawinde
commented
Jun 17, 2024
run buildall |
1 similar comment
seawinde
commented
Jun 18, 2024
run buildall |
seawinde
commented
Jun 18, 2024
run feut |
seawinde
commented
Jun 20, 2024
run buildall |
doris-robot
commented
Jun 20, 2024
TPC-H: Total hot run time: 39522 ms |
doris-robot
commented
Jun 20, 2024
TPC-DS: Total hot run time: 173457 ms |
doris-robot
commented
Jun 20, 2024
ClickBench: Total hot run time: 30.8 s |
zddr
left a comment
There was a problem hiding this comment.
It may be strange to set enable_dondeterministic_function to false through the alter statement after creating a materialized view, but it does not affect the business logic
PR approved by anyone and no changes requested. |
PR approved by at least one committer and no changes requested. |
…async mv (#36111) Support to use current_date() when create async materialized view by adding 'enable_nondeterministic_function' = 'true' in properties when create materialized view. `enable_nondeterministic_function` is default false. Here is a example, it will success > CREATE MATERIALIZED VIEW mv_name > BUILD DEFERRED REFRESH AUTO ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ( > 'replication_num' = '1', > 'enable_nondeterministic_function' = 'true' > ) > AS > SELECT *, unix_timestamp(k3, '%Y-%m-%d %H:%i-%s') from ${tableName} where current_date() > k3; Note: unix_timestamp is nondeterministic when has no params. it is deterministic when has params which means format column k3 date another example, it will success > CREATE MATERIALIZED VIEW mv_name > BUILD DEFERRED REFRESH AUTO ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ( > 'replication_num' = '1', > 'enable_nondeterministic_function' = 'true' > ) > AS > SELECT *, unix_timestamp() from ${tableName} where current_date() > k3; though unix_timestamp() is nondeterministic, we add 'enable_date_nondeterministic_function' = 'true' in properties
…async mv (apache#36111) Support to use current_date() when create async materialized view by adding 'enable_nondeterministic_function' = 'true' in properties when create materialized view. `enable_nondeterministic_function` is default false. Here is a example, it will success > CREATE MATERIALIZED VIEW mv_name > BUILD DEFERRED REFRESH AUTO ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ( > 'replication_num' = '1', > 'enable_nondeterministic_function' = 'true' > ) > AS > SELECT *, unix_timestamp(k3, '%Y-%m-%d %H:%i-%s') from ${tableName} where current_date() > k3; Note: unix_timestamp is nondeterministic when has no params. it is deterministic when has params which means format column k3 date another example, it will success > CREATE MATERIALIZED VIEW mv_name > BUILD DEFERRED REFRESH AUTO ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ( > 'replication_num' = '1', > 'enable_nondeterministic_function' = 'true' > ) > AS > SELECT *, unix_timestamp() from ${tableName} where current_date() > k3; though unix_timestamp() is nondeterministic, we add 'enable_date_nondeterministic_function' = 'true' in properties
…a expression is nondeterministic or not (#39801) ## Proposed changes In #36111, we add `isDeterministic` method in class `ExpressionTrait` to identify the expression is deterministic or not. But `unix_timestamp` doesn't extend Nondeterministic, but it is not deterministic when it's children is empty. and is not deterministic when children is not empty. If we use` instanceOf Nondeterministic `to indentify if expression is is not deterministic, that is confused. So we do something as fllowing: 1. Remove Nondeterministic class, and use `isDeterministic` to indentify it's deterministic. 2. Add `containsNondeterministic` method in `ExpressionTrait` to identify it contains nondeterministic expression or not. 3. `isDeterministic` only identify current expression is deterministic or not. would identify if contains nondeterministic or not
…a expression is nondeterministic or not (apache#39801) ## Proposed changes In apache#36111, we add `isDeterministic` method in class `ExpressionTrait` to identify the expression is deterministic or not. But `unix_timestamp` doesn't extend Nondeterministic, but it is not deterministic when it's children is empty. and is not deterministic when children is not empty. If we use` instanceOf Nondeterministic `to indentify if expression is is not deterministic, that is confused. So we do something as fllowing: 1. Remove Nondeterministic class, and use `isDeterministic` to indentify it's deterministic. 2. Add `containsNondeterministic` method in `ExpressionTrait` to identify it contains nondeterministic expression or not. 3. `isDeterministic` only identify current expression is deterministic or not. would identify if contains nondeterministic or not
…a expression is nondeterministic or not (apache#39801) ## Proposed changes In apache#36111, we add `isDeterministic` method in class `ExpressionTrait` to identify the expression is deterministic or not. But `unix_timestamp` doesn't extend Nondeterministic, but it is not deterministic when it's children is empty. and is not deterministic when children is not empty. If we use` instanceOf Nondeterministic `to indentify if expression is is not deterministic, that is confused. So we do something as fllowing: 1. Remove Nondeterministic class, and use `isDeterministic` to indentify it's deterministic. 2. Add `containsNondeterministic` method in `ExpressionTrait` to identify it contains nondeterministic expression or not. 3. `isDeterministic` only identify current expression is deterministic or not. would identify if contains nondeterministic or not
…a expression is nondeterministic or not (#39801) ## Proposed changes In #36111, we add `isDeterministic` method in class `ExpressionTrait` to identify the expression is deterministic or not. But `unix_timestamp` doesn't extend Nondeterministic, but it is not deterministic when it's children is empty. and is not deterministic when children is not empty. If we use` instanceOf Nondeterministic `to indentify if expression is is not deterministic, that is confused. So we do something as fllowing: 1. Remove Nondeterministic class, and use `isDeterministic` to indentify it's deterministic. 2. Add `containsNondeterministic` method in `ExpressionTrait` to identify it contains nondeterministic expression or not. 3. `isDeterministic` only identify current expression is deterministic or not. would identify if contains nondeterministic or not
…async mv (apache#36111) Support to use current_date() when create async materialized view by adding 'enable_nondeterministic_function' = 'true' in properties when create materialized view. `enable_nondeterministic_function` is default false. Here is a example, it will success > CREATE MATERIALIZED VIEW mv_name > BUILD DEFERRED REFRESH AUTO ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ( > 'replication_num' = '1', > 'enable_nondeterministic_function' = 'true' > ) > AS > SELECT *, unix_timestamp(k3, '%Y-%m-%d %H:%i-%s') from ${tableName} where current_date() > k3; Note: unix_timestamp is nondeterministic when has no params. it is deterministic when has params which means format column k3 date another example, it will success > CREATE MATERIALIZED VIEW mv_name > BUILD DEFERRED REFRESH AUTO ON MANUAL > DISTRIBUTED BY RANDOM BUCKETS 2 > PROPERTIES ( > 'replication_num' = '1', > 'enable_nondeterministic_function' = 'true' > ) > AS > SELECT *, unix_timestamp() from ${tableName} where current_date() > k3; though unix_timestamp() is nondeterministic, we add 'enable_date_nondeterministic_function' = 'true' in properties
…a expression is nondeterministic or not (apache#39801) ## Proposed changes In apache#36111, we add `isDeterministic` method in class `ExpressionTrait` to identify the expression is deterministic or not. But `unix_timestamp` doesn't extend Nondeterministic, but it is not deterministic when it's children is empty. and is not deterministic when children is not empty. If we use` instanceOf Nondeterministic `to indentify if expression is is not deterministic, that is confused. So we do something as fllowing: 1. Remove Nondeterministic class, and use `isDeterministic` to indentify it's deterministic. 2. Add `containsNondeterministic` method in `ExpressionTrait` to identify it contains nondeterministic expression or not. 3. `isDeterministic` only identify current expression is deterministic or not. would identify if contains nondeterministic or not
Proposed changes
Support to use current_date() when create async materialized view by adding
'enable_nondeterministic_function' = 'true'in properties when create materialized view.enable_nondeterministic_functionis default false.Here is a example, it will success
Note:
unix_timestampis nondeterministic when has no params. it is deterministic when has params which means format column k3 dateanother example, it will success
though
unix_timestamp()is nondeterministic, we add'enable_date_nondeterministic_function' = 'true'in properties