Commit 0a58593
ARROW-11265: [Rust] Made bool not ArrowNativeType
This PR removes the risk of boolean values to be converted to bytes via `ToByteSlice` by explicitly making `ArrowNativeType` be only used in types whose in-memory representation in Rust equates to the in-memory representation in Arrow. `bool` in Rust is a byte and in Arrow it is a bit.
Overall, the direction of this PR is to have the traits represent one aspect of the type. In this case, `ArrowNativeType` is currently
* a type that has the same in memory representation (ToByteSlice is implemented for it)
* a json serializable type
* something that can be casted to/from `usize`.
This poses a problem because:
1. bools are serializable, not castable to usize, have different memory representation
2. fixed size (iX, uX) are serializable, castable to usize, have the same memory representation
3. fixed floating (f32, f64) are serializable, not castable to usize, have the same memory representation
however, they all implement `ArrowNativeType`.
This PR focus on splitting the json-serializable part of it.
Closes #9212 from jorgecarleitao/fix_trait
Authored-by: Jorge C. Leitao <[email protected]>
Signed-off-by: Andrew Lamb <[email protected]>1 parent 29cfed4 commit 0a58593
File tree
3 files changed
+52
-27
lines changed- rust/arrow/src
- compute/kernels
- util
3 files changed
+52
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
204 | | - | |
| 202 | + | |
| 203 | + | |
205 | 204 | | |
| 205 | + | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
207 | 214 | | |
208 | 215 | | |
209 | 216 | | |
| |||
225 | 232 | | |
226 | 233 | | |
227 | 234 | | |
228 | | - | |
| 235 | + | |
| 236 | + | |
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
| |||
246 | 254 | | |
247 | 255 | | |
248 | 256 | | |
249 | | - | |
| 257 | + | |
250 | 258 | | |
251 | 259 | | |
252 | 260 | | |
253 | 261 | | |
254 | 262 | | |
255 | | - | |
| 263 | + | |
256 | 264 | | |
257 | | - | |
| 265 | + | |
258 | 266 | | |
| 267 | + | |
259 | 268 | | |
| 269 | + | |
260 | 270 | | |
261 | 271 | | |
262 | 272 | | |
| |||
266 | 276 | | |
267 | 277 | | |
268 | 278 | | |
269 | | - | |
| 279 | + | |
270 | 280 | | |
271 | | - | |
| 281 | + | |
272 | 282 | | |
| 283 | + | |
273 | 284 | | |
| 285 | + | |
274 | 286 | | |
275 | 287 | | |
276 | 288 | | |
| |||
280 | 292 | | |
281 | 293 | | |
282 | 294 | | |
283 | | - | |
| 295 | + | |
284 | 296 | | |
285 | | - | |
| 297 | + | |
286 | 298 | | |
| 299 | + | |
287 | 300 | | |
| 301 | + | |
288 | 302 | | |
289 | 303 | | |
290 | 304 | | |
| |||
299 | 313 | | |
300 | 314 | | |
301 | 315 | | |
302 | | - | |
| 316 | + | |
303 | 317 | | |
304 | 318 | | |
305 | 319 | | |
| 320 | + | |
306 | 321 | | |
| 322 | + | |
307 | 323 | | |
308 | 324 | | |
309 | 325 | | |
| |||
318 | 334 | | |
319 | 335 | | |
320 | 336 | | |
321 | | - | |
| 337 | + | |
322 | 338 | | |
323 | | - | |
| 339 | + | |
324 | 340 | | |
| 341 | + | |
325 | 342 | | |
| 343 | + | |
326 | 344 | | |
327 | 345 | | |
328 | 346 | | |
| |||
332 | 350 | | |
333 | 351 | | |
334 | 352 | | |
335 | | - | |
| 353 | + | |
336 | 354 | | |
337 | | - | |
| 355 | + | |
338 | 356 | | |
| 357 | + | |
339 | 358 | | |
| 359 | + | |
340 | 360 | | |
341 | 361 | | |
342 | 362 | | |
| |||
346 | 366 | | |
347 | 367 | | |
348 | 368 | | |
349 | | - | |
| 369 | + | |
350 | 370 | | |
351 | | - | |
| 371 | + | |
352 | 372 | | |
| 373 | + | |
353 | 374 | | |
| 375 | + | |
354 | 376 | | |
355 | 377 | | |
356 | 378 | | |
| |||
360 | 382 | | |
361 | 383 | | |
362 | 384 | | |
363 | | - | |
| 385 | + | |
364 | 386 | | |
365 | | - | |
| 387 | + | |
366 | 388 | | |
| 389 | + | |
367 | 390 | | |
| 391 | + | |
368 | 392 | | |
369 | 393 | | |
370 | 394 | | |
| |||
374 | 398 | | |
375 | 399 | | |
376 | 400 | | |
377 | | - | |
| 401 | + | |
378 | 402 | | |
379 | 403 | | |
380 | 404 | | |
381 | 405 | | |
382 | 406 | | |
383 | | - | |
| 407 | + | |
384 | 408 | | |
385 | 409 | | |
386 | 410 | | |
387 | 411 | | |
388 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
389 | 416 | | |
390 | 417 | | |
391 | 418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
452 | | - | |
453 | | - | |
454 | | - | |
| 452 | + | |
455 | 453 | | |
456 | 454 | | |
457 | | - | |
| 455 | + | |
458 | 456 | | |
459 | 457 | | |
460 | 458 | | |
| |||
0 commit comments