26. 予約語であるカラム名のテーブルが存在していた
26
例)
SELECT
user -- 予約語
FROM a
org.apache.hive.service.cli.HiveSQLExcepti
on: Error while compiling statement:
FAILED: ParseException line 2:0 Failed to
recognize predicate 'user'. Failed rule:
'identifier' in table or column ide...
27. 27
クエリ内の予約語をバッククォート(`)で囲む
例)
SELECT
`user` -- 予約語
FROM a
hiveのバージョン別予約語一覧
:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-ReservedKeywords
hive.support.sql11.reserved.keywords=false を設定してもよい
予約語であるカラム名のテーブルが存在していた
28. 28
データ型が異なるカラム同士でUnionしていた
例)
SELECT
IF(int_column=0, '', int_column) AS int_column -- 結果が1
FROM a
UNION ALL
SELECT
IF(int_column=0, '', int_column) AS int_column -- 結果が''
FROM b
org.apache.hive.service.cli.HiveSQLExce
ption: Error while compiling statement:
FAILED: SemanticException Schema of
both sides of union should match: Column
int_column is of type int on first table and
type string on second table. Cannot tell
the position of null AST.
39. クエリ実行エンジンがMRからTezになった
39
例)
WITH target AS (
SELECT id, name FROM a
UNION ALL
SELECT id, name FROM b )
INSERT OVERWRITE TABLE bd_name.table_name
SELECT id, name FROM target