前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >doris错误信息Invalid range value format

doris错误信息Invalid range value format

作者头像
程裕强
发布2023-10-18 17:32:16
3740
发布2023-10-18 17:32:16
举报
文章被收录于专栏:大数据学习笔记

错误信息

代码语言:javascript
复制
ERROR 1105 (HY000): errCode = 2, detailMessage = Invalid range value format: errCode = 2, detailMessage = date literal [2017-03-01] is invalid: errCode = 2, detailMessage = Invalid datetime value: 2017-03-01
代码语言:javascript
复制
mysql> create table mall_dw.fact_order_info
    -> (
    ->    order_id             int  ,
    ->    order_number         varchar(35) NOT NULL,
    ->    order_date           DATETIME,
    ->    customer_id          int  ,
    ->    product_id           int  ,
    ->    order_amount         DECIMAL(18,2)
    -> )
    -> UNIQUE KEY(order_id,order_number,order_date,customer_id,product_id)
    -> PARTITION BY RANGE(order_date)
    -> (
    ->     PARTITION `p201702` VALUES LESS THAN ("2017-03-01"),
    ->     PARTITION `p201703` VALUES LESS THAN ("2017-04-01")
    -> )
    -> DISTRIBUTED BY HASH(order_id) BUCKETS 10
    -> PROPERTIES (
    ->     "replication_num" = "1",
    ->     "dynamic_partition.enable" = "true",
    ->     "dynamic_partition.time_unit" = "MONTH",
    ->     "dynamic_partition.time_zone" = "Asia/Shanghai",
    ->     "dynamic_partition.start" = "-2147483648",
    ->     "dynamic_partition.end" = "2",
    ->     "dynamic_partition.prefix" = "P_"
    -> );
ERROR 1105 (HY000): errCode = 2, detailMessage = Invalid range value format: errCode = 2, detailMessage = date literal [2017-03-01] is invalid: errCode = 2, detailMessage = Invalid datetime value: 2017-03-01

原来是order_date的类型 为DATETIME,所以分区范围需要给出日期时间对应的格式

代码语言:javascript
复制
mysql> create table mall_dw.fact_order_info
    -> (
    ->    order_id             int  ,
    ->    order_number         varchar(35) NOT NULL,
    ->    order_date           DATETIME,
    ->    customer_id          int  ,
    ->    product_id           int  ,
    ->    order_amount         DECIMAL(18,2)
    -> )
    -> UNIQUE KEY(order_id,order_number,order_date,customer_id,product_id)
    -> PARTITION BY RANGE(order_date)
    -> (
    ->     PARTITION P_202111 VALUES [('2021-11-01 00:00:00'), ('2021-12-01 00:00:00'))
    -> )
    -> DISTRIBUTED BY HASH(order_id) BUCKETS 10
    -> PROPERTIES (
    ->     "replication_num" = "1",
    ->     "dynamic_partition.enable" = "true",
    ->     "dynamic_partition.time_unit" = "MONTH",
    ->     "dynamic_partition.time_zone" = "Asia/Shanghai",
    ->     "dynamic_partition.end" = "2",
    ->     "dynamic_partition.prefix" = "P_"
    -> );
Query OK, 0 rows affected (0.02 sec)
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-10-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档