在此 Hive 查询中找不到问题
Can't found the poroblem within this Hive Query
编辑:抱歉,我刚刚意识到我将 fee 和 foo 列命名为相等。现在更正了
我正在尝试在 GCP
中的 Hive
中的 2 个表之间进行内部联接。问题是这个连接需要通过 2 个变量的相互连接来完成。这是我的查询:
CREATE VIEW IF NOT EXISTS table_foofee AS
SELECT foo.atr1, foo.atr2, fee.atrA, fee.atrB
FROM table_foo foo
JOIN table_fee fee
ON foo.atr9 = fee.atr9 and foo.atr10 = fee.atr10;
每个表的示例:
# foo
atr1 atr2 ... atr9 atr10
1 0.7 1 01/01/05
0.78 0.1 1 01/02/05
1.7 0.4 1 01/03/05
0.1 0 1 01/04/05
1 0.78 2 01/01/05
0 0.44 2 01/02/05
....
#fee
atrA atrB ... atr9 atr10
10 0.47 1 01/01/05
0.8 0.2 1 01/02/05
3 0.41 1 01/03/05
4.1 1 1 01/04/05
2 0.7 2 01/01/05
1.78 0.34 2 01/02/05
....
如您所见,atr9
和 atr10
是相等的。
我没有收到任何错误,而是一个空视图。该查询有什么问题?
As you can seem both atr9 and atr10 are equals.
不,我们看不到这个。
I receive no error but an empty view.
Normal your query is correct
What is wrong with that query?
Nothing
要理解,您必须使用 LEFT OR RIGHT JOIN 更改查询并查看结果,您会看到一些空结果面对非空结果,您必须理解为什么会有一些差异。
编辑:抱歉,我刚刚意识到我将 fee 和 foo 列命名为相等。现在更正了
我正在尝试在 GCP
中的 Hive
中的 2 个表之间进行内部联接。问题是这个连接需要通过 2 个变量的相互连接来完成。这是我的查询:
CREATE VIEW IF NOT EXISTS table_foofee AS
SELECT foo.atr1, foo.atr2, fee.atrA, fee.atrB
FROM table_foo foo
JOIN table_fee fee
ON foo.atr9 = fee.atr9 and foo.atr10 = fee.atr10;
每个表的示例:
# foo
atr1 atr2 ... atr9 atr10
1 0.7 1 01/01/05
0.78 0.1 1 01/02/05
1.7 0.4 1 01/03/05
0.1 0 1 01/04/05
1 0.78 2 01/01/05
0 0.44 2 01/02/05
....
#fee
atrA atrB ... atr9 atr10
10 0.47 1 01/01/05
0.8 0.2 1 01/02/05
3 0.41 1 01/03/05
4.1 1 1 01/04/05
2 0.7 2 01/01/05
1.78 0.34 2 01/02/05
....
如您所见,atr9
和 atr10
是相等的。
我没有收到任何错误,而是一个空视图。该查询有什么问题?
As you can seem both atr9 and atr10 are equals.
不,我们看不到这个。
I receive no error but an empty view. Normal your query is correct
What is wrong with that query? Nothing
要理解,您必须使用 LEFT OR RIGHT JOIN 更改查询并查看结果,您会看到一些空结果面对非空结果,您必须理解为什么会有一些差异。