You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2021/08/12 07:11:00 UTC

[jira] [Created] (CALCITE-4728) Parse and validate procedural code (such as SQL/PSM, PL/SQL, PL/pgSQL, T-SQL)

Julian Hyde created CALCITE-4728:
------------------------------------

             Summary: Parse and validate procedural code (such as SQL/PSM, PL/SQL, PL/pgSQL, T-SQL)
                 Key: CALCITE-4728
                 URL: https://issues.apache.org/jira/browse/CALCITE-4728
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


Parse and validate procedural code (such as the SQL standard's SQL/PSM, Oracle's PL/SQL, PostgreSQL's PL/pgSQL, MSSQL's T-SQL).

This would entail:
 * Extensions to the SQL parser. (I'm not sure whether this would be the core parser or an extended parser such as Babel.)
 * AST classes (sub-classes of {{SqlNode}}) for functions, procedures, blocks, variable and parameter declarations, variable assignment, if-then-else, loop, and so forth.
 * Extensions to the validator to validate blocks.
 * Extensions to the validator to validate a SQL statement that is inside a block. (Variables and parameters are in scope.)

Optional:
 * Extend Interpreter to execute functions, procedures, blocks.
 * Some means to convert a block into executable Java code.
 * Extend {{SqlDialect}} so that ASTs of functions, procedures and blocks can be emitted using the syntax of particular dialects.

The languages are sufficiently similar that we can use the same AST classes for all.

I don't think we need to extend {{RelNode}} to represent blocks. (It's not a good fit, since a block does not evaluate to a relation.) Possibly we would create some data structure to represent a validated block (e.g. the type of each variable; each use of a variable points to the variable's definition). {{SqlToRelConverter}} would create this data structure in order "freeze" the state of the validator.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)