runt18 / google-bigquery

Automatically exported from code.google.com/p/google-bigquery
0 stars 0 forks source link

Aliasing a column as "returns" throws an error #456

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Do query "select COLUMN as returns from dataset.table;"
2. Run query
3. Receive error: Error: Encountered " "AS" "as "" at line 2, column 10. Was 
expecting: <EOF>

What is the expected output? What do you see instead?
Expected output:
result set with the column name "returns"

I see an error message from BQ instead.
Error: Encountered " "AS" "as "" at line 2, column 10. Was expecting: <EOF>

What version of the product are you using? On what operating system?
I'm using the latest bigquery webui, MacOSX Yosemite

Please provide any additional information below.

Original issue reported on code.google.com by yuchen....@tapjoy.com on 1 Mar 2016 at 11:54

Attachments:

GoogleCodeExporter commented 8 years ago
You've hit a keyword in our SQL dialect. If you put brackets around the alias 
(i.e., [returns]), that'll quote the string, preventing it from being 
interpreted as a keyword.

This issue will be addressed more comprehensively by our upcoming SQL dialect 
improvements (issue 448).

Original comment by jcon...@google.com on 1 Mar 2016 at 11:59

GoogleCodeExporter commented 8 years ago
Hi,

Thanks for the prompt response. I figured it was probably a keyword, but 
couldn't find such a keyword in the query reference doc at 
https://cloud.google.com/bigquery/query-reference.

Out of curiosity, what does the returns keyword do?

Original comment by yuchen....@tapjoy.com on 2 Mar 2016 at 12:13

GoogleCodeExporter commented 8 years ago
Sadly, nothing. :-)

The parser we use is shared with a few other Google projects, so there are a 
few keywords in the grammar that are meaningless in BigQuery.

Original comment by jcon...@google.com on 2 Mar 2016 at 12:17