2014-11-04 70 views
3

以下查詢失敗,顯示錯誤消息:「意外,請重試。」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。我完全理解爲什麼第一個變體失敗,第二個變體很好。感謝您提供任何幫助。

+2

如果涉及調試,請始終包含工作ID請 – 2014-11-04 21:04:43

+1

工作ID:vetconnectplus-shared:job_S3jDs68IVHTk71aL6uJSH0q4lOI – 2014-11-04 21:29:15

回答

3

你工作的內部錯誤是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

相關問題