Skip to content

Commit

Permalink
Use Iceberg default name mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjo2144 committed Dec 2, 2021
1 parent a9fa389 commit 9d6fb5e
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import org.apache.iceberg.SchemaParser;
import org.apache.iceberg.Snapshot;
import org.apache.iceberg.Table;
import org.apache.iceberg.TableProperties;
import org.apache.iceberg.TableScan;
import org.apache.iceberg.Transaction;
import org.apache.iceberg.io.CloseableIterable;
Expand Down Expand Up @@ -181,14 +182,16 @@ public IcebergTableHandle getTableHandle(ConnectorSession session, SchemaTableNa
}
Optional<Long> snapshotId = getSnapshotId(table, name.getSnapshotId());

String nameMappingJson = table.properties().get(TableProperties.DEFAULT_NAME_MAPPING);
return new IcebergTableHandle(
tableName.getSchemaName(),
name.getTableName(),
name.getTableType(),
snapshotId,
TupleDomain.all(),
TupleDomain.all(),
ImmutableSet.of());
ImmutableSet.of(),
Optional.ofNullable(nameMappingJson));
}

@Override
Expand Down Expand Up @@ -732,7 +735,8 @@ public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(C
table.getSnapshotId(),
newUnenforcedConstraint,
newEnforcedConstraint,
table.getProjectedColumns()),
table.getProjectedColumns(),
table.getNameMappingJson()),
remainingConstraint.transformKeys(ColumnHandle.class::cast),
false));
}
Expand Down
Loading

0 comments on commit 9d6fb5e

Please sign in to comment.