Repository navigation
Conversation
7e54757 to
769a954
Compare
|
There were already discussions happening under HIVE-29599 for server side planning? |
769a954 to
3ef3d65
Compare
This is different - this PR is about adding client-side support. |
tanishq-chugh
left a comment
There was a problem hiding this comment.
Hi @difin
Checked out the PR, great improvement 🚀
| */ | ||
| public static Table resolveTableForScanPlanning(Configuration conf, String tableIdentifier) { | ||
| if (shouldReloadForServerSideScanPlanning(conf)) { | ||
| Table table = Catalogs.loadTable(conf); |
There was a problem hiding this comment.
I believe this will create a new RestCatalog Object/HttpClient on every call, curious if this can cause any connection leak?
There was a problem hiding this comment.
Yes - Catalogs.loadTable creates a new REST catalog (and HTTP client) on each call, and we don’t close it on this path today. That’s the same pattern as other Catalogs.loadTable usages in the handler. Here it runs once per getSplits during split planning, not per input split. A reload only happens when shouldReloadForServerSideScanPlanning is true.
8ef09d9 to
0db254a
Compare
0db254a to
e4ef113
Compare
| return HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_ICEBERG_REST_SCAN_PLANNING_MODE); | ||
| } | ||
|
|
||
| public static void setHiveRestScanPlanningMode(Configuration conf, String mode) { |
| /** | ||
| * Returns true when the catalog is configured for server-side scan planning and the Hive feature flag is on. | ||
| */ | ||
| public static boolean requestsServerSidePlanning(String catalogName, Configuration conf) { |
There was a problem hiding this comment.
requestsServerSideScanPlanning ? idk or simplify other namings
There was a problem hiding this comment.
renamed to isServerSidePlanningEnabled - meaning both catalog properties include server mode and Hive feature flag is enabled.
| } | ||
|
|
||
| /** | ||
| * Returns true when catalog properties should be copied into the Tez/MR job configuration so |
There was a problem hiding this comment.
Thanks for catching the typo, fixed.
| IcebergCatalogProperties.getCatalogType(conf, resolvedCatalogName))) { | ||
| return false; | ||
| } | ||
| return requestsServerSidePlanning(resolvedCatalogName, conf); |
There was a problem hiding this comment.
weird. method name is validate (shouldPropagateCatalogPropertiesToJob) but it calls requestsServerSidePlanning? could we improve/refactor?
There was a problem hiding this comment.
Renamed both the call site's method and the method it calls.
| return; | ||
| } | ||
|
|
||
| if (!shouldPropagateCatalogPropertiesToJob(catalogName, sessionConf)) { |
There was a problem hiding this comment.
should we call shouldPropagateCatalogPropertiesToJob before propagateCatalogPropertiesToJob and short circuit?
| * Called from {@code configureJobConf} so split generation sees catalog URI/type/scan-planning-mode | ||
| * even when job properties were not copied yet. | ||
| */ | ||
| public static void propagateCatalogPropertiesToJob( |
There was a problem hiding this comment.
looks like duplicate. maybe use BinaryOperator to hadle both Map and jobConf, see boolean isV2TableOrAbove(BinaryOperator<String> props)
There was a problem hiding this comment.
Addressed the duplication with a single private path and thin Map / JobConf overloads (BiConsumer, same idea as the two isV2TableOrAbove overloads). BinaryOperator doesn’t seem to fit here: in isV2TableOrAbove it’s get-with-default; here we need put-if-absent.
| return; | ||
| } | ||
|
|
||
| if (!shouldPropagateCatalogPropertiesToJob(resolvedCatalogName, sessionConf)) { |
There was a problem hiding this comment.
again repeated check. why is it inside action
| }); | ||
| } | ||
|
|
||
| private interface PropertyConsumer { |
There was a problem hiding this comment.
why invent the wheel, can't we use BiConsumer?
| if (tableIdentifier == null) { | ||
| conf.set(InputFormatConfig.TABLE_IDENTIFIER, executorTableId); | ||
| } | ||
| if (conf.get(InputFormatConfig.SERIALIZED_TABLE_PREFIX + executorTableId) == null) { |
There was a problem hiding this comment.
can we extract to local var not to repeat in set?
|



What changes were proposed in this pull request?
Hive wires up Iceberg REST server-side scan planning: when
scan-planning-mode=server, split planning can go through the REST catalog (POST /plan) instead of only the serialized table snapshot on Tez/MR workers. Adds a smallRestCatalogScanPlanninghelper for config and copying catalog settings into job conf, and updates the Iceberg storage handler / input path to reload a live REST table on executors where appropriate. Tests cover configuration, job propagation, and embedded REST planning behavior.Why are the changes needed?
Iceberg REST catalogs can plan scans on the catalog service instead of on every client. That keeps planning close to authoritative metadata and catalog credentials, can reduce work on HiveServer2 and task containers, and lets the REST service apply catalog-side optimizations as Iceberg evolves.
Hive today mostly plans reads from a serialized table snapshot shipped in the job configuration, which fits local/Hadoop catalogs but does not use the REST server’s planning API. For deployments that already run a REST catalog with scan planning, operators expect
scan-planning-mode=serverto work for Hive queries on Tez/MR - not only for single-node Iceberg clients. This change closes that gap so Hive participates in the same server-side planning model as the rest of the Iceberg REST ecosystem.Does this PR introduce any user-facing change?
Yes. For REST Iceberg catalogs, operators can set
iceberg.catalog.<catalog>.scan-planning-mode=server(viahive-site.xmlor session SET) alongside existing REST catalog properties. When enabled, read jobs that use the Iceberg input format can use server-side scan planning instead of local planning from the serialized snapshot. Default behavior is unchanged when the property is unset or not server. Hive and non-REST catalogs are unaffected.How was this patch tested?
TestRestCatalogScanPlanning— Tests config keys, server-mode detection, job propagation gating and copying.TestRestCatalogScanPlanningServerIT— Uses embedded REST catalog; Verifies thatRESTTable/RESTTableScanandPlanTableScanRequest on planTasks()are used when file planning is on.TestHiveIcebergServerSideScanPlanning— Checks that Hive only reloads a table from the REST catalog for split planning when server mode is on and it is safe to do so - not when planning stays local or when the job must use uncommitted metadata from the same transaction.TestHiveIcebergServerSideScanPlanningServerIT— Tests that executor job conf with/without propagated catalog props and table reload over REST.