简体   繁体   English

BigQuery - operator = 参数类型没有匹配的签名:INT64,STRING

[英]BigQuery - No matching signature for operator = for argument types: INT64, STRING

Im getting a weird error(Maybe im getting this error for the first time) from BQ.我从 BQ 收到一个奇怪的错误(也许我是第一次收到此错误)。

No matching signature for operator = for argument types: INT64, STRING. 
Supported signatures: ANY = ANY at [27:1]

Query:询问:

SELECT col1
    ,col2
    ,col3
FROM tbl1
JOIN t2 ON t1.id = t2.id
JOIN t3 on t2.id = t3.id
JOIN t4 on t4.id = t1.id

Error line JOIN t2.id = t3.id t2.id is showing this error.错误行JOIN t2.id = t3.id t2.id显示此错误。

its an integer column.它是一个 integer 列。

One of your comparisons is mixing types.您的比较之一是混合类型。 This is a bad idea -- as the error message shows.这是一个坏主意——如错误消息所示。 You need to find out which pair (or pairs) and do one of the following:您需要找出哪一对(或多对)并执行以下操作之一:

cast(t2.id as string) = t3.id
t2.id = safe.cast(t3.id as int64)

In my case this is due to syntax error.在我的例子中,这是由于语法错误。 So to solve this just copy the generated query and paste it in bigquery then you will know what is wrong.因此,要解决此问题,只需复制生成的查询并将其粘贴到 bigquery 中,然后您就会知道哪里出了问题。

In your query you created join with t2 table but t3 and t4 table names are not given in join.在您的查询中,您创建了与t2表的连接,但在连接中未给出t3t4表名。 Below is the correct query.下面是正确的查询。

SELECT col1
    ,col2
    ,col3
FROM tbl1 as t1
JOIN t2 ON t1.id = t2.id
JOIN t3 ON t2.id = t3.id
JOIN t4 ON t4.id = t1.id

Try this.尝试这个。 I think this will work.我认为这会奏效。

After Edit编辑后

you need to give table name with field in select fields like您需要在选择字段中提供带有字段的表名,例如

select 
    t1.field1, 
    t2.field1, 
    t3.field3, 
    t4.field 
From tbl1 as t1
JOIN t2 ON t1.id = t2.id
JOIN t3 ON t2.id = t3.id
JOIN t4 ON t4.id = t1.id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM