Skip to content

Read a pointer field of the structures a set of rows returns as a value of its column - #194

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/geometry-field-column
Oct 25, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/geometry-field-column

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

A column of a set-returning function reading a pointer field of the structures the function returns reads it through _setret_column of tools/codegen_jvm.py as a value of the column's SQL type, encoded by its value class from the pointer at the field's offset in the element of its row, NULL for a null pointer (MeosSqlRuntime.orNull). The function allocates each such value apart, and the eval frees the field of each element before the array (MeosSqlRuntime.freeField, written by _free_each beside the freeEach of an array of pointers): dumpAsPolygons(raster, integer, boolean) answers the geom and the val of each GeomVal and frees them as geomval_arr_free does.

Witness: over MobilityDB master 1a7a1a0e11 and the catalog of MEOS-API #206, which states the columns of dumpAsPolygons from the fields of each GeomVal, main's generator refuses dumpAsPolygons on the typed Spark and Flink surfaces as setret:column/return:geometry.

Measured with the jar of JMEOS main: over that catalog the Spark SQL and Flink SQL surfaces each answer 1304 SQL functions and 9370 overloads where main's answer 1303 and 9367, the 3 more the calls of dumpAsPolygons with and without its band and its exclusion of the nodata pixels; over MEOS-API master's catalog every generated file is identical but MeosSqlRuntime, which carries freeField and orNull. codegen/src/test/java/JvmStructFieldColumnTest.java runs the generator over a function whose rows read a GSERIALIZED pointer field and a double: on main it is refused as setret:column/return:geometry on both surfaces, and here each row reads the geometry through its value class and the eval frees the field of each element before the array.

…ue of its column

A column of a set-returning function reading a pointer field of the structures the function returns reads it through _setret_column of tools/codegen_jvm.py as a value of the column's SQL type, encoded by its value class from the pointer at the field's offset in the element of its row, NULL for a null pointer (MeosSqlRuntime.orNull). The function allocates each such value apart, and the eval frees the field of each element before the array (MeosSqlRuntime.freeField, written by _free_each beside the freeEach of an array of pointers): dumpAsPolygons(raster, integer, boolean) answers the geom and the val of each GeomVal and frees them as geomval_arr_free does.

Witness: over MobilityDB master 1a7a1a0e11 and the catalog of MEOS-API #206, which states the columns of dumpAsPolygons from the fields of each GeomVal, main's generator refuses dumpAsPolygons on the typed Spark and Flink surfaces as setret:column/return:geometry.

Measured with the jar of JMEOS main: over that catalog the Spark SQL and Flink SQL surfaces each answer 1304 SQL functions and 9370 overloads where main's answer 1303 and 9367, the 3 more the calls of dumpAsPolygons with and without its band and its exclusion of the nodata pixels; over MEOS-API master's catalog every generated file is identical but MeosSqlRuntime, which carries freeField and orNull. codegen/src/test/java/JvmStructFieldColumnTest.java runs the generator over a function whose rows read a GSERIALIZED pointer field and a double: on main it is refused as setret:column/return:geometry on both surfaces, and here each row reads the geometry through its value class and the eval frees the field of each element before the array.
@estebanzimanyi
estebanzimanyi merged commit 6e69f4a into MobilityDB:main Oct 25, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the codegen/geometry-field-column branch October 25, 2026 22:05
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