Hive的join表连接查询的一些注意事项

Hive支持的表连接查询的语法:

     join_table:
         table_reference JOIN table_factor [join_condition]
       | table_reference {LEFT|RIGHT|FULL} [OUTER] JOIN table_reference join_condition
       | table_reference LEFT SEMI JOIN table_reference join_condition
       | table_reference CROSS JOIN table_reference [join_condition] (as of Hive 0.10)  

     table_reference:
         table_factor
       | join_table  

     table_factor:
         tbl_name [alias]
       | table_subquery alias
       | ( table_references )  

     join_condition:
         ON equality_expression ( AND equality_expression )*  

     equality_expression:
         expression = expression 

hive只支持等连接,外连接,左半连接。hive不支持非相等的join条件(可以通过其他方式实现),因为它很难在map/reduce job实现这样的条件。而且,hive可以join两个以上的表。

上一篇:mysql5.6 忘记root密码


下一篇:mybatis多表关联查询之resultMap单个对象