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

[Feature] Variant 类型的字段支持部分列更新 #48122

Open
2 of 3 tasks
zhangguangqiang opened this issue Feb 20, 2025 · 1 comment
Open
2 of 3 tasks

[Feature] Variant 类型的字段支持部分列更新 #48122

zhangguangqiang opened this issue Feb 20, 2025 · 1 comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@zhangguangqiang
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

Description

在我们的业务场景中,有一类表属于主键表类型,建表结构如下所示:

| raw_users | CREATE TABLE raw_users (
ssid bigint NOT NULL COMMENT '用户唯一主键',
first_device_id varchar(128) NULL COMMENT '首次登录设备 ID',
user_id varchar(128) NULL COMMENT '登录 ID',
device_id_list array<varchar(128)> NULL COMMENT '登录设备列表',
create_time datetime(3) NOT NULL COMMENT '创建时间',
update_time datetime(3) NOT NULL COMMENT '更新时间',
properties variant NULL COMMENT '用户属性',
aid bigint NOT NULL AUTO_INCREMENT(1) COMMENT '自增 ID'
) ENGINE=OLAP
UNIQUE KEY(ssid)
DISTRIBUTED BY HASH(ssid) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"min_load_replica_num" = "-1",
"is_being_synced" = "false",
"storage_medium" = "hdd",
"storage_format" = "V2",
"inverted_index_storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"group_commit_interval_ms" = "10000",
"group_commit_data_bytes" = "134217728",
"enable_mow_light_delete" = "false"
); |

其中,我们使用 properties 字段(Variant)存储大部分的用户属性信息,示例数据如下:

Image

我们希望 properties 字段中的所有子列,也能够像普通列一样支持部分列更新的能力,比如:

Image

Use case

如上述描述的建表语句所示,raw_users 表存储的是我们的所有用户描述信息,这些信息一般在客户端 SDK 当中进行直接上报,所有的列字段(如性别、年龄等)都是动态定义的,因此非常适合使用 Variant 字段类型定义,避免我们自己动态管理 schema 的问题。这些用户属性信息除了一次性上报,还有频繁的更新需要,比如,我希望只更新用户所有属性中的年龄字段。因此,我们希望 Variant 类型在主键表中也能像普通列类型一样支持部分列更新的能力。

Related issues

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@zhangguangqiang zhangguangqiang added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 20, 2025
@caosimin
Copy link

用了 Variant 后,需要支持部分列更新;
我们好几个业务中也有类似这样的场景,最后要么采用先读取再全量更新,要么就是自己管理 schema 单独建列,要么性能不好,要么逻辑太复杂;
核心是如果 Doris 直接托管了 这部分列的 schema 管理,可以极大的提升 Variant 使用场景和易用性。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants