Skip to content
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

[Fix](Variant) create table should not automatically add variant to keys #36609

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public void validate(ConnectContext ctx) {
break;
}
if (type.isFloatLikeType() || type.isStringType() || type.isJsonType()
|| catalogType.isComplexType()) {
|| catalogType.isComplexType() || catalogType.isVariantType()) {
break;
}
keys.add(column.getName());
Expand Down
6 changes: 5 additions & 1 deletion regression-test/data/variant_p0/load.out
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
[123]

-- !sql_25 --
50000 54999.99999999684 6150000
50000 54999.99999999862 6150000

-- !sql_26 --
5000
Expand Down Expand Up @@ -350,3 +350,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":989144179,"num30":758415664,"num34":344178710,"num38":603490103,"num42":928353352,"num46":164440235,"num50":272803033,"num54":494457109,"num58":36023952,"num6":345965722,"num62":244316054,"num66":791098758,"num70":59531230,"num74":887460141,"num78":175760447,"num82":93180735,"num86":893826383,"num90":899738404,"num94":132357718,"num98":618243870,"text11":"1露华浓 蜜丝佛陀 欧莱雅 哪 款 粉饼 好啊我 感觉 ","text15":"0写 个 天秤 女 攻略 吧 转帖楼主 救 我 加急 如","text19":"1我 复试 被 人大 刷 了 我 气 得 浑身 颤抖 请 ","text23":"0哇靠 我 是 昨儿 吐槽 太仓 假货 的 妹子百丽 专","text27":"1搓 泥 现象 是什么 原因换 成 乳液可是 早上 还","text3":"1想说 刘伊心 是 来 搞笑 的 吗能 唱 成 她 这样","text31":"0女朋友 发 来 短信 说 离开 我 是 她 最 正确 的","text35":"1做 完 九 次 led 红 蓝光 了 还有 最后 一次 ","text39":"0八一八 你 觉得 哪 位 明星 长 得 很 苦逼 很 苦","text43":"0昨天 楼主 拒绝 了 一个 女生 我 傻逼 吗手机 看","text47":"0818 你 觉得 超 好看 的 动漫 有 哪些 嘛初中","text51":"0借 你 我 的 时间我 能 说 请 豆油 我 吗不行","text55":"1我 在 缅甸 雪 悟 敏 禅修 营 三 个 月谢谢 于","text59":"0八一八 非常了得 吧孟非 明显 是 一 付 很 嫌弃 ","text63":"0我 小 姨 大 病 之后 神仙 附体 之后 几乎 是 一","text67":"0爸爸 去哪儿 明星 家 也是 有 贫富悬殊 的 哇突然","text7":"0曾经 的 成都 洗面桥 小学如果 大家 还 记得 宋 ","text71":"1关于女人 姿色女 活 白富美 音 智 胸 腰腿声音 ","text75":"1直播 贴 2013 02 19 04 00 足总 杯 第","text79":"1昨天 答应 和 ex 见面 了 终于 又 让 他 知道 ","text83":"1谁 能 提供 指 人 儿 的 gtp 谱子 呢 我们 乐","text87":"0近 距离 安 坏 关系我 和 我 儿子 是 近 距离 ","text91":"1刚 看 了 小 时代 1 感动 了我 也是 我 都 3","text95":"0剧终 谢谢 大家 撸 主 和 她 在一起 了我 呸呸 ","text99":"1喜欢 广州 想来 广州 但是嗯嗯 还 不能 在 网上 ","time1":"2012-07-06 17:42:41","time13":"1985-07-23 13:16:34","time17":"1970-07-14 00:30:54","time21":"1981-07-04 03:01:10","time25":"1994-12-20 03:41:44","time29":"1975-06-25 07:25:00","time33":"1979-07-27 03:59:56","time37":"1979-12-25 00:37:57","time41":"1979-11-12 13:09:03","time45":"1998-03-02 15:41:07","time49":"1981-05-22 06:40:29","time5":"1995-02-26 15:11:35","time53":"1985-06-23 23:11:00","time57":"2001-02-05 14:44:11","time61":"1988-01-27 12:28:13","time65":"2024-04-27 04:52:59","time69":"2022-04-18 05:19:02","time73":"2016-03-14 15:55:31","time77":"1977-12-21 23:41:05","time81":"2016-12-02 17:10:12","time85":"1995-09-15 21:40:33","time89":"2014-05-10 14:32:32","time9":"1988-12-08 05:26:13","time93":"2018-08-23 02:01:29","time97":"1990-03-09 07:39:01"}

-- !sql --
1 {"a":10}
2 {"b":11}

13 changes: 13 additions & 0 deletions regression-test/suites/variant_p0/load.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,19 @@ suite("regression_test_variant", "nonConcurrent"){
"""
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"

} finally {
// reset flags
Expand Down
Loading