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