br1ghtyang / asterixdb

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

Allow field names to be AQL keywords #573

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The field "type" below causes a problem since it is an AQL keyword. It 
shouldn't, if we can help it.

create type Twitter_MediaEntityType as open {
    id: int64,
    id_str: string,
    media_url: string,
    media_url_https: string,
    url: string,
    display_url: string,
    expanded_url: string,
    sizes: {{ Twitter_MediaEntitySizeType }},
    type: string,
    indices: [int32]
}

Original issue reported on code.google.com by zheilb...@gmail.com on 22 Jul 2013 at 10:04

GoogleCodeExporter commented 8 years ago
Minimal example:

create type FooType as open {
    type: string
}

Original comment by zheilb...@gmail.com on 22 Jul 2013 at 10:08

GoogleCodeExporter commented 8 years ago
This has actually been fixed already but the fix doesn't appear to be reflected 
in our documentation.  There's a new quoting approach to naming fields that 
will handle this.  HTC hit this almost immediately too, so it was fixed in 
response to their need.  Till - please comment on the fix and also update the 
docs?  (The grammar needs to reflect this in the AQL doc, and we might want to 
have an example.  You also made another adjustment recently related to this, I 
think?)  Thx!

Original comment by dtab...@gmail.com on 22 Jul 2013 at 11:53

GoogleCodeExporter commented 8 years ago
Yes, this has been fixed. One can use the keywords by quoting them (using 
StringLiterals). This is actually already reflected in the grammar, however
1) the type constructor rule in the grammar was broken (fixed now) such that 
StringLiterals didn't work and
2) the documentation doesn't reflect this well.

So 

  create type FooType as open {
    "type": string
  }

should work and I'll try to find a good spot int he docs to improve them.

Original comment by westm...@gmail.com on 23 Jul 2013 at 6:23

GoogleCodeExporter commented 8 years ago
documentation update is in 
https://code.google.com/p/asterixdb/source/detail?r=42716ea22096cf088050b295e442
e961743e40fe&name=documentation

Original comment by westm...@gmail.com on 23 Jul 2013 at 9:48

GoogleCodeExporter commented 8 years ago

Original comment by westm...@gmail.com on 23 Jul 2013 at 9:49

GoogleCodeExporter commented 8 years ago
Great, thanks!

Original comment by zheilb...@gmail.com on 23 Jul 2013 at 9:50

GoogleCodeExporter commented 8 years ago
Actually, I just hit a new bug. The parser correctly parses the "type" 
fieldname, but returns the quoted fieldname due to a bug in jj file.

The bug is on line 918: the Identifier() call returns the correct fieldname, 
but then is over written by token.image--probably just a piece of legacy code 
that didn't get removed.

The fix is simply to remove the token line.

Original comment by zheilb...@gmail.com on 29 Jul 2013 at 11:32

GoogleCodeExporter commented 8 years ago
Turns out I have an obsolete version of the branch and you fixed this a while 
back.

:)

Original comment by zheilb...@gmail.com on 30 Jul 2013 at 11:26

GoogleCodeExporter commented 8 years ago

Original comment by zheilb...@gmail.com on 30 Jul 2013 at 11:26