You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@asterixdb.apache.org by Heri Ramampiaro <he...@idi.ntnu.no> on 2015/06/16 01:23:57 UTC
Parsing "path" expression from AQL
I am trying to implement a remove record field function that also can handle
nested fields.
E.g.
let $r := {
"id": "2",
"address": {
"street": "21 Orlando ct.",
"city": "Irvine",
"state": "CA"
}
"related": ["VXQuery", "AQL"]
}
return remove-field($r, [“address.state”]);
Expected result:
[
{
"id": "2",
"address": {
"street": "21 Orlando ct.",
"city": "Irvine"
}
"related": ["VXQuery", "AQL"]
}
]
My question is how is the parser implemented to access nested field names?
(Or, where do I find the API for this?)
Thank you.
Best,
-heri
Re: Parsing "path" expression from AQL
Posted by Heri Ramampiaro <he...@gmail.com>.
I did not look into the “parsing” code itself but I found out how the
API for accessing the record field paths is implements.
The current support convention for nested field name access seems to be:
$record_name.field1.field2
Issuing “$record_name.field1.field2” will call “field-access-nested” function,
which will produce a path as an ArrayList of strings [“field1”, “field2”].
The implementation of the above function can be found in:
“edu.uci.ics.asterix.om.typecomputer.impl.FieldAccessNestedResultType”
“edu.uci.ics.asterix.runtime.formats.NonTaggedDataFormat”
“edu.uci.ics.asterix.runtime.evaluators.functions.FieldAccessNestedDescriptor"
-heri
> On Jun 16, 2015, at 11:05 AM, Ian Maxon <im...@uci.edu> wrote:
>
> Oh, how is it done though? (For other folks that might be curious)
>
> -Ian
>
> On Mon, Jun 15, 2015 at 4:58 PM, Heri Ramampiaro <he...@idi.ntnu.no> wrote:
>> Sorry, forget my previous email. I found out how it is done:-)
>>
>> Cheers,
>> -heri
>>
>>
>>> On Jun 15, 2015, at 4:23 PM, Heri Ramampiaro <he...@ntnu.no> wrote:
>>>
>>> I am trying to implement a remove record field function that also can
> handle
>>> nested fields.
>>>
>>> E.g.
>>> let $r := {
>>> "id": "2",
>>> "address": {
>>> "street": "21 Orlando ct.",
>>> "city": "Irvine",
>>> "state": "CA"
>>> }
>>> "related": ["VXQuery", "AQL"]
>>> }
>>> return remove-field($r, [“address.state”]);
>>>
>>> Expected result:
>>> [
>>> {
>>> "id": "2",
>>> "address": {
>>> "street": "21 Orlando ct.",
>>> "city": "Irvine"
>>> }
>>> "related": ["VXQuery", "AQL"]
>>> }
>>> ]
>>>
>>> My question is how is the parser implemented to access nested field
> names?
>>> (Or, where do I find the API for this?)
>>>
>>> Thank you.
>>>
>>> Best,
>>> -heri
>>>
>>>
>>>
>>
Re: Parsing "path" expression from AQL
Posted by Ian Maxon <im...@uci.edu>.
Oh, how is it done though? (For other folks that might be curious)
-Ian
On Mon, Jun 15, 2015 at 4:58 PM, Heri Ramampiaro <he...@idi.ntnu.no> wrote:
> Sorry, forget my previous email. I found out how it is done:-)
>
> Cheers,
> -heri
>
>
>> On Jun 15, 2015, at 4:23 PM, Heri Ramampiaro <he...@ntnu.no> wrote:
>>
>> I am trying to implement a remove record field function that also can
handle
>> nested fields.
>>
>> E.g.
>> let $r := {
>> "id": "2",
>> "address": {
>> "street": "21 Orlando ct.",
>> "city": "Irvine",
>> "state": "CA"
>> }
>> "related": ["VXQuery", "AQL"]
>> }
>> return remove-field($r, [“address.state”]);
>>
>> Expected result:
>> [
>> {
>> "id": "2",
>> "address": {
>> "street": "21 Orlando ct.",
>> "city": "Irvine"
>> }
>> "related": ["VXQuery", "AQL"]
>> }
>> ]
>>
>> My question is how is the parser implemented to access nested field
names?
>> (Or, where do I find the API for this?)
>>
>> Thank you.
>>
>> Best,
>> -heri
>>
>>
>>
>
Re: Parsing "path" expression from AQL
Posted by Heri Ramampiaro <he...@idi.ntnu.no>.
Sorry, forget my previous email. I found out how it is done:-)
Cheers,
-heri
> On Jun 15, 2015, at 4:23 PM, Heri Ramampiaro <he...@ntnu.no> wrote:
>
> I am trying to implement a remove record field function that also can handle
> nested fields.
>
> E.g.
> let $r := {
> "id": "2",
> "address": {
> "street": "21 Orlando ct.",
> "city": "Irvine",
> "state": "CA"
> }
> "related": ["VXQuery", "AQL"]
> }
> return remove-field($r, [“address.state”]);
>
> Expected result:
> [
> {
> "id": "2",
> "address": {
> "street": "21 Orlando ct.",
> "city": "Irvine"
> }
> "related": ["VXQuery", "AQL"]
> }
> ]
>
> My question is how is the parser implemented to access nested field names?
> (Or, where do I find the API for this?)
>
> Thank you.
>
> Best,
> -heri
>
>
>