Commit 200201d
committed
Address PR review: robust guard test + preserve client.py re-exports
Follow-up to the lazy-thrift change addressing two review-bot findings.
Medium (test robustness / CI false-positive): the guard test's child
subprocess exited with code 1 on any failure, which is also Python's
generic uncaught-exception code -- so an import failure was
indistinguishable from "thrift was imported". This caused a false CI
failure: in the "default deps" job (no pyarrow), importing
`kernel.type_mapping` raises `ModuleNotFoundError: pyarrow` (exit 1),
which the test misread as a thrift leak. It was also a false *pass* risk
for the Thrift-backend counterpart test. The child now emits dedicated
sentinel exit codes only after the import completes, captures stderr,
and reports import failure separately; the parametrized test skips
modules that can't import due to a missing optional dependency (rather
than failing), while still detecting a genuine thrift leak.
Low (back-compat): `client.py`'s `__getattr__` only re-exported
`ThriftDatabricksClient`. Extend it to also lazily resolve the other
names `client.py` historically exposed as importable
(`ThriftResultSet`, `TOpenSessionResp`, `TSparkParameter`,
`TOperationState`), so `from databricks.sql.client import <name>` keeps
working without importing the `thrift` package at module load.
Verified: importing `databricks.sql.client` still loads zero thrift
modules; touching any re-export resolves correctly (and only then pulls
thrift). Guard test passes with full deps (14/14) and correctly skips
the kernel modules when pyarrow/kernel are absent.
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
Co-authored-by: Isaac
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>1 parent 5ea26c2 commit 200201d
2 files changed
Lines changed: 106 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
28 | 61 | | |
29 | 62 | | |
30 | 63 | | |
31 | | - | |
32 | | - | |
33 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
34 | 77 | | |
35 | 78 | | |
36 | | - | |
37 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
38 | 89 | | |
39 | | - | |
40 | | - | |
| 90 | + | |
| 91 | + | |
41 | 92 | | |
42 | | - | |
| 93 | + | |
43 | 94 | | |
44 | 95 | | |
45 | 96 | | |
| |||
69 | 120 | | |
70 | 121 | | |
71 | 122 | | |
72 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
73 | 138 | | |
74 | 139 | | |
75 | 140 | | |
| |||
83 | 148 | | |
84 | 149 | | |
85 | 150 | | |
86 | | - | |
87 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
88 | 162 | | |
89 | 163 | | |
90 | 164 | | |
0 commit comments