DataWorks笔记

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);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值