Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

1:  In method FunctionCatalogOperatorTable#lookupOperatorOverloads, if 

2:

3:

4:

if the passed SqlFunctionCategory  is USER_DEFINED_PROCEDURE , get the procedure in Catalog  with the given SqlIdentifier,  and then wrap it to BridginSqlProcedure  which is intance of SqlFunction.

2: In BridgingSqlProcedure,  the type inference logic for procedure follows the  style of function, which will try to extract the datatype of arguments and return value from the call  method in the procedure or DataTypeHint  if annotated. The logic for extract datatype for procedure will much reuse the code for function but with a little of  adjustment for Procedure.

3: Add a class name SqlCallProcedureConverter which is used to convert the SqlNode for call procedure to CallProcedureOperation , in SqlCallProcedureConverter, if the SqlNode is instance of SqlBasicCall  and the operator is instance of SqlProcedureCallOperator, it should be call procedure statement, then convert it to CallProcedureOperation contains the procedure and the expression for arguments.

4: In method TableEnvironmentImpl#executeInternal, if the Operation  is intance of CallProcedureOperation , construnct a StreamTableEnvironment, and pass it with the arguments specified by user to call the corresponding method procedure#call(xxx).

5: Get the result of procedure#call(xxx) , which should be CloseableIterator<Row>. Build a TableResult  with the so that the SqlClient can show the result of the call procedure to users.5:

Examples for stored procedure

...