GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Escape `_` in metadata catalog_name by default (behavior change) by vuanhphung · Pull Request #1029 · databricks/databricks-sql-python Conversation
|
| call | Thrift unescaped (main) | Thrift escaped (this PR) | kernel (main) | kernel (this PR) |
|---|---|---|---|---|
schemas(cat, "%") |
273 (432) | 106 (146) | 118 (141) | 116 (133) |
schemas(cat, "def%") |
267 (300) | 104 (154) | 114 (162) | 113 (162) |
tables(cat, "default", "%") |
335 (384) | 175 (262) | 448 (513) | 172 (235) |
columns(cat, "default", "customer", "%") |
271 (337) | 104 (158) | 113 (135) | 115 (186) |
columns(cat, "%", "%", "%") |
448 (601) | 253 (292) | 279 (347) | 283 (350) |
control: schemas("peco", "def%"), no _ |
288 (357) | 294 (407) | 297 (351) | 303 (385) |
The unit tests now state the expected default explicitly, and the backend-level forwarding tests assert the escaped name. The full unit suite and -m realkernel pass. New e2e tests run on Thrift and kernel:
syste_ matches nothing by default and matches system with the opt-out.\_.hive_metastore schemas()/tables() (Thrift) and tables() (kernel) return the same rows with and without escaping, and spark_catalog loses no rows.The new e2e tests fail on main and pass here. The existing Thrift and kernel metadata e2e tests also pass on the live warehouse.
This pull request and its description were written by Isaac.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Behavior change: escape_catalog_name now defaults to True, so `_` in catalog_name is no longer a single-character wildcard for Thrift schemas()/tables()/columns() or kernel tables(). `%` still works, and escape_catalog_name=False restores the old behavior. This follows the JDBC/ODBC metadata spec (catalog is an exact name) and the Databricks JDBC driver's default since v3.3.1. The server treats Thrift catalogName as a LIKE pattern, so an unescaped `_` returned rows from other catalogs (comparator-tests for comparator_tests) and made the server scan every catalog (~170 ms per call on underscore catalogs). Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Verdict: 2 Low
Looks good, with two low-severity points. The new default is applied the same way at all three sites (Thrift, kernel client, session forwarding), and the unit and e2e tests cover the default, opt-out and opt-in cases. The two findings are an opt-out check that a string like "false" doesn't actually disable, and a tables() docstring that is less precise than the others.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Verdict: 1 Medium
The default flip itself looks right: all three default sites (Thrift, kernel client, session forwarding) are updated together, and the docs and tests agree with the new default. I have one medium concern. The new e2e test skips hive_metastore, which is the most common catalog name with _, so nothing checks that escaping it by default doesn't break metadata calls on that catalog.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…g names Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Verdict: 1 Low · 1 Nit
The default flip looks correct, and docs, CHANGELOG and tests were all updated consistently. I found two low-severity issues: an explicit escape_catalog_name=None (or a string value) now resolves differently from the new default, and the spark_catalog e2e assertion can't fail on the improvement the PR claims. A nit outside this diff: the regex in escape_metadata_catalog_name uses a one-character lookbehind (it ignores whether the preceding backslash run is even or odd), and that approximation now runs on every catalog name by default.
schemas(catalog_name="spark_catalog") resolve to hive_metastore, where before it returned nothing. This assertion (rows(raw, ...) <= rows(escaped, ...)) passes trivially when both sides are empty. It also passes if escaping still returns nothing for spark_catalog, so it never checks the improvement the PR claims. If that behavior is meant to be guaranteed, also assert that the escaped result is non-empty (skip when hive_metastore.default isn't visible, as the earlier block already does).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
An explicit None (e.g. from a wrapper forwarding unset options) used to match the old False default; keep it meaning "not set" now that the default is True. Also assert that escaped spark_catalog resolves. Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
|
Review-body nits from the round on ed49b2e:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ No issues identified by the review bot.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
268b6bcd
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.