If you have hit EmptyScope, that probably means that the validator has tried other scopes and found nothing. Usually (e.g. inside a SELECT clause) the validator uses a ListScope, with the tables in the FROM clause making up the list of namespaces in which to search for columns. Each scope has a parent that it delegates to if it finds nothing, and EmptyScope is the end of the line.
Julian > On Nov 21, 2019, at 3:37 PM, Rui Wang <amaliu...@apache.org> wrote: > > Hi community, > > > SqlValidatorScope defines RelDataType resolveColumn(String name, SqlNode ctx > ) to help resolve a column name in scope and return its type. However, in > the implementation that is used during validation phase, which is > EmptyScope, the implementation returns null directly (see [2]). > > Is it intentional to return null for the implementation of EmptyScope? Is > there an alternative way to achieve what resolveColumn is designed for, or > I have to implement that in EmptyScope to be able to use it? > > > > [1]: > https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorScope.java#L161 > > [2]: > https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/EmptyScope.java#L189 > > -Rui