michaelzqw opened a new issue #3254: 窗口函数lead()查询报错
URL: https://github.com/apache/incubator-doris/issues/3254
 
 
   建表语句:
   CREATE TABLE `aggregation_meter` (
     `tenant_id` int(11) NOT NULL,
     `meter_id` varchar(40) NOT NULL,
     `begin_time` datetime NOT NULL,
     `time_granularity` varchar(1) NOT NULL,
     `am_id` varchar(50) NOT NULL,
     `meter_no` varchar(30) NOT NULL,
     `cust_id` varchar(40) NULL,
     `user_no` varchar(30) NULL,
     `end_time` datetime NOT NULL,
     `begin_working_num` decimal(14, 4) NULL,
     `begin_standard_num` decimal(14, 4) NULL,
     `end_working_num` decimal(14, 4) NULL,
     `end_standard_num` decimal(14, 4) NULL,
     `working_qty` decimal(14, 4) NULL,
     `standard_qty` decimal(14, 4) NULL,
     `am_state` int(11) NOT NULL,
     `update_time` datetime NULL,
     `count` tinyint(4) NOT NULL DEFAULT "1",
     `org_id` varchar(30) NOT NULL
   ) ENGINE=OLAP
   UNIQUE KEY(`tenant_id`, `meter_id`, `begin_time`, `time_granularity`)
   PARTITION BY RANGE(`begin_time`)
   (PARTITION p201701 VALUES LESS THAN ('2017-02-01 00:00:00'),
   PARTITION p201702 VALUES LESS THAN ('2017-03-01 00:00:00'),
   PARTITION p201703 VALUES LESS THAN ('2017-04-01 00:00:00'),
   PARTITION p201704 VALUES LESS THAN ('2017-05-01 00:00:00'),
   PARTITION p201705 VALUES LESS THAN ('2017-06-01 00:00:00'),
   PARTITION p201706 VALUES LESS THAN ('2017-07-01 00:00:00'),
   PARTITION p201707 VALUES LESS THAN ('2017-08-01 00:00:00'),
   PARTITION p201708 VALUES LESS THAN ('2017-09-01 00:00:00'),
   PARTITION p201709 VALUES LESS THAN ('2017-10-01 00:00:00'),
   PARTITION p201710 VALUES LESS THAN ('2017-11-01 00:00:00'),
   PARTITION p201711 VALUES LESS THAN ('2017-12-01 00:00:00'),
   PARTITION p201712 VALUES LESS THAN ('2018-01-01 00:00:00'))
   DISTRIBUTED BY HASH(`tenant_id`, `meter_id`) BUCKETS 10
   PROPERTIES (
   "storage_type" = "COLUMN"
   );
   
   查询语句:
   SELECT
       meter_id,
       begin_time,
       standard_qty,
       lead(standard_qty,1,0) over(partition BY meter_id ORDER BY begin_time 
DESC) lead_standard_qty
   FROM aggregation_meter
   WHERE tenant_id = 9
   AND begin_time >= '2018-01-01 00:00:00'
   AND time_granularity = 4
   ORDER BY meter_id,begin_time DESC;
   
   返回:
   [Code: 1064, SQL State: 42000]  Type = VARCHAR(*) can't not convert to 
VARCHAR(*)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to