You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by you Zhuang <zh...@gmail.com> on 2021/05/13 06:19:08 UTC

Whether Explain statement should be validated or not

Calcite doesn't treat Explain statement as DDL, so Explain statement isn't
a top level statement and will not have any namespace.

But Explain will experience validated and that cause NPE.

Q1: If Explain statement should not be validated, will we throw a more
user-friendly exception?

Q2: If Explain statement should be validated, what should Calcite behave
when converting it to relation?

Re: Whether Explain statement should be validated or not

Posted by Julian Hyde <jh...@gmail.com>.
Let’s frame this discussion in terms of user-visible behavior (rather than validator, relations and namespaces).

Calcite does validate EXPLAIN statements, as this example illustrates:

  sqlline> !connect jdbc:calcite:model=core/src/test/resources/hsqldb-model.json sa sa
  sqlline> explain plan for select x from emp;
  Error: Error while executing SQL "explain plan for select x from emp": At line 1, column 25: Column 'X' not found in any table (state=,code=0)

Can you give an example where Calcite does not validate adequately?

Julian


> On May 12, 2021, at 11:19 PM, you Zhuang <zh...@gmail.com> wrote:
> 
> Calcite doesn't treat Explain statement as DDL, so Explain statement isn't
> a top level statement and will not have any namespace.
> 
> But Explain will experience validated and that cause NPE.
> 
> Q1: If Explain statement should not be validated, will we throw a more
> user-friendly exception?
> 
> Q2: If Explain statement should be validated, what should Calcite behave
> when converting it to relation?