Skip to content

TASK 12: Add Parquet mapping for GEOGRAPHY type#14

Open
davidchaava wants to merge 23 commits into
devfrom
task/geography-parquet-mapping
Open

TASK 12: Add Parquet mapping for GEOGRAPHY type#14
davidchaava wants to merge 23 commits into
devfrom
task/geography-parquet-mapping

Conversation

@davidchaava

Copy link
Copy Markdown
Collaborator

Adds Flink-Parquet support for the GEOGRAPHY logical type.

The mapping writes Flink GEOGRAPHY as Parquet BINARY with the native
GEOGRAPHY logical annotation and stores the raw ISO WKB payload without
Flink serializer framing. The vectorized reader maps Parquet GEOGRAPHY
back to Flink GEOGRAPHY and preserves WKB bytes.

This also updates the Parquet reader path to use Flink's ParquetInputFile
abstraction where needed for parquet-java 1.16+ compatibility, and adds a
focused round-trip test that verifies the Parquet annotation and WKB
readback.

@davidchaava davidchaava changed the title Task/geography parquet mapping Add Parquet mapping for GEOGRAPHY type Jun 19, 2026
@gkalashyan-akv
gkalashyan-akv force-pushed the task/geography-parquet-mapping branch 2 times, most recently from da986fc to 309e7e5 Compare June 24, 2026 14:43
@gkalashyan-akv gkalashyan-akv changed the title Add Parquet mapping for GEOGRAPHY type TASK 12: Add Parquet mapping for GEOGRAPHY type Jun 30, 2026
@gkalashyan-akv
gkalashyan-akv force-pushed the task/geography-parquet-mapping branch from 309e7e5 to 251e3bd Compare July 7, 2026 13:51
@gkalashyan-akv
gkalashyan-akv force-pushed the task/geography-parquet-mapping branch from 251e3bd to fe3bf24 Compare July 7, 2026 16:46
@talatuyarer

Copy link
Copy Markdown
Collaborator

EnrichedRowData that the wrapper the filesystem source uses to merge partition columns never got getGeography, so we will throw UnsupportedOperationException on any partitioned table.

@talatuyarer

Copy link
Copy Markdown
Collaborator

Parquet writer uses native geographyType() annotation, but readers never look at it: files with a different CRS, GEOMETRY (planar) annotation, or plain unannotated BINARY all silently load as spherical GEOGRAPHY, and spec-valid 3D WKB (type 1001) is rejected as malformed.

/** Utilities for converting GEOGRAPHY values to and from portable OGC encodings. */
@Internal
final class GeographyConversionUtils {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeographyConversionUtils shares static WKBReader/WKBWriter/WKTReader/WKTWriter across all task threads; JTS readers/writers hold per-call mutable state, so concurrent ST_* calls can produce corrupted geometries or spurious parse errors.


this.fileSchema = footer.getFileMetaData().getSchema();
ParquetReadOptions parquetReadOptions =
ParquetReadOptions.builder()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

builds bare ParquetReadOptions instead of HadoopReadOptions.builder(conf), dropping encryption, checksum, and filter settings for all Parquet reads, and leaks the file stream when schema checks throw.


<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let use shading with jts-core. It is bundled into the flink-table-runtime fat jar without relocation, inviting classpath clashes with user geospatial jars.

BuiltInSqlFunction.newBuilder()
.name(BuiltInFunctionDefinitions.ST_ASTEXT.getName())
.returnType(VARCHAR_FORCE_NULLABLE)
.operandTypeChecker(OperandTypes.family(SqlTypeFamily.ANY))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ST_* operator-table entries accept SqlTypeFamily.ANY, so ST_ASTEXT(42) passes the validator and dies later in codegen.

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.

3 participants