deniskuzZ commented on code in PR #6789:
URL: https://github.com/apache/hive/pull/6789#discussion_r4313924418
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/mapreduce/IcebergInputFormat.java:
##########
@@ -157,27 +162,45 @@ private static <T extends Scan<T, FileScanTask,
CombinedScanTask>> T applyConfig
@Override
public List<InputSplit> getSplits(JobContext context) {
Configuration conf = context.getConfiguration();
- Table table = Optional
- .ofNullable(HiveTableUtil.deserializeTable(conf,
conf.get(InputFormatConfig.TABLE_IDENTIFIER)))
- .orElseGet(() -> {
- Table tbl = Catalogs.loadTable(conf);
- conf.set(InputFormatConfig.TABLE_IDENTIFIER, tbl.name());
- // planning-local conf only (never shipped): for credential-vending
catalogs the loaded
- // table's FileIO carries secrets, which must not reach a serialized
job configuration
- conf.set(InputFormatConfig.SERIALIZED_TABLE_PREFIX + tbl.name(),
SerializationUtil.serializeToBase64(tbl));
- return tbl;
- });
+ String tableIdentifier = conf.get(InputFormatConfig.TABLE_IDENTIFIER);
+ Table serializedTable = HiveTableUtil.deserializeTable(conf,
tableIdentifier);
+
final ExecutorService workerPool =
ThreadPools.newFixedThreadPool("iceberg-plan-worker-pool",
conf.getInt(SystemConfigs.WORKER_THREAD_POOL_SIZE.propertyKey(),
ThreadPools.WORKER_THREAD_POOL_SIZE));
try {
- return planInputSplits(table, conf, workerPool);
+ if (HiveTableUtil.shouldReloadForServerSideScanPlanning(conf,
serializedTable)) {
+ String catalogName = HiveTableUtil.resolveCatalogName(conf);
+ try (CloseableRestCatalog catalog = CloseableRestCatalog.load(conf,
catalogName)) {
+ Table planningTable = catalog.loadTable(tableIdentifier);
+ HiveTableUtil.checkAndSetIoConfig(conf, planningTable);
+ return planInputSplits(planningTable, conf, workerPool,
tableIdentifier, serializedTable);
Review Comment:
on the server path `planInputSplits` gets the live `planningTable`, and
`generateInputSplits` builds the grouping key from it:
`Partitioning.groupingKeyType(table.schema().select(cols),
table.specs().values())`.
Everything else uses the compile-time serialized table. If a grouping column
is renamed/dropped, or a spec without that field is added between compile and
split time, this either fails or changes the grouping key.
Could `generateInputSplits` use `serverSidePinTable` (when non-null) for
schema/specs? - follow up PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]