This is an automated email from the ASF dual-hosted git repository.
eldenmoon pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 82c7a9d15a7 [Fix](Variant) create table should not automatically add
variant to key (#44736)
82c7a9d15a7 is described below
commit 82c7a9d15a79fd9d23f1fc29361a95d55b2de003
Author: lihangyu <[email protected]>
AuthorDate: Fri Nov 29 09:34:43 2024 +0800
[Fix](Variant) create table should not automatically add variant to key
(#44736)
#36609
---
be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp | 1 -
.../nereids/trees/plans/commands/info/CreateTableInfo.java | 2 +-
regression-test/data/variant_p0/load.out | 4 ++++
regression-test/suites/variant_p0/load.groovy | 13 +++++++++++++
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
b/be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
index fcaad8f555a..0feb769638a 100644
--- a/be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
@@ -709,7 +709,6 @@ Status VerticalSegmentWriter::batch_block(const
vectorized::Block* block, size_t
"illegal block columns, block columns = {}, tablet_schema
columns = {}",
block->dump_structure(), _tablet_schema->dump_structure());
}
- LOG(INFO) << "add a single block " << block->rows();
_batched_blocks.emplace_back(block, row_pos, num_rows);
return Status::OK();
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java
index 15a8b2ba582..28437c49973 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java
@@ -343,7 +343,7 @@ public class CreateTableInfo {
break;
}
if (type.isFloatLikeType() || type.isStringType()
|| type.isJsonType()
- || catalogType.isComplexType()) {
+ || catalogType.isComplexType() ||
catalogType.isVariantType()) {
break;
}
keys.add(column.getName());
diff --git a/regression-test/data/variant_p0/load.out
b/regression-test/data/variant_p0/load.out
index c40c04cd349..988f3fa819f 100644
--- a/regression-test/data/variant_p0/load.out
+++ b/regression-test/data/variant_p0/load.out
@@ -331,3 +331,7 @@ kaana
-- !sql_records5 --
{"id":"85321037218054145","id0":"8301","id12":"32030","id16":"39960","id20":"17202","id24":"24592","id28":"42035","id32":"29819","id36":"4680","id4":"4848","id40":"47892","id44":"29400","id48":"7799","id52":"49678","id56":"40585","id60":"23572","id64":"28579","id68":"11477","id72":"35416","id76":"9577","id8":"25758","id80":"45204","id84":"16132","id88":"1007","id92":"32630","id96":"15443","num10":310671794,"num14":317675907,"num18":173663246,"num2":68835462,"num22":919923967,"num26":9891
[...]
+-- !sql --
+1 {"a":10}
+2 {"b":11}
+
diff --git a/regression-test/suites/variant_p0/load.groovy
b/regression-test/suites/variant_p0/load.groovy
index 0618785a700..955fcb40ac2 100644
--- a/regression-test/suites/variant_p0/load.groovy
+++ b/regression-test/suites/variant_p0/load.groovy
@@ -425,6 +425,19 @@ suite("regression_test_variant", "p0"){
"""
exception("errCode = 2, detailMessage = Variant type should not be
used in key")
}
+ sql """
+ CREATE TABLE `var_as_key` (
+ `k` int NULL,
+ `var` variant NULL
+ ) ENGINE=OLAP
+ DISTRIBUTED BY RANDOM BUCKETS 1
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+ sql """insert into var_as_key values(1, '{"a" : 10}')"""
+ sql """insert into var_as_key values(2, '{"b" : 11}')"""
+ qt_sql "select * from var_as_key order by k"
test {
sql """select * from ghdata where cast(v['actor']['url'] as ipv4)
= '127.0.0.1'"""
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]