一、打開OSS,上傳json檔案

{"id":5644228109524316032,"sourceType":1}
{"id":-736866360508848202,"sourceType":3}
二、登入DataWorks,建立外部表

建表語句:
CREATE EXTERNAL TABLE `json_table` (
`id` bigint,
`sourcetype` int
)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
STORED AS TEXTFILE
LOCATION 'oss://oss-cn-beijing-internal.aliyuncs.com/gjt-demo/home/jsondata/';
三、建立臨時查詢,檢視資料

需要設定的flag語句以及查詢語句
set odps.sql.type.system.odps2=true;
set odps.sql.hive.compatible=true;
select * from json_table;
查詢結果展示:

歡迎加入“MaxCompute開發者社群2群”,點選連結申請加入或掃描二維碼
https://h5.dingtalk.com/invite-page/index.html?bizSource=____source____&corpId=dingb682fb31ec15e09f35c2f4657eb6378f&inviterUid=E3F28CD2308408A8&encodeDeptId=0054DC2B53AFE745