Google bigquery BigQuery-带时间戳的联合错误

Google bigquery BigQuery-带时间戳的联合错误,google-bigquery,Google Bigquery,我知道BigQuery有bug,但我还是很高兴听到一些想法,以便了解解决它的最佳方法 工会工作: select * from (select CURRENT_TIMESTAMP() as dwh_update_date) a )aa , (select CURRENT_TIMESTAMP() as dwh_update_date) b 联合不起作用,但我的查询必须采用以下方式: select * from (select a.dwh_update_date as dwh_update_d

我知道BigQuery有bug,但我还是很高兴听到一些想法,以便了解解决它的最佳方法

工会工作:

select *
from

(select CURRENT_TIMESTAMP() as dwh_update_date) a 
)aa
,
(select CURRENT_TIMESTAMP() as dwh_update_date) b
联合不起作用,但我的查询必须采用以下方式:

select *
from

(select a.dwh_update_date as dwh_update_date 
from (select CURRENT_TIMESTAMP() as dwh_update_date) a 
)aa
,
(select CURRENT_TIMESTAMP() as dwh_update_date) b
错误消息:

未找到字段“a.dwh\u update\u date.usec”


我用a把它修好了。前缀子查询看起来非常复杂,为什么需要这样做

SELECT *
FROM (
  SELECT dwh_update_date AS dwh_update_date
  FROM (
    SELECT CURRENT_TIMESTAMP() AS dwh_update_date
  ) a
)aa,
(
  SELECT CURRENT_TIMESTAMP() AS dwh_update_date
) b

这个问题已经被谷歌确认为暂时性的错误,将在未来得到修复。
因此,目前最好的解决方案是在需要进行联合时将时间戳更改为字符串,并在联合后将其转换回时间戳。

因为你!:当我使用您发布的带有时间戳字段的查询时,我在这个问题上面临很大的挑战,从[oldtable]中选择*FROM SELECT*,其中id不在[newtable]中,从[newtable]中选择id,从[newtable]中选择*FROM[newtable],当我从ods中运行这个选择dwh\U更新日期时,从ods中选择dwh\U更新日期,选择当前时间戳作为dwh\U update\U date b我收到错误:Union导致模式不明确。[dwh_update_date.usec]不明确,并且在多个字段中使用别名。别名字段:dwh_update_date.usec,usec,只有带有时间戳的字段才会出现,如果我将其转换为字符串并返回到时间戳,它就会工作,选择CURRENT_TIMESTAMP as dwh_update_date b请尝试在其中一个子查询中将CURRENT_TIMESTAMP替换为表中的字段,您将再次发现错误。最好将时间戳转换为微秒,然后再转换回来,使用TIMESTAMP_to_usec和usec_to_TIMESTAMP,对我来说效果很好。