gpt4 book ai didi

sql - 无法使用INSERT OVERWRITE DIRECTORY从HIVE表插入HDFS

转载 作者:行者123 更新时间:2023-12-02 21:46:42 28 4
gpt4 key购买 nike

我的主要需求是使用INSERT OVERWRITE uery从HIVE加载HDFS中的文件。在此查询中,我尝试连接3个配置单元表。下面是查询:

select * FROM 
AGG_CUSTOMER_EXPSR_DRV_HIVE DRV
LEFT OUTER JOIN
AGG_CUSTOMER_EXPSR_SRC_HIVE SRC
ON
(SRC.CUSTOMER_ID = DRV.CUSTOMER_ID)
AND (SRC.AGGREGATION_LEVEL_CD = DRV.AGGREGATION_LEVEL_CD)
AND (SRC.PRODUCT_GROUP_CD = DRV.PRODUCT_GROUP_CD) AND (SRC.SRC_SYS_CD = DRV.SRC_SYS_CD)
LEFT OUTER JOIN
ALTERNATE_IP_HIVE AIP1
ON
(DRV.DERIVED_CUSTOMER_ID = AIP1.IP_ID) AND (AIP1.IP_TYPE_CD IN (1, 4))
LEFT OUTER JOIN
ALTERNATE_IP_HIVE AIP3
ON
(SRC.FINANCIAL_RPTNG_UNIT_ID = AIP3.IP_ID) AND (AIP3.IP_TYPE_CD = 3)
WHERE EXCLUDE_IND ='N';

但是我收到如下错误: -sh: syntax error near unexpected token(`

有人可以帮我找出问题吗?

注意:我已经删除了SELECT子句中的字段。

最佳答案

如果您使用上面的sql中的结果字段数在 hive 中创建了一个表,则只需

INSERT OVERWRITE TABLE <database_name.your_created_table_name> SELECT * FROM 
AGG_CUSTOMER_EXPSR_DRV_HIVE DRV
LEFT OUTER JOIN
AGG_CUSTOMER_EXPSR_SRC_HIVE SRC
ON
(SRC.CUSTOMER_ID = DRV.CUSTOMER_ID)
AND (SRC.AGGREGATION_LEVEL_CD = DRV.AGGREGATION_LEVEL_CD)
AND (SRC.PRODUCT_GROUP_CD = DRV.PRODUCT_GROUP_CD) AND (SRC.SRC_SYS_CD = DRV.SRC_SYS_CD)
LEFT OUTER JOIN
ALTERNATE_IP_HIVE AIP1
ON
(DRV.DERIVED_CUSTOMER_ID = AIP1.IP_ID) AND (AIP1.IP_TYPE_CD IN (1, 4))
LEFT OUTER JOIN
ALTERNATE_IP_HIVE AIP3
ON
(SRC.FINANCIAL_RPTNG_UNIT_ID = AIP3.IP_ID) AND (AIP3.IP_TYPE_CD = 3)
WHERE EXCLUDE_IND ='N';

从SELECT它是您的查询。您可以检查 this URL以获取有关hiveql的更多帮助

关于sql - 无法使用INSERT OVERWRITE DIRECTORY从HIVE表插入HDFS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24750151/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com