Commit f88de8c
committed
fix(params): correct DATE and large-number parameter type inference
Two driver-side parameter-binding bugs surfaced by the SEA parity suite
(the kernel binds (value_str, sql_type) faithfully — the defects are in
how DBSQLParameter stringifies/types the value):
- A JS `number` that is whole but outside the INT (i32) range was typed
INTEGER, so e.g. `1e30` was rejected by the server as
`invalid INT literal "1e+30"`. inferNumberType now picks the narrowest
fitting type: INTEGER within i32, BIGINT within the safe-integer range,
DOUBLE otherwise (and for non-integers).
- A JS `Date` bound with an explicit DATE type was stringified with the
full ISO-8601 timestamp (`...T00:00:00.000Z`), which the SEA wire
rejects as a DATE literal ("trailing input"). It now projects the
calendar date (`yyyy-mm-dd`); the no-explicit-type path still binds a
Date as a full TIMESTAMP.
Both paths are shared by the Thrift and SEA backends; the changes only
affect values that the previous logic mis-typed (and which the server
rejected), so existing behaviour is preserved. Unit tests added for the
magnitude-based integer inference and the DATE projection.
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>1 parent cf1c1bb commit f88de8c
2 files changed
Lines changed: 83 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 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 | + | |
| 61 | + | |
| 62 | + | |
32 | 63 | | |
33 | 64 | | |
34 | 65 | | |
| |||
78 | 109 | | |
79 | 110 | | |
80 | 111 | | |
81 | | - | |
| 112 | + | |
82 | 113 | | |
83 | 114 | | |
84 | 115 | | |
| |||
96 | 127 | | |
97 | 128 | | |
98 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
99 | 136 | | |
100 | 137 | | |
101 | 138 | | |
102 | 139 | | |
103 | | - | |
| 140 | + | |
104 | 141 | | |
105 | 142 | | |
106 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
127 | 171 | | |
0 commit comments