Skip to content

v3.5.7: pgduck: expose BuildIcebergReadConversion (#680)

Latest

Choose a tag to compare

@sfc-gh-okalaci sfc-gh-okalaci released this 12 Oct 13:59
Iceberg stores an INTERVAL as a struct of months/days/microseconds and a
TIMETZ as a UTC-normalized TIME.  BuildIcebergReadConversion builds the
DuckDB expression that lifts those leaves back to the types PostgreSQL
expects, recursing through arrays, composites, maps and domains.  The read
path applies it to anything projected through TupleDescToProjectionList.

A caller that reads the CSV files directly, building its own query rather
than going through that projection, has no way to apply the conversion
itself.  Its input functions then get the storage form: interval_in receives
"(38,5,14706789000)", and a TIMETZ stripped to a bare TIME is reinterpreted
against the caller session's TimeZone, shifting the instant by that
session's offset without raising anything -- a silent wrong answer, and one
that is invisible on a UTC cluster.

Declare it in read_data.h so such a caller can build the same expression the
read path builds.  The body and both in-repo callers are unchanged, so this
adds visibility rather than code.

Signed-off-by: Amy Zheng <amy.zheng@snowflake.com>
(cherry picked from commit 74626e92360edcb9aed893a2fe3cb3903a3086c3)