Uh oh!
There was an error while loading. Please reload this page.
ARROW-8221: [Python][Dataset] Expose schema inference/validation factory options through the validate_schema keyword - #8912
Conversation
There was a problem hiding this comment.
Do datasets guarantee that the first file in alphabetical order is used to infer the schema?
There was a problem hiding this comment.
Yes, the file paths get sorted:
arrow/cpp/src/arrow/dataset/discovery.cc
Line 205 in 48fee66
(now, whether this should maybe rather be a "natural" sort is another issue ..)
lidavidm
commented
Apr 12, 2021
Is this still targeted for 4.0? It needs a rebase if so, but otherwise looks good. |
…ctory options through the validate_schema keyword
0422334 to
1839de0Comparejorisvandenbossche
commented
Apr 15, 2021
Rebased now. @lidavidm I am still a bit in doubt about the exact API. |
lidavidm
commented
Apr 15, 2021
Naming it
|
pitrou
commented
Jun 23, 2021
@jorisvandenbossche What is the status on this? |
lidavidm
commented
Jul 15, 2021
@jorisvandenbossche just a gentle nudge :) |
jorisvandenbossche
commented
Jul 15, 2021
Yeah, sorry for the slow follow-up here. It was on my to do list to have a look at today.
But for this last case, you might still have the options of inferring from the first fragment, or reading the schema of all fragments and unifying them (or erroring when they can't be unified). So if we have eg a |
lidavidm
commented
Jul 15, 2021
That sounds reasonable to me. |
pitrou
commented
Nov 22, 2021
@jorisvandenbossche Are you planning to push this forward? |
kszucs
commented
Apr 21, 2022
@jorisvandenbossche shall we close this as stale? |
pitrou
commented
May 4, 2022
Ping @jorisvandenbossche : can you make a decision on this? |
amol-
commented
Mar 30, 2023
Closing because it has been untouched for a while, in case it's still relevant feel free to reopen and move it forward 👍 |
The C++
FileSystemDatasetFactory::Finishmethod handles the schema inference or validation with two options:InspectOptions::fragmentsto indicate the number of fragments to use when inferring or validating the schema (default of 1), and theFinishOptions::validate_fragmentsto indicate whether to validate the specified schema (when not inferred).For now, I decided to combine this in a single keyword on the Python side (
validate_schema). This avoids adding 2 inter-dependent keywords for this, and makes it easier to express some typical use cases (eg validate the specified schema with all fragments is nowvalidate_schema=Trueinstead ofvalidate_schema=True, fragments=-1). On the other hand, it gives a single keyword that accepts both boolean or int (which is not super clean). So this is certainly up for discussion.