nix010 commented on PR #11454:
URL: https://github.com/apache/datafusion/pull/11454#issuecomment-2227006931
My approach to this problem maybe a bit naive! open to suggestions.
Also where should I put the tests for this ?
```rust
use datafusion::prelude::*;
#[tokio::main]
async fn main() -> datafusion::error::Result<()> {
// register the table
let ctx = SessionContext::new();
ctx.register_csv("example", "test.csv", CsvReadOptions::new()).await?;
// create a plan to run a SQL query
let df = ctx.sql("SELECT '-12'::interval, '1'::interval, '1 day 2 month,
3 hour' FROM example").await?;
// execute and print results
df.show().await?;
Ok(())
}
```
```bash
+---------------------------------------------------------+-------------------------------------------------------+-------------------------------+
| Utf8("-12") | Utf8("1")
| Utf8("1 day 2 month, 3 hour") |
+---------------------------------------------------------+-------------------------------------------------------+-------------------------------+
| 0 years 0 mons 0 days 0 hours 0 mins -12.000000000 secs | 0 years 0 mons 0
days 0 hours 0 mins 1.000000000 secs | 1 day 2 month, 3 hour |
+---------------------------------------------------------+-------------------------------------------------------+-------------------------------+
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]