-
Notifications
You must be signed in to change notification settings - Fork 3k
[SPEC | CORE] : Allow table level override for scan planning #14867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,7 +166,6 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog | |
| private MetricsReporter reporter = null; | ||
| private boolean reportingViaRestEnabled; | ||
| private Integer pageSize = null; | ||
| private boolean restScanPlanningEnabled; | ||
| private CloseableGroup closeables = null; | ||
| private Set<Endpoint> endpoints; | ||
| private Supplier<Map<String, String>> mutationHeaders = Map::of; | ||
|
|
@@ -281,12 +280,6 @@ public void initialize(String name, Map<String, String> unresolved) { | |
| RESTCatalogProperties.NAMESPACE_SEPARATOR, | ||
| RESTUtil.NAMESPACE_SEPARATOR_URLENCODED_UTF_8); | ||
|
|
||
| this.restScanPlanningEnabled = | ||
| PropertyUtil.propertyAsBoolean( | ||
| mergedProps, | ||
| RESTCatalogProperties.REST_SCAN_PLANNING_ENABLED, | ||
| RESTCatalogProperties.REST_SCAN_PLANNING_ENABLED_DEFAULT); | ||
|
|
||
| this.tableCache = createTableCache(mergedProps); | ||
| this.closeables.addCloseable(this.tableCache); | ||
|
|
||
|
|
@@ -584,7 +577,7 @@ private Supplier<BaseTable> createTableSupplier( | |
|
|
||
| trackFileIO(ops); | ||
|
|
||
| RESTTable table = restTableForScanPlanning(ops, identifier, tableClient); | ||
| RESTTable table = restTableForScanPlanning(ops, identifier, tableClient, tableConf); | ||
| if (table != null) { | ||
| return table; | ||
| } | ||
|
|
@@ -595,9 +588,35 @@ private Supplier<BaseTable> createTableSupplier( | |
| } | ||
|
|
||
| private RESTTable restTableForScanPlanning( | ||
| TableOperations ops, TableIdentifier finalIdentifier, RESTClient restClient) { | ||
| // server supports remote planning endpoint and server / client wants to do server side planning | ||
| if (endpoints.contains(Endpoint.V1_SUBMIT_TABLE_SCAN_PLAN) && restScanPlanningEnabled) { | ||
| TableOperations ops, | ||
| TableIdentifier finalIdentifier, | ||
| RESTClient restClient, | ||
| Map<String, String> tableConf) { | ||
| // Get client-side and server-side scan planning modes | ||
| String planningModeClientConfig = properties().get(RESTCatalogProperties.SCAN_PLANNING_MODE); | ||
| String planningModeServerConfig = tableConf.get(RESTCatalogProperties.SCAN_PLANNING_MODE); | ||
|
|
||
| // Validate that client and server configs don't conflict | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a choice here. We can either hard fail on conflicting configs like is done below or we can just let one override the other. I think the least surprising thing from a client perspective is to just override using the client config in case of conflicts. On average I don't expect people to be fiddling with this config. In the chance they do, they're probably intentionally trying to set it and we should attempt to respect that. Even if there's some FGAC and creds and all aren't returned and it fails later on, that's better to me. I guess I could go either way here (as long as we log there's a conflict and we're overriding using some mechanism), but I think any approach seems better than just hard failing since that seems unneccessary.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It can cause an issue in a sense that let say i am low resource client i can't run scan planning at all, so i say use catalog and the catalog says do client ? i believe if we let catalog judgement win it may lead to failure ? |
||
| // Only validate if BOTH are explicitly set (not null) | ||
| if (planningModeClientConfig != null && planningModeServerConfig != null) { | ||
| Preconditions.checkState( | ||
| planningModeClientConfig.equalsIgnoreCase(planningModeServerConfig), | ||
| "Scan planning mode mismatch for table %s: client config=%s, server config=%s", | ||
| finalIdentifier, | ||
| planningModeClientConfig, | ||
| planningModeServerConfig); | ||
| } | ||
|
|
||
| // Determine effective mode: prefer server config if present, otherwise use client config | ||
| String effectiveModeConfig = | ||
| planningModeServerConfig != null ? planningModeServerConfig : planningModeClientConfig; | ||
| RESTCatalogProperties.ScanPlanningMode effectiveMode = | ||
| effectiveModeConfig != null | ||
| ? RESTCatalogProperties.ScanPlanningMode.fromString(effectiveModeConfig) | ||
| : RESTCatalogProperties.ScanPlanningMode.CLIENT; | ||
|
|
||
| if (effectiveMode == RESTCatalogProperties.ScanPlanningMode.SERVER | ||
| && endpoints.contains(Endpoint.V1_SUBMIT_TABLE_SCAN_PLAN)) { | ||
| return new RESTTable( | ||
| ops, | ||
| fullTableName(finalIdentifier), | ||
|
|
@@ -610,6 +629,8 @@ private RESTTable restTableForScanPlanning( | |
| properties(), | ||
| conf); | ||
| } | ||
|
|
||
| // Default to client-side planning | ||
| return null; | ||
| } | ||
|
|
||
|
|
@@ -683,7 +704,7 @@ public Table registerTable( | |
|
|
||
| trackFileIO(ops); | ||
|
|
||
| RESTTable restTable = restTableForScanPlanning(ops, ident, tableClient); | ||
| RESTTable restTable = restTableForScanPlanning(ops, ident, tableClient, tableConf); | ||
| if (restTable != null) { | ||
| return restTable; | ||
| } | ||
|
|
@@ -952,7 +973,7 @@ public Table create() { | |
|
|
||
| trackFileIO(ops); | ||
|
|
||
| RESTTable restTable = restTableForScanPlanning(ops, ident, tableClient); | ||
| RESTTable restTable = restTableForScanPlanning(ops, ident, tableClient, tableConf); | ||
| if (restTable != null) { | ||
| return restTable; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.