【问题标题】:Google BigQuery: Sometimes TABLE_DATE_RANGE is unstableGoogle BigQuery:有时 TABLE_DATE_RANGE 不稳定
【发布时间】:2017-05-23 14:02:24
【问题描述】:

有时在 Google BigQuery 中使用 TABLE_DATE_RANGE 的查询会失败。
但是目标表已经存在,并且失败的查询通过重试成功。

具体例子如下。

---------------------------------------
The Target Table
---------------------------------------
[ Dataset ID ]    my_dataset
[ Table ID ]      my_table_20170519
[ Creation Time ] 2017-05-20 02:00:52

---------------------------------------
The Executed Query
---------------------------------------
SELECT
  column1, column2, .....
FROM
  TABLE_DATE_RANGE(
    my_dataset.my_table_,
    TIMESTAMP('20170519'),
    TIMESTAMP('20170519')
  )
;

---------------------------------------
The 1st Execution and Result
---------------------------------------
[ Job Start Time ]  2017-05-20 02:00:57.513
[ Job End Time ]    2017-05-20 02:00:57.513
[ Result ]          Failure by "FROM clause with table wildcards matches no table"

---------------------------------------
The 2nd Execution and Result (Retry)
---------------------------------------
[ Job Start Time ]  2017-05-20 02:04:56.556
[ Job End Time ]    2017-05-20 02:04:56.556
[ Result ]          Failure by "FROM clause with table wildcards matches no table"

---------------------------------------
The 3rd Execution and Result (Retry)
---------------------------------------
[ Job Start Time ]  2017-05-20 02:06:43.937
[ Job End Time ]    2017-05-20 02:06:46.291
[ Result ]          Success
-


顺便说一句,使用 NO TABLE_DATE_RANGE 的查询总是会成功。
(例如FROM [my_dataset.my_table_20170519])。
使用相同的 FROM 子句几乎同时执行的其他查询有时会成功。


当然,使用重试可以解决上面的例子。
但我担心 my_table_20170519 会被使用以下 FROM 子句的查询忽略。

FROM
  TABLE_DATE_RANGE(
    my_dataset.my_table_,
    TIMESTAMP('20170510'),
    TIMESTAMP('20170519')
  )


有没有人有办法解决它?


我添加两个关于这个问题的例子。

示例 A:
使用相同的 FROM 子句几乎同时执行的其他查询有时会成功。

----------------------------------------------
The Detail of Case
----------------------------------------------

- A program executes query "A" and query "B" in BigQuery.
- Both queries have the following FROM clause。

  FROM TABLE_DATE_RANGE(
    my_dataset.my_table_,
    TIMESTAMP('20170519'),
    TIMESTAMP('20170519')
  )

----------------------------------------------
The 1st Execution and Result
----------------------------------------------

Query "A"
  [ Job Start Time ]  2017-05-20 02:00:57.513
  [ Job End Time ]    2017-05-20 02:00:57.513
  [ Result ]          Failure by "FROM clause with table wildcards matches no table"

Query "B"
  [ Job Start Time ]  2017-05-20 02:00:57.507
  [ Job End Time ]    2017-05-20 02:01:09.537
  [ Result ]          Success


----------------------------------------------
The 2nd Execution and Result (Retry)
----------------------------------------------

Query "A"
  [ Job Start Time ]  2017-05-20 02:04:56.556
  [ Job End Time ]    2017-05-20 02:04:56.556
  [ Result ]          Failure by "FROM clause with table wildcards matches no table"

# Query "B" is NOT executed because it already succeeded.

----------------------------------------------
The 3rd Execution and Result (Retry)
----------------------------------------------

Query "A"
  [ Job Start Time ]  2017-05-20 02:06:43.937
  [ Job End Time ]    2017-05-20 02:06:46.291
  [ Result ]          Success

# Query "B" is NOT executed because it already succeeded.


示例 B:
此问题有时会在“不小的”时间段后发生。

---------------------------------------
The Target Table
---------------------------------------
[ Dataset ID ]    my_dataset
[ Table ID ]      my_table_b_20170519
[ Creation Time ] 2017-05-20 01:42:22

---------------------------------------
The Executed Query
---------------------------------------
SELECT
  column1, column2, .....
FROM
  TABLE_DATE_RANGE(
    my_dataset.my_table_b_,
    TIMESTAMP('20170519'),
    TIMESTAMP('20170519')
  )
;

----------------------------------------------
The 1st Execution and Result
----------------------------------------------
[ Job Start Time ]  2017-05-20 01:59:51.255
[ Job End Time ]    2017-05-20 01:59:51.255
[ Result ]          Failure by "FROM clause with table wildcards matches no table"

----------------------------------------------
The 2nd Execution and Result
----------------------------------------------
[ Job Start Time ]  2017-05-20 02:04:53.802
[ Job End Time ]    2017-05-20 02:04:57.684
[ Result ]          Success

【问题讨论】:

    标签: google-bigquery


    【解决方案1】:

    我认为 TABLE_DATE_RANGE 正在使用元表 (tables.list) 来获取符合条件的表列表。
    问题在于,虽然表数据可立即用于查询 - 元数据最终可用 - 这意味着将新表放入列表需要时间。
    如果您在创建后立即查询该表,您将不会看到此问题。

    注意:以上假设您仅在新表创建后的“小”时间段后才遇到此问题

    另见 - Eventually consistent operations - 我觉得它是相关的

    【讨论】:

    • 感谢您的回答。您告诉的 TABLE_DATA_RANGE 的行为非常有趣。但它不能解释这个问题有两个原因。 [1] 使用相同的 FROM 子句几乎同时执行的其他查询有时会成功。 [2] 这个问题有时会在“不小的”时间段后发生。 (我添加了关于它们的新例子来质疑。)所以,我认为这个问题是由其他原因引起的。不过非常感谢。
    • 同意 - 我也希望 16 分钟足以让对象在列表中可用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多