gpt4 book ai didi

google-bigquery - 为什么我在 JOIN 中得到不明确的字段名称 'x'

转载 作者:行者123 更新时间:2023-12-01 12:26:37 25 4
gpt4 key购买 nike

Fact 1 - I am successfully running simple query like below in BigQuery Web UI

SELECT
a.id AS id,
b.v AS v,
c.w AS w
FROM (SELECT 1 AS id, "abc" AS x, "xyz" AS y) AS a
LEFT JOIN (SELECT "abc" AS x, "111" AS v) AS b ON a.x = b.x
LEFT JOIN (SELECT "xyz" AS y, "222" AS w) AS c ON a.y = c.y

Fact 2 - When I try to write result [of very same query] to table with below options - it fails!

enter image description here

Fact 3 - Same query to table with below options - succeeded!

enter image description here

Question - Why I am getting this error?

注意:
我在 SO 之外被问到这个问题,所以决定在这里分享。
如您所见,“解决方法”已“找到”-因此,如果查询没有随附对实际问题的解释/答案,请不要建议如何重写查询。

最佳答案

今天早上我在尝试保存 View 时遇到了类似的问题,发现其他人在 web UI 和批处理之间切换时遇到了这个问题。从我收集到的信息来看,这是一个奇怪的极端情况,您可以通过三重联接获得。

我找到了 this有助于弄清楚发生了什么,特别是这一点:

“这里的根本问题是您查询中最终 JOIN 的左侧源试图将 [a.x] 和 [b.x] 折叠到同一范围内,两者都具有名称 'x',并导致此错误。”

有人在 Official Google BigQuery issue and feature tracker 上问过类似的问题并引用了上述 SO 帖子。

希望其中之一能帮助澄清一下。

关于google-bigquery - 为什么我在 JOIN 中得到不明确的字段名称 'x',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38965631/

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