feat(sea): per-statement metricViewMetadata knob on ExecuteStatementOptions#397
feat(sea): per-statement metricViewMetadata knob on ExecuteStatementOptions#397msrathore-db wants to merge 2 commits into
Conversation
…ntOptions Add `metricViewMetadata?: boolean` to `ExecuteStatementOptions`. When true, the Thrift backend forwards `spark.databricks.optimizer.enableMetricViewMetadata=true` via the request `confOverlay`, alongside any `query_tags` already serialized there. The option is per-statement only and does not persist across queries. The SEA backend will route the same key through napi `statementConf` once the kernel statement-options surface lands; until then the option is honored only on Thrift. Documented in the public option JSDoc so users do not silently lose the conf on SEA. Unit tests assert the option appears in the outgoing `TExecuteStatementReq` when set, is omitted when unset or `false`, and coexists with `queryTags` in the same `confOverlay`. Audit refs: rows 1.17 and 2.18 of sea-workflow/audits/2026-05-28-cross-driver-audit.md (F12 in the PR #347 audit). Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
Independent devils-advocate self-review (cold-eye, no author context)Verdict: no HIGH or CRITICAL findings; merge-ready pending human reviewer sign-off. Two LOW notes captured for transparency: L1 (semantic — accept-as-designed): L2 (forward-reference): The JSDoc mentions "this knob is honored only on the Thrift backend", which forward-references the SEA backend that does not exist on Verified against PR-A diff at head: pattern existence, test count (4/4 new tests pass), order-of-operations w.r.t. existing Cross-checks performed: lint clean, type-check clean (pre-existing failures in This pull request and its description were written by Isaac. |
Address DA review note N4 on PR #397: the public type is `boolean` (not `true`-literal), but the wiring treats `false` and omitted identically. Spell that out in the JSDoc so callers don't expect `false` to clear a server-side default. Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
Summary
Adds an explicit
metricViewMetadata?: booleanknob toExecuteStatementOptions. Whentrue, the Thrift backend forwardsspark.databricks.optimizer.enableMetricViewMetadata=truevia the outgoingTExecuteStatementReq.confOverlay, scoped to a single statement.This is the C7 (metric-view-metadata) cluster of the autonomous Thrift↔SEA parity drive — audit refs:
sea-workflow/audits/2026-05-28-cross-driver-audit.md— Path forward: "explicitmetricViewMetadataknob onExecuteStatementOptions(not just session-level)."What changed
lib/contracts/IDBSQLSession.ts: newmetricViewMetadata?: booleanfield onExecuteStatementOptionswith JSDoc explaining the per-statement scope and the SEA wiring gap.lib/DBSQLSession.ts: when the option istrue, merge the Spark conf key intorequest.confOverlayalongside anyquery_tagsalready serialized there.tests/unit/DBSQLSession.test.ts: four unit tests covering set / unset / explicit-false / coexists-with-queryTags.SEA wiring
The SEA backend will route the same key through napi
statementConfonce the kernel statement-options surface lands (kernel PR #75 + NodeJS PR #393). Until then the option is honored only on Thrift; the public JSDoc states this so users do not silently lose the conf on SEA. Cross-driver round-trip is exercised in the companion driver-test PR.Test plan
npm test -- tests/unit/DBSQLSession.test.ts— all 4 new tests pass; the only failing test (canDecompressLZ4Resultat line 235) is a pre-existing failure on origin/main, unrelated to this change.npm run lint— clean.databricks/databricks-driver-test#NNN), whereBackendComparator.forEachBackendexercises both Thrift and SEA legs against the pecotesting warehouse withDATABRICKS_PECOTESTING_TOKEN_PERSONAL.python-sea-oracleagent has been asked to verifystatement_conf={"spark.databricks.optimizer.enableMetricViewMetadata": "true"}round-trips onuse_sea=True; reply pending.Notes
Co-authored-by: Isaactrailer on the commit.SET <key>on the same session after the call.