LoginSignup
0
0

More than 5 years have passed since last update.

Hiveで配列に複数の値が入っているものだけ抽出してみる

Posted at

概要

TreasureDataで集計する際、配列型に複数の値が入っているものだけ抽出したくて調べたメモを残します。

SQLを書いてみる

td_global_idごとにHAVINGでuser_idが2つ以上あるものだけ抽出する。

SELECT
  td_global_id,
  COUNT(id) as ids
FROM
  dev.hoge
  LATERAL VIEW explode(user_ids) adTable AS id
GROUP BY
  td_global_id
HAVING
  COUNT(id) > 1
;

参考サイト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0