dadepo opened a new issue, #5202:
URL: https://github.com/apache/arrow-datafusion/issues/5202
**Describe the bug**
I have a delta table I am accessing using datafusion.
A `select * query` works just fine, but any other query - like selecting
only a column of summing a column does not do anything. No error or warning is
thrown.
Basically the code is
```
async fn run_from_delta_table(ctx: &SessionContext) -> Result<(),
DeltaTableError> {
let table = open_table("../data/delta-table")
.await
.unwrap();
ctx.register_table("demo", Arc::new(table)).unwrap();
let df = ctx
.sql("SELECT * FROM demo").await?;
df.show().await?; // prints to the console
let df = ctx
.sql("SELECT ViewCount FROM demo").await?;
df.show().await?; // does not print to the console
let df = ctx
.sql("SELECT SUM(ViewCount) FROM demo").await?;
df.show().await?; // does not print to the console
Ok(())
}
```
It is worth mentioning that querying using the dataframe API works as
expected:
```
async fn run_df(ctx: &SessionContext) -> Result<(), DeltaTableError> {
let table = open_table("../data/delta-table")
.await
.unwrap();
let df = ctx.read_table(Arc::new(table))?;
df.show().await?; // prints to the console
let view_col = df.select(vec![col("ViewCount")])?;
view_col.show().await?; // also prints to the console
let view_sum = df
.aggregate(vec![], vec![sum(col("ViewCount"))])?;
view_sum.show().await?; // also prints to the console
Ok(())
}
```
My Cargo.toml looks like this:
```
[dependencies]
datafusion = "15.0.0"
deltalake = {version="0.6.0", features = ["datafusion-ext"]}
tokio = {version="1.25.0", features = ["macros", "rt", "parking_lot"]}
```
**To Reproduce**
- Create a project with the above mentioned dependencies in Cargo.toml
- Have a detla-lake table at a known path
- Run the two functions above `run_df` and `run_from_delta_table` while
updating the path to the delta-lake path
**Expected behavior**
The SQL API should perform the mentioned query just as the dataframe API did
**Additional context**
Note I am using version `15.0.0` as this is the version compatible with
`deltalake`
--
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]