Doris 通过stream_load部分更新,未传的字段报null校验错误

Viewed 20

doris:3.0.4版本
例如表如下:

CREATE TABLE report.report_event
(
    `team_id` BIGINT NOT NULL,
    `code` VARCHAR(64) NOT NULL,
    `partition_date` DATE NOT NULL,
    `event_id` VARCHAR(64) NOT NULL,
    `event_type` VARCHAR(128) NOT NULL,
    `event_source` VARCHAR(128),
    `event_mark` VARCHAR(32),
    `event_result` VARCHAR(128),
	`agent_id` BIGINT NOT NULL,
    `is_deleted` TINYINT DEFAULT "0",
    `is_bind` TINYINT DEFAULT "0",
    `bind_time` BIGINT,
    `event_time` BIGINT NOT NULL,
    `lead_time` BIGINT,
    `create_time` BIGINT NOT NULL
)
UNIQUE KEY(team_id, code, partition_date)
PARTITION BY RANGE(`partition_date`)()
DISTRIBUTED BY HASH(team_id) BUCKETS 512
PROPERTIES (
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "MONTH",
    "dynamic_partition.start" = "-36",
    "dynamic_partition.end" = "12",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.buckets" = "512",
    "dynamic_partition.create_history_partition" = "true",
    "dynamic_partition.history_partition_num" = "36",
    "replication_num" = "1",
    "compression" = "zstd",
    "dynamic_partition.time_zone" = "UTC"
);

stream load导入的json:

[{"code":"103_00000000000000000105","team_id":999,"event_id":"105","event_type":"SMS","event_source":"system3","event_time":1745751682279,"partition_date":"2025-04-01"}]

导入方式:
7b5f7a93a45eccf2a6a739264cf66e2.png
报错:
Reason: column(agent_id) values is null while columns is not nullable. src line [999 103_00000000000000000105 2025-04-01 105 SMS system3 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 0 0 0 NULL 0 0 0 0 0 0 NULL NULL 0 0 NULL 1745750717899 NULL NULL];

1 Answers

agent_id 是not null的,但是你有没有传值,所以会报错呀