Opened 3 years ago

Closed 22 months ago

#2605 closed feature (fixed)

NEW SORT operator

Reported by: aburamadan Owned by: Dimitar Misev
Priority: major Milestone: 10.0
Component: qlparser Version: 10.0
Keywords: sort Cc: Dimitar Misev, Peter Baumann
Complexity: Medium

Description

added SORT operator to sort an MDD by a ranking function. Refer to included docs for more info.
added mandatory test_select test cases.
named axes are supported.
also added QtAxisSDom which returns the SDOM of an array at an axis.(required for SORT op.)

Change History (6)

comment:1 by Bang Pham Huu, 3 years ago

@aburamadan: I built the new rasdaman in master branch with your patch and I couldn't run some queries from your examples at file:///home/rasdaman/rasdaman_community/rasdaman/doc/main/_build/html/04_ql-guide.html#sort-operator

For example:

rasql -q 'select encode(SORT raster2D ALONG 0  AS i BY raster2D[i[0], 0:0], "csv") from test_mr as raster2D' --out string

Executing retrieval query... rasdaman error 412: Execution error 412 in line 0, column 0, near token : Value expression must be either of type atomic or complex.
rasql -q 'select encode(SORT raster2D ALONG time  AS i BY raster2D[i[0], 0:0], "csv") from test_mr as raster2D' --out string
Executing retrieval query... rasdaman error 347: Execution error 347 in line 1, column 29, near token ALONG: Name of the axis doesn't correspond with any defined axis name of the type.
 rasql -q 'select encode(sort c along 1 as i by c[*:*,i[0]], "csv") from test_mr as c' --out string
Executing retrieval query... rasdaman error 412: Execution error 412 in line 0, column 0, near token : Value expression must be either of type atomic or complex.

In the doc, DESC is put wrongly at the end in the examples, e.g.

SORT raster2D ALONG 0 AS n BY add_cells(raster2D[n[0], 1:1]) DESC
SORT raster3D ALONG 1 AS i BY max_cells(raster3D[*:*, i[0], *:*]) DESC

The syntax defines:

sortExp: SORT generalExp ALONG sortAxis AS sortAxisIterator [listingOrder] BY cellExp
Last edited 3 years ago by Dimitar Misev (previous) (diff)

comment:2 by Dimitar Misev, 3 years ago

The doc examples should use the demo collections mr2 or rgb, not test_mr from the systemtest. And ideally they should run without errors.

comment:3 by Bang Pham Huu, 2 years ago

Note: There is a big difference in the results of a rasql query using sort operator:

SELECT encode(SORT c ALONG 0 AS i ASC BY c[i[0],39], "jpeg" , "{\"metadata\":{\"resolution\":\"1\"},\"nodata\":[]}")  FROM test_mr AS c

Left is Ubuntu 20.04, right is centos 7

https://i.imgur.com/Ugu63D2.png

comment:4 by Dimitar Misev, 2 years ago

Are you sure you have look at the right output on CentOS 7? It looks like no sorting was done at all and it returns the original image.

comment:5 by Bang Pham Huu, 2 years ago

Owner: changed from aburamadan to Dimitar Misev

comment:6 by Dimitar Misev, 22 months ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.