presto修改select pick_date,pick_region_nm,pick_park_nm, concat( concat('拣货件量#',coalesce(cast(total_num as varchar),''),'#',1,'#',0.0001), concat(',同片区拣货量占比#',coalesce(cast(same_region_num as varchar),''),'#',coalesce(cast(total_num as varchar),''),'#',100), concat(',跨片区拣货量占比#',coalesce(cast(diff_region_num as varchar),''),'#',coalesce(cast(total_num as varchar),''),'#',100), concat(',任务效率#',coalesce(cast(total_num as varchar),''),'#',coalesce(cast(total_time as varchar),''),'#',1))
时间: 2023-08-15 08:04:23 浏览: 212
Gateway_Presto_Windows.zip
根据报错信息,你需要修改 concat 函数的参数列表,以保证参数类型与函数预期的参数类型匹配。具体来说,你需要将 varchar 类型的参数转换为 char 类型的参数。
下面是修改后的代码:
```
SELECT
pick_date,
pick_region_nm,
pick_park_nm,
concat(
concat('拣货件量#',coalesce(cast(total_num as varchar),''),'#',1,'#',0.0001),
concat(',同片区拣货量占比#',coalesce(cast(same_region_num as varchar),''),'#',coalesce(cast(total_num as varchar),''),'#',100),
concat(',跨片区拣货量占比#',coalesce(cast(diff_region_num as varchar),''),'#',coalesce(cast(total_num as varchar),''),'#',100),
concat(',任务效率#',coalesce(cast(total_num as varchar),''),'#',coalesce(cast(total_time as varchar),''),'#',1)
)
FROM your_table_name;
```
在这个查询语句中,我们使用了 coalesce 函数来处理空值,同时使用了 cast 函数将 varchar 类型的参数转换为 char 类型的参数,以保证参数类型与函数预期的参数类型匹配。
阅读全文