BigQuery查询失败,出现错误:“意外,请重试。”
问题描述:
以下查询失败,显示错误消息:“意外,请重试。”BigQuery查询失败,出现错误:“意外,请重试。”
SELECT sapId as SAP_ID, accessionId as ACCESSION_ID, diagnosticSetId as DIAGNOSTIC_SET_ID
, if(pimsSoftwareCode is null,
if((feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'Android')) OR (feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'iOS'))
, 'MOBILE', 'ONLINE'
)
,'PIMS') as MODE
, if(feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'iOS'),
'iOS'
,if(feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'Android')
, 'Android', null)) as MOBILE_OS
, date(usec_to_timestamp(createAuditDate)) as DATE
, time(usec_to_timestamp(createAuditDate)) as TIME
FROM [20141104Android_backup.EventLog]
where month(USEC_TO_TIMESTAMP(createAuditDate)) = 10
and year(USEC_TO_TIMESTAMP(createAuditDate)) = 2014
and xUserAgent != 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)'
and ((feature = 'Result_View' and appUrl contains '/app/viewCumulative') or (feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'Android')) or (feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'iOS')));
当我修改下面一行:
if(feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'iOS'),
'iOS'
,if(feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'Android')
, 'Android', null))
是:
if(feature = 'MOBILE_JOB' and action = 'VIEW_JOB' and REGEXP_MATCH(xUserAgent, 'iOS'),
'iOS'
,if(feature = 'Result_View' and REGEXP_MATCH(xUserAgent, 'Android')
, 'Android', null))
查询工作得很好。如果需要,我可以提供失败的作业ID。我完全理解为什么第一个变体失败,第二个变体很好。感谢您提供任何帮助。
答
你工作的内部错误是Field 'MOBILE_OS' is incompatible with the table schema: Type mismatch: actual 'TYPE_BOOL' vs. expected 'TYPE_STRING'
。我们应该更好地表达这个错误,而不是提供“意外的请再试一次”。信息。
我以前在使用空字符时看到过这种情况,因为查询引擎通常将其解释为布尔类型。在IF语句中尝试使用STRING(null)
而不是null
。
+1
这工作完美,非常感谢您的帮助丹尼! – 2014-11-05 12:15:01
如果涉及调试,请始终包含工作ID请 – 2014-11-04 21:04:43
工作ID:vetconnectplus-shared:job_S3jDs68IVHTk71aL6uJSH0q4lOI – 2014-11-04 21:29:15