Franky's Blog

书山有路勤为径,学海无涯苦作舟……

Hive分区表添加列

1ALTER TABLE table_name 
2  [PARTITION partition_spec]                 -- (Note: Hive 0.14.0 and later)
3  ADD COLUMNS (col_name data_type [COMMENT col_comment], ...)
4  [CASCADE|RESTRICT]                         -- (Note: Hive 1.1.0 and later)
Read more →

Hive不支持非等值连接

FAILED: SemanticException [Error 10017]: Line 17:31 Both left and right aliases encountered in JOIN ‘AMOUNT’

原因:Hive不支持非等值连接

现已支持,Complex expressions in ON clause are supported, starting with Hive 2.2.0 (see HIVE-15211, HIVE-15251). Prior to that, Hive did not support join conditions that are not equality conditions.

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Joins

Read more →

Only 1 SubQuery Expression Is Supported

HiveQL Where条件中只支持一个子查询,如下面的例子中我需要排除两类数据:

  1. 排除POS商户不统计名单
  2. 排除POS商户MCC码不统计名单
1INSERT INTO TABLE TEST.TMP03_POS_AMT
2SELECT *
3FROM TEST.TMP02_POS_AMT
4WHERE POS_MERCHT_CD NOT IN (SELECT POS_MERCHT_ID FROM TEST.MERCH_LIST)
5   OR MCC NOT IN (SELECT MCC FROM TEST.MCC_INFO)
6   ;

SemanticException [Error 10249]: Line 5 Unsupported SubQuery Expression ‘MCC’: Only 1 SubQuery expression is supported.

Read more →