-
Notifications
You must be signed in to change notification settings - Fork 4.2k
ARROW-11243: [C++] Recognize time types in CSV files #10782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -400,6 +400,24 @@ TEST_F(InferringColumnBuilderTest, MultipleChunkDate) { | |
| ArrayFromJSON(date32(), "[null]")}); | ||
| } | ||
|
|
||
| TEST_F(InferringColumnBuilderTest, SingleChunkTime) { | ||
| auto options = ConvertOptions::Defaults(); | ||
| auto tg = TaskGroup::MakeSerial(); | ||
|
|
||
| CheckInferred(tg, {{"", "01:23:45", "NA"}}, options, | ||
| {ArrayFromJSON(time32(TimeUnit::SECOND), "[null, 5025, null]")}); | ||
| } | ||
|
|
||
| TEST_F(InferringColumnBuilderTest, MultipleChunkTime) { | ||
| auto options = ConvertOptions::Defaults(); | ||
| auto tg = TaskGroup::MakeSerial(); | ||
| auto type = time32(TimeUnit::SECOND); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there also be an inferring test that results in time64?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, there is no inference to time64. Should there be one (for times with nanosecond precision perhaps)?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see, I was looking at the wrong case statement, you're right. Maybe there should be one to catch any times with fractional seconds, though I don't feel strongly about it since you can explicitly declare the type/schema you want. |
||
|
|
||
| CheckInferred(tg, {{""}, {"01:23:45"}, {"NA"}}, options, | ||
| {ArrayFromJSON(type, "[null]"), ArrayFromJSON(type, "[5025]"), | ||
| ArrayFromJSON(type, "[null]")}); | ||
| } | ||
|
|
||
| TEST_F(InferringColumnBuilderTest, SingleChunkTimestamp) { | ||
| auto options = ConvertOptions::Defaults(); | ||
| auto tg = TaskGroup::MakeSerial(); | ||
|
|
@@ -453,6 +471,46 @@ TEST_F(InferringColumnBuilderTest, MultipleChunkTimestampNS) { | |
| options, expected); | ||
| } | ||
|
|
||
| TEST_F(InferringColumnBuilderTest, SingleChunkIntegerAndTime) { | ||
| // Fallback to utf-8 | ||
| auto options = ConvertOptions::Defaults(); | ||
| auto tg = TaskGroup::MakeSerial(); | ||
|
|
||
| CheckInferred(tg, {{"", "99", "01:23:45", "NA"}}, options, | ||
| {ArrayFromJSON(utf8(), R"(["", "99", "01:23:45", "NA"])")}); | ||
| } | ||
|
|
||
| TEST_F(InferringColumnBuilderTest, MultipleChunkIntegerAndTime) { | ||
| // Fallback to utf-8 | ||
| auto options = ConvertOptions::Defaults(); | ||
| auto tg = TaskGroup::MakeSerial(); | ||
| auto type = utf8(); | ||
|
|
||
| CheckInferred(tg, {{""}, {"99"}, {"01:23:45", "NA"}}, options, | ||
| {ArrayFromJSON(type, R"([""])"), ArrayFromJSON(type, R"(["99"])"), | ||
| ArrayFromJSON(type, R"(["01:23:45", "NA"])")}); | ||
| } | ||
|
|
||
| TEST_F(InferringColumnBuilderTest, SingleChunkDateAndTime) { | ||
| // Fallback to utf-8 | ||
| auto options = ConvertOptions::Defaults(); | ||
| auto tg = TaskGroup::MakeSerial(); | ||
|
|
||
| CheckInferred(tg, {{"", "01:23:45", "1998-04-05"}}, options, | ||
| {ArrayFromJSON(utf8(), R"(["", "01:23:45", "1998-04-05"])")}); | ||
| } | ||
|
|
||
| TEST_F(InferringColumnBuilderTest, MultipleChunkDateAndTime) { | ||
| // Fallback to utf-8 | ||
| auto options = ConvertOptions::Defaults(); | ||
| auto tg = TaskGroup::MakeSerial(); | ||
| auto type = utf8(); | ||
|
|
||
| CheckInferred(tg, {{""}, {"01:23:45"}, {"1998-04-05"}}, options, | ||
| {ArrayFromJSON(type, R"([""])"), ArrayFromJSON(type, R"(["01:23:45"])"), | ||
| ArrayFromJSON(type, R"(["1998-04-05"])")}); | ||
| } | ||
|
|
||
| TEST_F(InferringColumnBuilderTest, SingleChunkString) { | ||
| auto options = ConvertOptions::Defaults(); | ||
| auto tg = TaskGroup::MakeSerial(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.