-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Feat](nereids) support generated column #35284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
TPC-H: Total hot run time: 42137 ms |
TPC-DS: Total hot run time: 169485 ms |
ClickBench: Total hot run time: 31.16 s |
|
run p0 |
|
Add a description explaining the functionality scope of generated columns, and include simple usage examples. Additionally, update the Doris documentation in https://github.com/apache/doris-website to include a description of this functionality. |
|
run buildall |
1 similar comment
|
run buildall |
TPC-H: Total hot run time: 41819 ms |
TPC-DS: Total hot run time: 168894 ms |
ClickBench: Total hot run time: 30.43 s |
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java
Show resolved
Hide resolved
...-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/ColumnDefinition.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java
Outdated
Show resolved
Hide resolved
f6ee3ad to
19c5b58
Compare
|
run buildall |
TPC-H: Total hot run time: 41123 ms |
TPC-DS: Total hot run time: 170158 ms |
ClickBench: Total hot run time: 31.56 s |
|
run buildall |
1 similar comment
|
run buildall |
77d7686 to
b1a52bc
Compare
|
run buildall |
TPC-H: Total hot run time: 39818 ms |
|
run buildall |
TPC-H: Total hot run time: 41289 ms |
|
run buildall |
|
run external |
|
run buildall |
TPC-H: Total hot run time: 40610 ms |
8cc317a to
f636264
Compare
|
run buildall |
TPC-H: Total hot run time: 40659 ms |
TPC-DS: Total hot run time: 174053 ms |
ClickBench: Total hot run time: 31.15 s |
morningman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pr has added support for generated columns. Values of a generated
column are computed from an expression included in the column
definition. Here is an example:
mysql> CREATE TABLE products (
product_id INT,
price DECIMAL(10,2),
quantity INT,
total_value DECIMAL(10,2) GENERATED ALWAYS AS (price * quantity)
) DISTRIBUTED BY HASH(product_id) PROPERTIES ("replication_num" = "1");
mysql> insert into products values(1, 10.00, 10, default);
mysql> insert into products(product_id, price, quantity) values(1, 20.00, 10);
mysql> select * from products;
+------------+-------+----------+-------------+
| product_id | price | quantity | total_value |
+------------+-------+----------+-------------+
| 1 | 10.00 | 10 | 100.00 |
| 1 | 20.00 | 10 | 200.00 |
+------------+-------+----------+-------------+
related docs in apache/doris-website#715
---------
Co-authored-by: feiniaofeiafei <moailing@selectdb.com>
…ssionToExpr (#36824) introduced by #35284 Fix generated column, static variables should not be used in ExpressionToExpr. There is only one static variable slotRefMap in the ExpressionToExpr class globally. It may be used by multiple threads at the same time and assigned repeatedly, which is problematic. The same reason applies to the modification of class slotRefRewriteRule. No regression case added because this problem does not occur every time. --------- Co-authored-by: feiniaofeiafei <moailing@selectdb.com>
…ssionToExpr (#36824) introduced by #35284 Fix generated column, static variables should not be used in ExpressionToExpr. There is only one static variable slotRefMap in the ExpressionToExpr class globally. It may be used by multiple threads at the same time and assigned repeatedly, which is problematic. The same reason applies to the modification of class slotRefRewriteRule. No regression case added because this problem does not occur every time. --------- Co-authored-by: feiniaofeiafei <moailing@selectdb.com>
related code in apache/doris#35284 --------- Co-authored-by: feiniaofeiafei <moailing@selectdb.com>
### What problem does this PR solve? Related PR: #35284 Problem Summary: Generate column need add cast(casting slot to its own type) in stream load, because when loading data(stream load and other load), the slots reading from files are string type. So we need to cast it to its own type to avoid error.
### What problem does this PR solve? Related PR: #35284 Problem Summary: Generate column need add cast(casting slot to its own type) in stream load, because when loading data(stream load and other load), the slots reading from files are string type. So we need to cast it to its own type to avoid error.
…he#49167) ### What problem does this PR solve? Related PR: apache#35284 Problem Summary: Generate column need add cast(casting slot to its own type) in stream load, because when loading data(stream load and other load), the slots reading from files are string type. So we need to cast it to its own type to avoid error.
…he#49167) ### What problem does this PR solve? Related PR: apache#35284 Problem Summary: Generate column need add cast(casting slot to its own type) in stream load, because when loading data(stream load and other load), the slots reading from files are string type. So we need to cast it to its own type to avoid error.
This pr has added support for generated columns. Values of a generated column are computed from an expression included in the column definition. Here is an example:
related docs in apache/doris-website#715