Scan-plan reads prefetch Delta credentials and fail for masked native Iceberg tables
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 76/100
Direzione di ricerca
Start in src/storage/uc_table_entry.cpp at the USE_IRC_SCAN_PLAN branch and inspect the existing offline scan-plan mock and live scan-plan fixture. Add regression coverage using a non-file storage location, then verify that the query succeeds through the /plan endpoint without a /delta/v1/ request and returns the masked result.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When USE_IRC_SCAN_PLAN true is enabled, querying a native Iceberg table with a Unity Catalog column mask fails before the extension calls the server-side scan-planning endpoint.
UCTableEntry::GetScanFunction first calls TableInformation::RefreshCredentials. For a catalog-managed table, this requests credentials through the Unity Catalog Delta REST API:
/api/2.1/unity-catalog/delta/v1/catalogs/.../credentials
Databricks rejects that request for a table with fine-grained access controls because the Delta REST API does not support row filters or column masks. As a result, the intended Iceberg REST /plan request
is never made.
Removing the preliminary RefreshCredentials call allows the same query to use server-side scan planning successfully and returns the expected masked result.
Environment
- DuckDB: v2.0.0-dev85598 (eb620c77f8)
- unity_catalog: 91eff65972
- delta: 1419d1616f
- httpfs: 8103a11cc4
- Platform: macOS ARM64
- Databricks workspace with server-side scan planning enabled through Early Access
- External data access enabled
- Querying principal has EXTERNAL USE SCHEMA
The extensions were built from the current duckdb/unity_catalog main branch and statically linked.
Table setup
The source table is a native, catalog-managed Iceberg table:
CREATE TABLE <catalog>.<schema>.masked_iceberg_table
(
col0 INT,
col1 STRING
)
USING iceberg;
A Unity Catalog column mask was subsequently applied to col1.
The same principal can query the table successfully through Databricks SQL, where the expected masked value is returned.
Reproduction
Create the Unity Catalog secret:
CREATE SECRET uc (
TYPE unity_catalog,
TOKEN '<redacted>',
ENDPOINT 'https://<workspace-host>',
AWS_REGION 'us-east-1'
);
Attach the catalog with scan planning enabled:
ATTACH '<catalog>' AS uc_catalog (
TYPE unity_catalog,
SECRET 'uc',
DEFAULT_SCHEMA '<schema>',
READ_ONLY,
USE_IRC_SCAN_PLAN true
);
Query the masked native Iceberg table:
SELECT *
FROM uc_catalog.<schema>.masked_iceberg_table;
Actual behavior
The extension lists the catalog metadata successfully, but then requests Delta table credentials:
api.GetTableCredentials <catalog>.<schema>.masked_iceberg_table
op=READ managed=1
The request is sent to:
GET /api/2.1/unity-catalog/delta/v1/catalogs/<catalog>/schemas/<schema>/tables/masked_iceberg_table/credentials?operation=READ
Databricks returns:
HTTP 403
Table '<catalog>.<schema>.masked_iceberg_table' has row-level
security or column masks applied. The Delta REST API (/delta/v1)
does not support access to tables with fine-grained access control
policies. [ErrorCode: 5118]
No api-irc.PlanTableScan request is made.
Expected behavior
When the scan-plan path is selected, the extension should call the Iceberg REST scan-planning endpoint without first requesting credentials from the Delta REST API:
POST /api/2.1/unity-catalog/iceberg-rest/v1/catalogs/<catalog>/namespaces/<schema>/tables/masked_iceberg_table/plan
The scan-plan response supplies scoped, short-lived storage-credentials, which the extension already installs before binding the Parquet scan.
If scan planning fails and the table is Delta, the existing Delta fallback can obtain credentials when BuildDeltaScan is invoked.
Suspected cause
The scan-plan branch in src/storage/uc_table_entry.cpp currently begins with:
if (table.catalog.ShouldTryScanPlan() && !lookup_info.GetAtClause()) {
table.RefreshCredentials(context);
auto bd = make_uniq<UCScanPlanBindData>();
// ...
}
RefreshCredentials calls UCAPI::GetTableCredentials, which selects the Delta credentials endpoint for a catalog-managed table.
This credential prefetch appears redundant for scan-plan reads:
- UCAPI::PlanTableScan authenticates using the Unity Catalog token.
- The scan-plan response contains storage-credentials.
- UCScanPlanInitGlobal already creates scoped temporary secrets from those credentials before binding parquet_scan.
- BuildDeltaScan independently calls RefreshCredentials, so the Delta fallback retains its existing credential behavior.
Validated workaround
I locally removed the preliminary call:
if (table.catalog.ShouldTryScanPlan() && !lookup_info.GetAtClause()) {
- table.RefreshCredentials(context);
auto bd = make_uniq<UCScanPlanBindData>();
After rebuilding:
- The Delta credentials endpoint was no longer called before planning.
- The extension called api-irc.PlanTableScan.
- The query completed successfully through the Iceberg REST scan-plan path.
- The result contained the expected policy-masked value.
Test coverage observation
The existing offline scan-plan mock uses a file:// storage location. That causes RefreshCredentials to return early, so it does not expose this behavior.
The live scan-plan fixture is a catalog-managed Delta table without fine-grained access controls, so the preliminary Delta credential request succeeds there.
A regression test could:
- Serve a mock table with:
- data_source_format = "ICEBERG"
- A non-file:// storage location
- Return local Parquet files from the mock /plan response.
- Execute a query with USE_IRC_SCAN_PLAN true.
- Assert that the query succeeds.
- Assert that no request containing /delta/v1/ was made.
- Assert that the /plan endpoint was called.
- Lingua principale
- Python
- Stelle
- 111
- Fork
- 50
- Merge medio
- 1g 8h
- PR unite (30g)
- 9
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di duckdb/unity_catalog
-
DuckDB 2.0.1 rejected by Databricks Unity Catalog Delta API when creating/writing to a managed tableAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
duckdb/unity_catalog#174 ·
I maintainer di solito rispondono entro 1 giorno
-
Azure ADLS Gen2 Parquet reads/writes fail with HTTP 401 on UC-vended user delegation SAS (DuckDB 2.0.0)Forse già presa @dgokeeffe l’ha presa 11 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
duckdb/unity_catalog#170 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
duckdb/unity_catalog#116 · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
duckdb/unity_catalog#111 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
duckdb/unity_catalog#109 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di duckdb/unity_catalog
Issue simili
-
Live benchmark rejects an auth.json that has extra token keys, and the reason is never printedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
GanyuanRan/Aegis#112 ·
-
defect from-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
khuisman/mcp-gee-sweet#1669 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
marimo-team/marimo#12153 ·
I maintainer di solito rispondono entro 1 giorno
-
hr greet 平台明确拒绝后永久残留 pendingAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
can4hou6joeng4/boss-agent-cli#3290 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno