1、Hologres 0.8 创建数组类型外部表采坑
ODPS:CREATE TABLE `test_clue` ( `id_c` array
Holo:
CREATE FOREIGN TABLE test_clue(
id int8[],
name text[])
SERVER odps_server
OPTIONS(project_name 'itsl_dev', table_name 'test_clue');
报错:
原因:odps文件类型不是orc
odps的文件类型有哪些:??aliorc
hive的文件存储类型:
||SequenceFile
Hadoop用来存储二进制形式的[Key,Value]对而设计的一种平面文件(Flat File)。
||TextFile文本格式
||RCFile一种列存储格式
||ORC ★一种列存储格式 进阶版RCFile
||Parquet ★一种列存储格式AVRO
||JsonFile(json文件)
||InputFormat
解决办法:
odps建表前加:
set odps.sql.default.file.format=aliorc;
set odps.storage.force.aliorc=true;
CREATE TABLE `test_clue` ( `id_c` array
2、Hologres 0.8 使用get_json_object函数
先用super账号设置开启hive函数支持:CREATE extension hive_compatible;
SELECt
get_json_object(message,'$.profileData.advertisingID') AS advertisingID
,get_json_object(message,'$.profileData.appKey') AS appkey
,get_json_object(message,'$.profileData.identityId') AS identityId
,get_json_object(message,'$.profileData.productid') AS productid
,get_json_object(message,'$.profileData.properties._td_mobile') AS td_mobile
,get_json_object(message,'$.profileData.properties._td_pixel') AS td_pixel
,get_json_object(message,'$.profileData.properties._td_platform') AS td_platform
,get_json_object(message,'$.profileData.properties._td_brand') AS td_brand
,get_json_object(message,'$.profileData.properties.tenantid') AS tenantid
,get_json_object(message,'$.profileData.properties._td_os') AS td_os
,get_json_object(message,'$.type') AS TYPE
,get_json_object(message,'$.version') AS version
,get_json_object(message,'$.profileData.properties._td_sdk_source') AS td_sdk_source
,get_json_object(message,'$.profileData.properties._td_browser') AS td_browser
,get_json_object(message,'$.profileData.properties._td_channel') AS td_channel
FROM ti_datahub_ae_collector_data_4h
;



