Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pg_lake_engine/include/pg_lake/pgduck/read_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ extern PGDLLEXPORT char *TupleDescToProjectionList(TupleDesc tupleDesc,
bool addCast,
DataFileSchema * storageSchema);

/*
* Returns a DuckDB expression converting every INTERVAL and TIMETZ leaf in
* `expression` from its Iceberg storage representation to the surface type
* PostgreSQL expects, or NULL when none is needed. Recurses through arrays,
* composites, maps and domains. Applied automatically by
* TupleDescToProjectionList; declared here for callers that build their own
* query over Iceberg-format data.
*/
extern PGDLLEXPORT char *BuildIcebergReadConversion(const char *expression,
Oid typeOid, int32 typmod);

extern PGDLLEXPORT char *TupleDescToDuckDBColumnsMap(TupleDesc tupleDesc,
CopyDataFormat sourceFormat,
bool preferVarchar,
Expand Down
7 changes: 4 additions & 3 deletions pg_lake_engine/src/pgduck/read_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ static char *BuildColumnProjection(char *expression,
static bool TypeNeedsIcebergReadConversion(Oid typeOid);
static void AppendIcebergReadConversion(StringInfo buf, const char *expression,
Oid typeOid, int32 typmod, int depth);
static char *BuildIcebergReadConversion(const char *expression, Oid typeOid,
int32 typmod);
static char *BuildStorageToSurfaceProjection(const char *columnName,
Oid columnTypeId, int32 columnTypeMod,
DuckDBTypeInfo duckdbType,
Expand Down Expand Up @@ -1300,8 +1298,11 @@ AppendIcebergReadConversion(StringInfo buf, const char *expression,
* BuildIcebergReadConversion returns a DuckDB expression that converts all
* native-type leaves in expression from their Iceberg representation to their
* PostgreSQL/DuckDB surface type, or NULL when no conversion is required.
*
* Declared in read_data.h so a caller building its own query over
* Iceberg-format data can apply the same conversion the read path applies.
*/
static char *
char *
BuildIcebergReadConversion(const char *expression, Oid typeOid, int32 typmod)
{
StringInfoData conversion;
Expand Down
Loading