The query returned an error. Invalid timestamp: '--'

北战南征 提交于 2019-12-13 03:35:15

问题


I have a BigQuery dataset of Gmail logs which is managed by Google. Google streams the email logs to a table named daily_ near real time which is partitioned by day. In the logs are records indicating when certain messages trigger mail routing rules, and I want to select those and calculate the amount of time required to execute the routing rule with a time diff. I was successful in calculating the time diff using SQL, saved it as a view, and now want to graph it in DataStudio. However, whenever I add a time filter with a date range dimension, it gives me the following error:

User Configuration Error

This data source was improperly configured.

The query returned an error.

Invalid timestamp: '--' Error ID: 3d446739

My first thought was that perhaps there are rows where the partition _TABLE_SUFFIX field is blank or null. However, after running a "select distinct _TABLE_SUFFIX" and reviewing the results I'm no longer convinced that is the case, they all have a date value.

Any ideas what might be causing this? For what it's worth, when I add the view as a datasource to DataStudio, it correctly selects the datatype as a date. Google stores values into _TABLE_SUFFIX with the formal YYYYMMDD which is exactly how DataStudio sees it when adding the source.

The worst part about all of this is that a colleague of mine is using the same dataset as a source (albeit with a different but similarly configured view) and his works fine while mine doesn't. Any help is appreciated.

This is the SQL view that I created and want to graph in Data Studio:

SELECT
  _TABLE_SUFFIX as pt,
  MIN(DATETIME(timestamp_micros(event_info.timestamp_usec), "America/New_York")) as time_before,
  MAX(DATETIME(timestamp_micros(event_info.timestamp_usec), "America/New_York")) as time_after,
  DATETIME_DIFF(
    MAX(DATETIME(timestamp_micros(event_info.timestamp_usec), "America/New_York")),
    MIN(DATETIME(timestamp_micros(event_info.timestamp_usec), "America/New_York")),
    SECOND) as timediff,
  message_info.num_message_attachments,
  message_info.source.address as sender,
  dest.address as recipeint,
  message_info.rfc2822_message_id,
  message_info.subject
FROM
  `g-suite-logs.gmail_logs.daily_*` as t1,
  UNNEST ( message_info.destination ) as dest,
  UNNEST ( message_info.triggered_rule_info ) as rule
WHERE rule.rule_name = "Route to third party MTA" OR rule.rule_name = "Receive back from third party MTA"
GROUP BY
  pt,
  message_info.rfc2822_message_id,
  message_info.source.address,
  dest.address,
  message_info.subject,
  message_info.num_message_attachments
ORDER BY pt,rfc2822_message_id

I had also suspected that perhaps the UNNEST was introducing some null values to _TABLE_SUFFIX but no longer suspect that is the case.

来源:https://stackoverflow.com/questions/56581720/the-query-returned-an-error-invalid-timestamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!