[
https://issues.apache.org/jira/browse/ARROW-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrew Lamb updated ARROW-11323:
--------------------------------
Description:
If you run a SQL query in datafusion which has predicates that produces no rows
that also includes a GROUP BY or ORDER BY clause, you get the following error:
Error of "ArrowError(ComputeError("concat requires input of at least one
array"))"
Here are two test cases that show the problem:
https://github.com/apache/arrow/blob/master/rust/datafusion/src/execution/context.rs#L889
{code}
#[tokio::test]
async fn sort_empty() -> Result<()> {
// The predicate on this query purposely generates no results
let results =
execute("SELECT c1, c2 FROM test WHERE c1 > 100000 ORDER BY c1
DESC, c2 ASC", 4).await?;
assert_eq!(results.len(), 0);
Ok(())
}
#[tokio::test]
async fn aggregate_empty() -> Result<()> {
// The predicate on this query purposely generates no results
let results = execute("SELECT SUM(c1), SUM(c2) FROM test where c1 >
100000", 4).await?;
assert_eq!(results.len(), 0);
Ok(())
}
{code}
was:
If you run a SQL query in datafusion which has predicates that produces no rows
that also includes a GROUP BY or ORDER BY clause, you get the following error:
Error of "ArrowError(ComputeError("concat requires input of at least one
array"))"
Here are two test cases that show the problem:
https://github.com/apache/arrow/blob/master/rust/datafusion/src/execution/context.rs#L889
{code}
#[tokio::test]
async fn sort_empty() -> Result<()> {
// The predicate on this query purposely generates no results
let results =
execute("SELECT c1, c2 FROM test WHERE c1 > 100000 ORDER BY c1
DESC, c2 ASC", 4).await?;
assert_eq!(results.len(), 0);
Ok(())
}
#[tokio::test]
async fn aggregate_empty() -> Result<()> {
// The predicate on this query purposely generates no results
let results = execute("SELECT SUM(c1), SUM(c2) FROM test where c1 >
100000", 4).await?;
assert_eq!(results.len(), 0);
Ok(())
}
{code{
> [Rust][DataFusion] with queries with ORDER BY or GROUP BY that return no
> --------------------------------------------------------------------------
>
> Key: ARROW-11323
> URL: https://issues.apache.org/jira/browse/ARROW-11323
> Project: Apache Arrow
> Issue Type: Bug
> Reporter: Andrew Lamb
> Priority: Major
>
> If you run a SQL query in datafusion which has predicates that produces no
> rows that also includes a GROUP BY or ORDER BY clause, you get the following
> error:
> Error of "ArrowError(ComputeError("concat requires input of at least one
> array"))"
> Here are two test cases that show the problem:
> https://github.com/apache/arrow/blob/master/rust/datafusion/src/execution/context.rs#L889
> {code}
> #[tokio::test]
> async fn sort_empty() -> Result<()> {
> // The predicate on this query purposely generates no results
> let results =
> execute("SELECT c1, c2 FROM test WHERE c1 > 100000 ORDER BY c1
> DESC, c2 ASC", 4).await?;
> assert_eq!(results.len(), 0);
> Ok(())
> }
> #[tokio::test]
> async fn aggregate_empty() -> Result<()> {
> // The predicate on this query purposely generates no results
> let results = execute("SELECT SUM(c1), SUM(c2) FROM test where c1 >
> 100000", 4).await?;
> assert_eq!(results.len(), 0);
> Ok(())
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)