Skip to content

Commit

Permalink
[pick](nestedtype)support nested type with agg replace_if_not_null ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
amorynan authored and weixingyu12 committed Aug 14, 2024
1 parent 8adcd99 commit ba2d3dd
Show file tree
Hide file tree
Showing 4 changed files with 377 additions and 7 deletions.
2 changes: 0 additions & 2 deletions be/src/vec/columns/column_nullable.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,6 @@ class ColumnNullable final : public COWHelper<IColumn, ColumnNullable> {

if (!nullable_rhs.is_null_at(row)) {
nested_column->replace_column_data(*nullable_rhs.nested_column, row, self_row);
} else {
nested_column->replace_column_data_default(self_row);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,12 @@ public void analyze(Analyzer analyzer) throws UserException, AnalysisException {
columnDef.analyze(engineName.equals("olap"));

if (columnDef.getType().isComplexType() && engineName.equals("olap")) {
if (columnDef.getAggregateType() != null
&& columnDef.getAggregateType() != AggregateType.NONE
&& columnDef.getAggregateType() != AggregateType.REPLACE) {
throw new AnalysisException(columnDef.getType().getPrimitiveType()
+ " column can't support aggregation " + columnDef.getAggregateType());
if (columnDef.getAggregateType() != null && columnDef.getAggregateType() != AggregateType.NONE
&& columnDef.getAggregateType() != AggregateType.REPLACE
&& columnDef.getAggregateType() != AggregateType.REPLACE_IF_NOT_NULL) {
throw new AnalysisException(
columnDef.getType().getPrimitiveType() + " column can't support aggregation "
+ columnDef.getAggregateType());
}
if (columnDef.isKey()) {
throw new AnalysisException(columnDef.getType().getPrimitiveType()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql_all --
1 [1, 0] [1, 2] [100, 200] [1000, 2000] [10000, 20000] [100000, 200000] [1.1, 2.2] [1.11, 2.22] [10.01, 20.02] [30.03, 40.04] ["2024-01-01", "2024-01-02"] ["2024-01-01 12:00:00", "2024-01-02 12:00:00"] ["2024-01-03", "2024-01-04"] ["2024-01-03 12:00:00", "2024-01-04 12:00:00"] ["char1", "char2"] ["a", "b"] ["string1", "string2"]
5 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
7 [1, 1, 0] [12, 13, 14] [1200, 1300, 1400] [12000, 13000, 14000] [120000, 130000, 140000] [1200000, 1300000, 1400000] [12.12, 13.13, 14.14] [12.12, 13.13, 14.14] [120.12, 130.13, 140.14] [140.14, 150.15, 160.16] ["2024-07-01", "2024-07-02", "2024-07-03"] ["2024-07-01 12:00:00", "2024-07-02 12:00:00", "2024-07-03 12:00:00"] ["2024-07-03", "2024-07-04", "2024-07-05"] ["2024-07-03 12:00:00", "2024-07-04 12:00:00", "2024-07-05 12:00:00"] ["char12", "char13", "char14"] ["l", "m", "n"] ["string12", "string13", "string14"]

-- !sql_replace_1 --
1 [1, 1, 0] [12, 13, 14] [1200, 1300, 1400] [12000, 13000, 14000] [120000, 130000, 140000] [1200000, 1300000, 1400000] [12.12, 13.13, 14.14] [12.12, 13.13, 14.14] [120.12, 130.13, 140.14] [140.14, 150.15, 160.16] ["2024-07-01", "2024-07-02", "2024-07-03"] ["2024-07-01 12:00:00", "2024-07-02 12:00:00", "2024-07-03 12:00:00"] ["2024-07-03", "2024-07-04", "2024-07-05"] ["2024-07-03 12:00:00", "2024-07-04 12:00:00", "2024-07-05 12:00:00"] ["char12", "char13", "char14"] ["l", "m", "n"] ["string12", "string13", "string14"]
5 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
7 [1, 1, 0] [12, 13, 14] [1200, 1300, 1400] [12000, 13000, 14000] [120000, 130000, 140000] [1200000, 1300000, 1400000] [12.12, 13.13, 14.14] [12.12, 13.13, 14.14] [120.12, 130.13, 140.14] [140.14, 150.15, 160.16] ["2024-07-01", "2024-07-02", "2024-07-03"] ["2024-07-01 12:00:00", "2024-07-02 12:00:00", "2024-07-03 12:00:00"] ["2024-07-03", "2024-07-04", "2024-07-05"] ["2024-07-03 12:00:00", "2024-07-04 12:00:00", "2024-07-05 12:00:00"] ["char12", "char13", "char14"] ["l", "m", "n"] ["string12", "string13", "string14"]

-- !sql_replace_2 --
1 [1, 1, 0] [12, 13, 14] [1200, 1300, 1400] [12000, 13000, 14000] [120000, 130000, 140000] [1200000, 1300000, 1400000] [12.12, 13.13, 14.14] [12.12, 13.13, 14.14] [120.12, 130.13, 140.14] [140.14, 150.15, 160.16] ["2024-07-01", "2024-07-02", "2024-07-03"] ["2024-07-01 12:00:00", "2024-07-02 12:00:00", "2024-07-03 12:00:00"] ["2024-07-03", "2024-07-04", "2024-07-05"] ["2024-07-03 12:00:00", "2024-07-04 12:00:00", "2024-07-05 12:00:00"] ["char12", "char13", "char14"] ["l", "m", "n"] ["string12", "string13", "string14"]
5 [1] [9] [900] [9000] [90000] [900000] [9.9] [9.99] [90.09] [110.11] ["2024-05-01"] ["2024-05-01 12:00:00"] ["2024-05-02"] ["2024-05-02 12:00:00"] ["char9"] ["i"] ["string9"]
7 [1, 1, 0] [12, 13, 14] [1200, 1300, 1400] [12000, 13000, 14000] [120000, 130000, 140000] [1200000, 1300000, 1400000] [12.12, 13.13, 14.14] [12.12, 13.13, 14.14] [120.12, 130.13, 140.14] [140.14, 150.15, 160.16] ["2024-07-01", "2024-07-02", "2024-07-03"] ["2024-07-01 12:00:00", "2024-07-02 12:00:00", "2024-07-03 12:00:00"] ["2024-07-03", "2024-07-04", "2024-07-05"] ["2024-07-03 12:00:00", "2024-07-04 12:00:00", "2024-07-05 12:00:00"] ["char12", "char13", "char14"] ["l", "m", "n"] ["string12", "string13", "string14"]

-- !sql_map_all --
1 {1:0, 0:1} {1:2, 2:3} {100:200, 200:300} {1000:2000, 2000:3000} {10000:20000, 20000:30000} {100000:200000, 200000:300000} {1.1:2.2, 2.2:3.3} {1.11:2.22, 2.22:3.33} {10.01:20.02, 20.02:30.03} {30.03:40.04, 40.04:50.05} {"2024-01-01":"2024-01-02", "2024-01-02":"2024-01-03"} {"2024-01-01 12:00:00":"2024-01-02 12:00:00", "2024-01-02 12:00:00":"2024-01-03 12:00:00"} {"2024-01-03":"2024-01-04", "2024-01-04":"2024-01-05"} {"2024-01-03 12:00:00":"2024-01-04 12:00:00", "2024-01-04 12:00:00":"2024-01-05 12:00:00"} {"char1":"char2", "char2":"char3"} {"a":"b", "b":"c"} {"string1":"string2", "string2":"string3"}
5 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
7 {0:1} {7:70} {700:7000} {7000:70000} {70000:700000} {700000:7000000} {7.7:7.77} {7.77:7.777} {70.07:700.70} {90.09:900.90} {"2024-04-01":"2024-04-02"} {"2024-04-01 12:00:00":"2024-04-02 12:00:00"} {"2024-04-03":"2024-04-04"} {"2024-04-03 12:00:00":"2024-04-04 12:00:00"} {"char7":"charG"} {"g":"G"} {"string7":"STRING7"}

-- !sql_replace_map_1 --
1 {0:1} {7:70} {700:7000} {7000:70000} {70000:700000} {700000:7000000} {7.7:7.77} {7.77:7.777} {70.07:700.70} {90.09:900.90} {"2024-04-01":"2024-04-02"} {"2024-04-01 12:00:00":"2024-04-02 12:00:00"} {"2024-04-03":"2024-04-04"} {"2024-04-03 12:00:00":"2024-04-04 12:00:00"} {"char7":"charG"} {"g":"G"} {"string7":"STRING7"}
5 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
7 {0:1} {7:70} {700:7000} {7000:70000} {70000:700000} {700000:7000000} {7.7:7.77} {7.77:7.777} {70.07:700.70} {90.09:900.90} {"2024-04-01":"2024-04-02"} {"2024-04-01 12:00:00":"2024-04-02 12:00:00"} {"2024-04-03":"2024-04-04"} {"2024-04-03 12:00:00":"2024-04-04 12:00:00"} {"char7":"charG"} {"g":"G"} {"string7":"STRING7"}

-- !sql_replace_map_2 --
1 {0:1} {7:70} {700:7000} {7000:70000} {70000:700000} {700000:7000000} {7.7:7.77} {7.77:7.777} {70.07:700.70} {90.09:900.90} {"2024-04-01":"2024-04-02"} {"2024-04-01 12:00:00":"2024-04-02 12:00:00"} {"2024-04-03":"2024-04-04"} {"2024-04-03 12:00:00":"2024-04-04 12:00:00"} {"char7":"charG"} {"g":"G"} {"string7":"STRING7"}
5 {1:0} {9:90} {900:9000} {9000:90000} {90000:900000} {900000:9000000} {9.9:9.99} {9.99:9.999} {90.09:900.90} {110.11:1100.11} {"2024-05-01":"2024-05-02"} {"2024-05-01 12:00:00":"2024-05-02 12:00:00"} {"2024-05-02":"2024-05-03"} {"2024-05-02 12:00:00":"2024-05-03 12:00:00"} {"char9":"charG"} {"g":"G"} {"string9":"STRING9"}
7 {0:1} {7:70} {700:7000} {7000:70000} {70000:700000} {700000:7000000} {7.7:7.77} {7.77:7.777} {70.07:700.70} {90.09:900.90} {"2024-04-01":"2024-04-02"} {"2024-04-01 12:00:00":"2024-04-02 12:00:00"} {"2024-04-03":"2024-04-04"} {"2024-04-03 12:00:00":"2024-04-04 12:00:00"} {"char7":"charG"} {"g":"G"} {"string7":"STRING7"}

-- !sql_struct_all --
1 {"f1": 1} {"f1": 1} {"f1": 100} {"f1": 1000} {"f1": 10000} {"f1": 100000} {"f1": 1.1} {"f1": 1.11} {"f1": 10.01} {"f1": 20.02} {"f1": "2024-01-01"} {"f1": "2024-01-01 12:00:00"} {"f1": "2024-01-02"} {"f1": "2024-01-02 12:00:00"} {"f1": "char1"} {"f1": "a"} {"f1": "string1"}
5 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
7 {"f1": 1} {"f1": 7} {"f1": 700} {"f1": 7000} {"f1": 70000} {"f1": 700000} {"f1": 7.7} {"f1": 7.77} {"f1": 130.13} {"f1": 140.14} {"f1": "2024-07-01"} {"f1": "2024-07-01 12:00:00"} {"f1": "2024-07-02"} {"f1": "2024-07-02 12:00:00"} {"f1": "char7"} {"f1": "g"} {"f1": "string7"}

-- !sql_replace_struct_1 --
1 {"f1": 1} {"f1": 7} {"f1": 700} {"f1": 7000} {"f1": 70000} {"f1": 700000} {"f1": 7.7} {"f1": 7.77} {"f1": 130.13} {"f1": 140.14} {"f1": "2024-07-01"} {"f1": "2024-07-01 12:00:00"} {"f1": "2024-07-02"} {"f1": "2024-07-02 12:00:00"} {"f1": "char7"} {"f1": "g"} {"f1": "string7"}
5 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
7 {"f1": 1} {"f1": 7} {"f1": 700} {"f1": 7000} {"f1": 70000} {"f1": 700000} {"f1": 7.7} {"f1": 7.77} {"f1": 130.13} {"f1": 140.14} {"f1": "2024-07-01"} {"f1": "2024-07-01 12:00:00"} {"f1": "2024-07-02"} {"f1": "2024-07-02 12:00:00"} {"f1": "char7"} {"f1": "g"} {"f1": "string7"}

-- !sql_replace_struct_2 --
1 {"f1": 1} {"f1": 7} {"f1": 700} {"f1": 7000} {"f1": 70000} {"f1": 700000} {"f1": 7.7} {"f1": 7.77} {"f1": 130.13} {"f1": 140.14} {"f1": "2024-07-01"} {"f1": "2024-07-01 12:00:00"} {"f1": "2024-07-02"} {"f1": "2024-07-02 12:00:00"} {"f1": "char7"} {"f1": "g"} {"f1": "string7"}
5 {"f1": 1} {"f1": 5} {"f1": 500} {"f1": 5000} {"f1": 50000} {"f1": 500000} {"f1": 5.5} {"f1": 5.55} {"f1": 90.09} {"f1": 100.10} {"f1": "2024-05-01"} {"f1": "2024-05-01 12:00:00"} {"f1": "2024-05-02"} {"f1": "2024-05-02 12:00:00"} {"f1": "char5"} {"f1": "e"} {"f1": "string5"}
7 {"f1": 1} {"f1": 7} {"f1": 700} {"f1": 7000} {"f1": 70000} {"f1": 700000} {"f1": 7.7} {"f1": 7.77} {"f1": 130.13} {"f1": 140.14} {"f1": "2024-07-01"} {"f1": "2024-07-01 12:00:00"} {"f1": "2024-07-02"} {"f1": "2024-07-02 12:00:00"} {"f1": "char7"} {"f1": "g"} {"f1": "string7"}

Loading

0 comments on commit ba2d3dd

Please sign in to comment.