2016-03-08 36 views
4

我試圖在BigQuery UI(不是API)中嵌套一個字段,並在試圖輸出到一個沒有展平的表格時不斷遇到錯誤:BigQuery NEST()返回'錯誤:發生內部錯誤'

Error: An internal error occurred and the request could not be completed.

我使用的NEST()功能,我已經試過這對公衆莎士比亞數據集,並繼續得到同樣的錯誤。

SELECT corpus, NEST(word) FROM [publicdata:samples.shakespeare] GROUP BY 1 

我的工作ID是:realself-主:bquijob_1bfb8310_153583ecbc2

回答

4

有上SO相關噸問題如何BigQuery中 產生重複的Fileds /記錄,還有許多不同的答案 - 爲

來自:NEST是不unflatten結果兼容 - 在
Internal error on NEST when not flattening results

到:一些解決方案來解決這個問題問題使用JS UDF如
Nest multiple repeated fields in BigQuery;
Create a table with Record type column;
create a table with a column type RECORD

有更多的 - 你可以搜索

But surprisingly enough - recently, I found how to make NEST() work almost as it supposed to work!

嘗試下面看到的伎倆

SELECT corpus, words 
FROM (
    SELECT corpus, NEST(word) AS words 
    FROM [publicdata:samples.shakespeare] 
    GROUP BY 1 
) AS a 
CROSS JOIN (SELECT 1) AS b 

注意,你必須寫結果到表Allow Large ResultsFlatten Results關閉

+0

這個技巧非常棒!我已經使用了其他幾次交叉連接來欺騙BQ,沒想到在這裏嘗試了它。 – pkrengel

+0

我在nest()的相當繁重的實驗中發現它,因爲它是最弱但尚未被要求的特性之一 –