punya opened a new issue, #27692:
URL: https://github.com/apache/datafusion/issues/27692

   ### Describe the bug
   
   A query that starts with `FROM` and has no `SELECT` returns rows with no 
columns. The parser accepts it (`SelectFlavor::FromFirstNoSelect` in the 
generic dialect), but the planner plans it as a `SELECT` with an empty select 
list instead of `SELECT *`. The SQL planner never reads `Select::flavor`.
   
   This matters most for pipe syntax, where queries usually start with `FROM`.
   
   ### To Reproduce
   
   ```sql
   FROM (VALUES (1, 10), (2, 30)) AS t(k, v);
   ```
   
   returns two rows with no columns. With a pipe operator:
   
   ```sql
   FROM (VALUES (1, 10), (2, 30)) AS t(k, v)
   |> WHERE v > 10;
   ```
   
   ```
   Schema error: No field named v.
   ```
   
   The same query starting with `SELECT * FROM` works.
   
   ### Expected behavior
   
   `FROM t` behaves like `SELECT * FROM t`:
   
   ```
   k,v
   1,10
   2,30
   ```
   
   and the pipe query returns `2,30`.
   
   ### Additional context
   
   Part of #14660.
   


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

Reply via email to