1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

HIVE-6384 さんにお帰りいただいた話

Last updated at Posted at 2021-11-16

検索しても有用な情報が少なかったのですが、直面した HIVE-6384 エラーを解消した話です。

出たエラー

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.UnsupportedOperationException: Parquet does not support date. See HIVE-6384
This query ran against the "xxx" database, unless qualified by the query. Please post the error message on our forum
or contact customer support with Query Id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

実行した SQL on Athena

CREATE EXTERNAL TABLE IF NOT EXISTS xxx.fact_members
(
  member_id  INT          COMMENT '会員ID',
  birth_date DATE         COMMENT '生年月日',
  trigger    VARCHAR(216) COMMENT '会員登録のきっかけ'
)
COMMENT '会員ファクト'
STORED AS PARQUET
LOCATION 's3://{BUCKET}/fact_members/process_date=2021-11-16'
TBLPROPERTIES (
  'parquet.compress' = 'SNAPPY'
);

調べたこと

カラムを削ってみたりしたところ trigger が悪さをしてそうなこと
DATE 型のカラムがなければ問題なく動くことがわかりました。

DATE 型のカラムは欲しかったので trigger をなんとかできないか検討。

Athena で例えばスペース入りのカラム名でクエリするときなどはダブルクォートだったのですが、それでは動かない。

CREATE EXTERNAL TABLE IF NOT EXISTS xxx.fact_members2
(
  member_id  INT          COMMENT '会員ID',
  birth_date DATE         COMMENT '生年月日',
  "trigger"  VARCHAR(216) COMMENT '会員登録のきっかけ'
)
COMMENT '会員ファクト'
STORED AS PARQUET
LOCATION 's3://{BUCKET}/fact_members/process_date=2021-11-16'
TBLPROPERTIES (
  'parquet.compress' = 'SNAPPY'
);

line 1:8: mismatched input 'EXTERNAL'. Expecting: 'OR', 'SCHEMA', 'TABLE', 'VIEW'

解決

カラム名をバッククォートで囲むことで対応できました。

CREATE EXTERNAL TABLE IF NOT EXISTS xxx.fact_members2
(
  member_id  INT          COMMENT '会員ID',
  birth_date DATE         COMMENT '生年月日',
  `trigger`  VARCHAR(216) COMMENT '会員登録のきっかけ'
)
COMMENT '会員ファクト'
STORED AS PARQUET
LOCATION 's3://{BUCKET}/fact_members/process_date=2021-11-16'
TBLPROPERTIES (
  'parquet.compress' = 'SNAPPY'
);
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?