gpt4 book ai didi

hadoop - pig : field does not exist after join

转载 作者:行者123 更新时间:2023-12-02 20:57:42 24 4
gpt4 key购买 nike

似乎我在加入后以某种方式删除了 key 。

上下文

目标是从 table_2 中获取仅包含 table_1 中不同成员 ID 的所有记录。

作为一个新手,我很感激实现这一目标的最佳实践的指针,以及任何关于我为什么会得到“投影场”错误的评论。

我试过的

-- assume %default vals set for path_1 and path_2 to data

-- load the data

table_1 = LOAD '$path_1' as (day, member_id, country);
table_2 = LOAD '$path_2' as (day, member_id, country);

-- get distinct member_id's from table_1

table_1_ids = DISTINCT(FOREACH table_1 GENERATE member_id as member_id);

-- get all records from table_2 that only have table_1_ids

new_table_2 = JOIN table_1_ids BY member_id, table_2 BY member_id;

错误

无效的场投影。架构中不存在投影字段 [member_id]:table_1_ids::member_id:bytearray,table_2::day:bytearray, table_2::member_id:bytearray, table_2::country:bytearray。

最佳答案

首先你在加入后没有提供脚本,但我假设你有一些 generate陈述。加入后所有列都重命名为<alias_name>::<field_name> .由于您在两个别名中有相同名称的字段( member_id ),因此在加入后您不能通过它的简单名称来引用它。您必须使用它的全名 table_1_ids::member_idtable_2::member_id (它们具有相同的值,但它们在连接结果中仍然是 2 个不同的字段)。希望这可以帮助。

关于hadoop - pig : field does not exist after join,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44040913/

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