1)Function Studio
import 新包,需要在在pom.xml(在左侧资源树最下方)中添加相关包的配置
以com.google.code.gson为例:(如果你没有这么做,直接提交,这段内容会出现在报错信息里,直接复制过来)2
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
2)同步任务上游重跑
同步任务上游重跑后,需要重跑下游。
3)
hive常用函数
转字符串:CAST(name AS STRING) AS name
字符串连接concat(“111”,"222",“333”)
4)遇到数据地图中存在的表,但是开发平台上没有表
表→右键→导入表→搜索表名,导入
有效性判断
ivi_lng REGEXP '^[0-9.-]+$' = TRUE
取json中某字段做操作
select array_reduce(
from_json('[{"addOnDealId":0,"amount":"3"}, {"addOnDealId":0,"amount":"3"}, {"addOnDealId":0,"amount":"2"}]', 'array<Struct<amount:string>>'), 0,
(buf, e)->buf + CAST(e.amount as int), buf->buf);
字符串转数组
select from_json('[1,2,3,4]', 'array<bigint>')
对数组算平均
select array_reduce(from_json('[1,2,3,4]', 'array<bigint>'), named_struct('sum', 0, 'count', 0), (buf, e)->named_struct('sum', buf.sum + e, 'count', buf.count + 1), buf -> buf.sum / buf.count);