doris 导入本地数据报错
报错内容:
本地文件:
111 2017-04-05 2017-04-01 12:00:00 上海 20 1 2017-04-01 11:00:00 100 20 15
112 2017-04-09 2017-04-01 11:00:00 上海 20 1 2017-04-01 10:00:00 80 15 10
112 2019-04-01 2017-04-01 11:00:00 上海 20 1 2017-04-01 10:00:00 80 15 10
分析原因:
报错字面意思:这组数据没有对应的分区
查看表的分区设置:
mysql> show create table example_range_tbl;
| example_range_tbl | CREATE TABLE `example_range_tbl` (
`user_id` largeint(40) NOT NULL COMMENT '用户id',
`date` date NOT NULL COMMENT '数据灌入日期时间',
`timestamp` datetime NOT NULL COMMENT '数据灌入的时间戳',
`city` varchar(20) NULL COMMENT '用户所在城市',
`age` smallint(6) NULL COMMENT '用户年龄',
`sex` tinyint(4) NULL COMMENT '用户性别',
`last_visit_date` datetime REPLACE NULL DEFAULT "1970-01-01 00:00:00" COMMENT '用户最后一次访问时间',
`cost` bigint(20) SUM NULL DEFAULT "0" COMMENT '用户总消费',
`max_dwell_time` int(11) MAX NULL DEFAULT "0" COMMENT '用户最大停留时间',
`min_dwell_time` int(11) MIN NULL DEFAULT "99999" COMMENT '用户最小停留时间'
) ENGINE=OLAP
AGGREGATE KEY(`user_id`, `date`, `timestamp`, `city`, `age`, `sex`)
COMMENT 'OLAP'
PARTITION BY RANGE(`date`)
(PARTITION p201701 VALUES [('0000-01-01'), ('2017-02-01')),
PARTITION p201702 VALUES [('2017-02-01'), ('2017-03-01')),
PARTITION p2 VALUES [('2017-04-01'), ('2018-01-02')))
DISTRIBUTED BY HASH(`user_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"is_being_synced" = "false",
"storage_format" = "V2",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
); |
可以看到这是一张分区表,以 date 列做 range 分区,range 分区划分了3个范围,但是不包含报错内容中的“ 2019-04-01”,所以数据无法导入
又因为 doris 的批次导入是原子性操作,所以一条数据无法导入,那么这次的导入任务整体就会失败,同一批次的其他数据也就无法导入