Regrid changes in 12.10?


#1

Does the syntax (and semantics) change between version 12.3 and 12.10 for some existing operators?

In particular, does 12.3 (older, current) version support "… REGRID AS … " syntax? (important word: “AS” )

I can not get a script to work, so I am asking if I should wait or work around it?

Thanks, George


#2

Hi George,

Yes there have been some changes.
AFL syntax is the same.
AQL syntax: REGRID AS ( PARTITION BY dimension_name interval, dimension_name interval, …)
New semantic: if a particular grid has 0 cells, it used to contain the result of aggregation over an empty set. This had the liability of creating dense arrays of 0s out of sparse arrays. New semantic is that if a grid has 0 cells, the result is an empty cell. The same semantic is also used for grouped aggregates. We had a long argument about what the right thing to do is and decided this would is best. It is the option that respects SQL the most.
If you want something more like the old semantic, you can merge the result of regrid with a build statement to give you a “background” of 0 or null values.

So the world looks like this:

iquery -aq "create array foo <val:int64> [x=1:10,5,0,y=1:10,5,0]"

iquery -o csv+ -aq "store(build_sparse(foo,x+y, (x=3 and y<8) or (y=5 and x<=2) or (y=10 and x=10)), foo)"
x,y,val
1,5,6
2,5,7
3,1,4
3,2,5
3,3,6
3,4,7
3,5,8
3,6,9
3,7,10
10,10,20

iquery -o csv+ -q "select sum(val) from foo regrid as (partition by x 2, y 3);"
x,y,sum
1,2,13
2,1,15
2,2,24
2,3,10
5,4,20

Your thoughts? Reactions?