VERTICA/09. SQL
flex table
버리까
2018. 10. 1. 18:18
-- 형식이 없는 flex table 생성
create
flex
table
test.temp_ytkim_test();
--초기화
truncate
table
test.temp_ytkim_test
;
-- 데이터 적재
copy test.temp_ytkim_test
from
local
'd:\json\ga_tes*.json'
PARSER fjsonparser();
copy test.temp_ytkim_test
from
local
'd:\json\ga_test*.json'
PARSER fjsonparser(flatten_maps =
true
, flatten_arrays=
true
);
copy test.temp_ytkim_test
from
local
'd:\json\ga*.json'
PARSER fjsonparser(flatten_arrays=
false
, flatten_maps=
false
);
copy test.temp_ytkim_test
from
local
'd:\json\ga*.json'
PARSER fjsonparser();
-- 컬럼생성
SELECT
compute_flextable_keys(
'test.temp_ytkim_test
'
);
-- 조회하기 쉽게 view생성
SELECT
build_flextable_view(
'test.temp_ytkim_test
'
);
select
compute_flextable_keys_and_build_view(
'test.temp_ytkim_test
'
);
-- 조회
SELECT
__raw__[
'hits'
][
'0.appInfo.appId'
],
count
(*) over()
FROM
test.temp_ytkim_test
;
SELECT
mapitems(test.temp_ytkim_test
.__raw__) OVER(PARTITION
BY
best)
from
test.temp_ytkim_test
;
SELECT
mapkeys(__raw__) over()
from
test.temp_ytkim_test
;