NoahKusaba opened a new issue, #2961:
URL: https://github.com/apache/datafusion-ballista/issues/2961

   **Describe the bug**
   
   A `LIMIT` directly over `VALUES` is ignored: the query returns every row. 
This happens with both the static and the adaptive planner.
   
   **To Reproduce**
   
   Standalone Ballista on `main` (446fa54c9), default settings:
   
   ```sql
   SELECT a FROM (VALUES (0), (1), (2), (3), (4), (5)) AS v(a) LIMIT 2;
   -- returns 6 rows
   ```
   
   These return the right number of rows:
   
   ```sql
   SELECT count(*) FROM (SELECT a FROM (VALUES (0), (1), (2), (3), (4), (5)) AS 
v(a) LIMIT 2);  -- 2
   SELECT a FROM parquet_table LIMIT 2;  -- 2 rows
   ```
   
   **Expected behavior**
   
   2 rows.
   
   **Additional context**
   
   Found by running DataFusion's sqllogictest files on Ballista (#2945): 42 
records in 14 files, for example `limit.slt:1161` (`SELECT col_b, col_c FROM 
t21176 LIMIT 5` returns 20 rows). A guess I haven't confirmed: the limit is 
pushed into the memory scan as its `fetch`, and the fetch is lost before the 
scan runs on an executor. `datafusion-proto`'s `MemoryScanExecNode` has a 
`fetch` field, so the loss may be on Ballista's side, for example where a scan 
is restricted to a task's partitions.
   


-- 
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]

  • [I] LIMIT directly over VALU... NoahKusaba (via GitHub) via github

Reply via email to