Skip to content

Lay out a returned SQL array as the catalog's arrayShape states on the typed SQL surfaces - #195

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/array-null-mask-and-rows
Oct 25, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/array-null-mask-and-rows

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

A signature returning a SQL array whose layout its wrapper gives beyond the C array, the catalog's arrayShape, is read by _array_shape_overload of tools/codegen_jvm.py: each element of the C array, NULL where the output array arrayShape names as nulls is true, and with a rowLength the elements cut into rows of the length the public function it names answers for the parameters it names, an array of arrays on both engines as PostgreSQL answers a two-dimensional array. dumpValues(raster, integer, boolean) answers a row of values per row of the raster, raster_width of it long, NULL for a nodata pixel, and frees the values and the mask raster_dump_values allocates.

Witness: over MobilityDB master 1a7a1a0e11 and MEOS-API master 90583fe, whose catalog states the arrayShape of dumpValues(raster, integer, boolean) since MEOS-API #208, main's generator refuses it on the typed Spark and Flink surfaces as arity:jmeos.

Measured over the same pair with the jar built from that catalog and that libmeos: the Spark SQL and Flink SQL surfaces each answer 1306 SQL functions and 9375 overloads where main's answer 1305 and 9373, the 2 more the calls of dumpValues with and without its exclusion of the nodata pixels, each answering ARRAY<ARRAY>, and every other generated file is identical. codegen/src/test/java/JvmArrayShapeTest.java runs the generator over a function whose signature states its null mask and the function answering the length of its rows: on main it is refused as arity:jmeos on both surfaces, and here it answers an array of arrays of the rows of that length, NULL where the mask is true, freeing the mask with the array.

…e typed SQL surfaces

A signature returning a SQL array whose layout its wrapper gives beyond the C array, the catalog's arrayShape, is read by _array_shape_overload of tools/codegen_jvm.py: each element of the C array, NULL where the output array arrayShape names as nulls is true, and with a rowLength the elements cut into rows of the length the public function it names answers for the parameters it names, an array of arrays on both engines as PostgreSQL answers a two-dimensional array. dumpValues(raster, integer, boolean) answers a row of values per row of the raster, raster_width of it long, NULL for a nodata pixel, and frees the values and the mask raster_dump_values allocates.

Witness: over MobilityDB master 1a7a1a0e11 and MEOS-API master 90583fe, whose catalog states the arrayShape of dumpValues(raster, integer, boolean) since MEOS-API #208, main's generator refuses it on the typed Spark and Flink surfaces as arity:jmeos.

Measured over the same pair with the jar built from that catalog and that libmeos: the Spark SQL and Flink SQL surfaces each answer 1306 SQL functions and 9375 overloads where main's answer 1305 and 9373, the 2 more the calls of dumpValues with and without its exclusion of the nodata pixels, each answering ARRAY<ARRAY<DOUBLE>>, and every other generated file is identical. codegen/src/test/java/JvmArrayShapeTest.java runs the generator over a function whose signature states its null mask and the function answering the length of its rows: on main it is refused as arity:jmeos on both surfaces, and here it answers an array of arrays of the rows of that length, NULL where the mask is true, freeing the mask with the array.
@estebanzimanyi
estebanzimanyi merged commit 6b1a737 into MobilityDB:main Oct 25, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the codegen/array-null-mask-and-rows branch October 25, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant