Skip to content
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

Cannot import Time64 from CSV #3176

Closed
Tracked by #3148
waitingkuo opened this issue Aug 16, 2022 · 4 comments
Closed
Tracked by #3148

Cannot import Time64 from CSV #3176

waitingkuo opened this issue Aug 16, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@waitingkuo
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

create this time.csv

c0,c1,c2
1,00:00:00,2000-01-01T00:00:00
2,00:01:00,2000-01-01T00:00:00
3,00:02:00,2000-01-01T00:00:00

the query for time doesn't work while timestamp works

DataFusion CLI v10.0.0
❯ create external table a (c0 int, c1 time, c2 timestamp) stored as csv with header row location 'time.csv';
0 rows in set. Query took 0.020 seconds.

❯ select c0 from a;
+----+
| c0 |
+----+
| 1  |
| 2  |
| 3  |
+----+
3 rows in set. Query took 0.039 seconds.

❯ select c1 from a;
ArrowError(ParseError("Unsupported data type Time64(Nanosecond)"))

❯ select c2 from a;
+---------------------+
| c2                  |
+---------------------+
| 1999-12-31 16:00:00 |
| 1999-12-31 16:00:00 |
| 1999-12-31 16:00:00 |
+---------------------+
3 rows in set. Query took 0.009 seconds.

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

@Jefffrey
Copy link
Contributor

This should be fixed by apache/arrow-rs#3101 with the related arrow-rs version

@waitingkuo
Copy link
Contributor Author

thank you @Jefffrey i think we could add some test cases later after arrow-rs new version upgraded
btw, i found the behavior for Timestamp parsing changed
it's now

select c2 from a;
+---------------------+
| c2                  |
+---------------------+
| 2000-01-01T00:00:00 |
| 2000-01-01T00:00:00 |
| 2000-01-01T00:00:00 |
+---------------------+

@Jefffrey
Copy link
Contributor

Jefffrey commented Dec 4, 2022

Issue resolved with arrow-rs version upgraded

jeffrey:~/Code/arrow-datafusion/datafusion-cli$ cat time.csv
c0,c1,c2
1,00:00:00,2000-01-01T00:00:00
2,00:01:00,2000-01-01T00:00:00
3,00:02:00,2000-01-01T00:00:00
jeffrey:~/Code/arrow-datafusion/datafusion-cli$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `/media/jeffrey/1tb_860evo_ssd/.cargo_target_cache/debug/datafusion-cli`
DataFusion CLI v15.0.0
❯ create external table a (c0 int, c1 time, c2 timestamp) stored as csv with header row location 'time.csv';
0 rows in set. Query took 0.001 seconds.
❯ select * from a;
+----+----------+---------------------+
| c0 | c1       | c2                  |
+----+----------+---------------------+
| 1  | 00:00:00 | 2000-01-01T00:00:00 |
| 2  | 00:01:00 | 2000-01-01T00:00:00 |
| 3  | 00:02:00 | 2000-01-01T00:00:00 |
+----+----------+---------------------+
3 rows in set. Query took 0.006 seconds.
❯

Would you still prefer some test cases be added, say to datafusion/core/src/datasource/file_format/csv.rs for example? Because in my opinion it'd just be retesting the arrow-rs functionality

@waitingkuo

@Jefffrey
Copy link
Contributor

Jefffrey commented Mar 9, 2023

@alamb this issue looks like it can be closed

@alamb alamb closed this as completed Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants