在BigQuery视图中找不到字段 [英] Field not found in BigQuery view

查看:136
本文介绍了在BigQuery视图中找不到字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能只是BQ中的一个错误,但也许有人可能会因为某种错误而致电我。基本上我想要做的是将一个字段(比如 new_field )添加到表中,并将其保存为稍后查询的视图。

当我查询视图时,它会抛出一个关于无法找到 new_field 的错误。

复制此错误的最简单方法:

pre $ SELECT $(corpus_date > 1599,17th,16th)AS century,*
FROM [publicdata:samples.shakespeare]
WHERE corpus_date> 0;

另存为视图,将其称为 bar

  SELECT * FROM [foo.bar] 

会抛出如下错误:

 错误:字段'century'未找到在表'publicdata:samples.shakespeare'中。 

有什么想法?

解决方案

看起来像在视图中有一个 * 扩展的问题。我已经提交了一个bug,希望我们很快能够修复。同时,您应该能够明确地添加视图中的所有字段来解决问题。

例如,如果将视图保存为以下内容:


 选择IF(corpus_date> 1599,17th,16th)AS世纪,
字, word_count,corpus,corpus_date
FROM [publicdata:samples.shakespeare]
WHERE corpus_date> 0;

然后 select * from [foo.view] 会起作用。


This might just be a bug in BQ, but maybe someone might be able to call me out on some error. Essentially what I'm trying to do is to add a field (say new_field) to a table and save that as a View to query later.

When I query the view, it throws an error about not being able to find the new_field.

Simplest way to replicate this error:

SELECT IF(corpus_date > 1599, "17th", "16th") AS century, *
FROM [publicdata:samples.shakespeare] 
WHERE corpus_date > 0;

Save As a view, call it bar.

SELECT * FROM [foo.bar]

will throw an error like:

Error: Field 'century' not found in table 'publicdata:samples.shakespeare'.

Any thoughts?

解决方案

Looks like there is an issue with * expansion in views. I've filed a bug and hopefully we'll be able to get a fix out soon. In the mean time, you should be able to work around the issue by adding all of the fields in the view explicitly.

For example if you save the view as the following:

SELECT IF(corpus_date > 1599, "17th", "16th") AS century, 
    word, word_count, corpus, corpus_date
FROM [publicdata:samples.shakespeare] 
WHERE corpus_date > 0;

then select * from [foo.view] will work.

这篇关于在BigQuery视图中找不到字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆