File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -664,6 +664,15 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
664664 ) -> Result < Vec < SelectExpr > > {
665665 let mut prepared_select_exprs = vec ! [ ] ;
666666 let mut error_builder = DataFusionErrorBuilder :: new ( ) ;
667+
668+ // Handle the case where no projection is specified but we have a valid FROM clause
669+ // In this case, implicitly add a wildcard projection (SELECT *)
670+ let projection = if projection. is_empty ( ) && !empty_from {
671+ vec ! [ SelectItem :: Wildcard ( WildcardAdditionalOptions :: default ( ) ) ]
672+ } else {
673+ projection
674+ } ;
675+
667676 for expr in projection {
668677 match self . sql_select_to_rex ( expr, plan, empty_from, planner_context) {
669678 Ok ( expr) => prepared_select_exprs. push ( expr) ,
Original file line number Diff line number Diff line change 1+ # Licensed to the Apache Software Foundation (ASF) under one
2+ # or more contributor license agreements. See the NOTICE file
3+ # distributed with this work for additional information
4+ # regarding copyright ownership. The ASF licenses this file
5+ # to you under the Apache License, Version 2.0 (the
6+ # "License"); you may not use this file except in compliance
7+ # with the License. You may obtain a copy of the License at
8+
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
17+
18+ query I
19+ FROM range(2)
20+ ----
21+ 0
22+ 1
23+
24+ query I
25+ FROM range(2)
26+ SELECT *
27+ ----
28+ 0
29+ 1
30+
31+ query I
32+ FROM (SELECT * FROM range(2))
33+ ----
34+ 0
35+ 1
36+
37+ query I
38+ FROM (FROM range(2))
39+ ----
40+ 0
41+ 1
You can’t perform that action at this time.
0 commit comments