Class ShowTablesHandler


public class ShowTablesHandler extends DefaultSqlHandler
  • Constructor Details

  • Method Details

    • rewrite

      public org.apache.calcite.sql.SqlNode rewrite(org.apache.calcite.sql.SqlNode sqlNode) throws ForemanSetupException
      Rewrite the parse tree as SELECT ... FROM INFORMATION_SCHEMA.`TABLES` ...
      Overrides:
      rewrite in class DefaultSqlHandler
      Parameters:
      sqlNode - sql parse tree to be rewritten
      Returns:
      Rewritten sql parse tree
      Throws:
      ForemanSetupException
    • validateAndConvert

      protected DefaultSqlHandler.ConvertedRelNode validateAndConvert(org.apache.calcite.sql.SqlNode sqlNode) throws ForemanSetupException, org.apache.calcite.tools.RelConversionException, org.apache.calcite.tools.ValidationException
      Rewritten SHOW TABLES query should be executed against root schema. Otherwise if query executed against, for example, jdbc plugin, returned table_schema column values won't be consistent with Drill's values for same column. Also after jdbc filter push down schema condition will be broken because it may contain name of Drill's storage plugin or name of jdbc catalog which isn't present in table_schema column.
      Overrides:
      validateAndConvert in class DefaultSqlHandler
      Parameters:
      sqlNode - node produced by rewrite(SqlNode)
      Returns:
      converted rel node
      Throws:
      ForemanSetupException - when fragment setup or ser/de failed
      org.apache.calcite.tools.RelConversionException - when conversion failed
      org.apache.calcite.tools.ValidationException - when sql node validation failed