blob: 44ad6ea1b3e8e0d93fe7e3fd58a202ed8095307f [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse test if exists;
2create dataverse test;
3use dataverse test;
4
5create type MyRecord as open {
6 id: int32,
7 loc: point
8}
9
10create external dataset MyData(MyRecord)
11using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
12(("path"="nc1://data/spatial/spatialDataAggregation.json"),("format"="adm"));
13
14write output to nc1:"rttest/spatial_cell-aggregation.adm";
15
16let $grid :=
17for $o in dataset('MyData')
18group by $c := spatial-cell($o.loc, create-point(0.0,0.0), 5.0, 5.0) with $o
19let $num := count($o)
20order by $num
21return { "cell": $c, "count": $num}
22for $g in $grid
23return $g