How to use AFL to update


#1

I want to know what AFL functions can replace the AQL statement "update array set val = 2 where i=3 ". The val is the name of attribute and the i is the name of the dimension.
Any help would be much appreciated!!!


#2

You can use a combination of apply, build, insert, and redimension to perform pretty much any kind of insertion. Unfortunately, the syntax isn’t very intuitive right now but the capability is all there. Here is a 2D example:

$ iquery -aq "create array temp <val:double> [x=1:10,10,0,y=1:10,10,0]"
Query was executed successfully

$ iquery -aq "insert(redimension(apply(build(<val:double>[i=0:0,1,0], 4.5), x, 3, y, 5), temp), temp)"
{x,y} val
{3,5} 4.5

$ iquery -aq "scan(temp)"
{x,y} val
{3,5} 4.5

Note that insert over an existing value will replace it (via creating a new version) and remember that delete_versions is available.


#3

[quote=“apoliakov”]You can use a combination of apply, build, insert, and redimension to perform pretty much any kind of insertion. Unfortunately, the syntax isn’t very intuitive right now but the capability is all there. Here is a 2D example:

$ iquery -aq "create array temp <val:double> [x=1:10,10,0,y=1:10,10,0]"
Query was executed successfully

$ iquery -aq "insert(redimension(apply(build(<val:double>[i=0:0,1,0], 4.5), x, 3, y, 5), temp), temp)"
{x,y} val
{3,5} 4.5

$ iquery -aq "scan(temp)"
{x,y} val
{3,5} 4.5

Note that insert over an existing value will replace it (via creating a new version) and remember that delete_versions is available.[/quote]

Thank you very much,and it help me a lot.