Class JdbcBaseSchema

java.lang.Object
org.apache.calcite.adapter.jdbc.JdbcBaseSchema
All Implemented Interfaces:
Schema
Direct Known Subclasses:
JdbcCatalogSchema, JdbcSchema

public abstract class JdbcBaseSchema extends Object implements Schema
Base class for JDBC schemas.
  • Constructor Details

    • JdbcBaseSchema

      public JdbcBaseSchema()
  • Method Details

    • tables

      public abstract Lookup<Table> tables()
      Description copied from interface: Schema
      Returns a lookup object to find tables.
      Specified by:
      tables in interface Schema
      Returns:
      Lookup
    • getTable

      @Deprecated public @Nullable Table getTable(String name)
      Deprecated.
      Description copied from interface: Schema
      Returns a table with a given name, or null if not found.

      Using `getTable` directly does not allow to distinguish between case sensitive and case insensitive lookups. This method always does a case sensitive lookup. Caseinsensitive lookup can be done by loading all table names using Schema.getTableNames(). This can be quite timeconsuming for huge databases. To speed this up, all table names must be cached. This will require a huge amount of additional memory.

      Specified by:
      getTable in interface Schema
      Parameters:
      name - Table name
      Returns:
      Table, or null
    • getTableNames

      @Deprecated public Set<String> getTableNames()
      Deprecated.
      Description copied from interface: Schema
      Returns the names of the tables in this schema.
      Specified by:
      getTableNames in interface Schema
      Returns:
      Names of the tables in this schema
    • subSchemas

      public abstract Lookup<? extends Schema> subSchemas()
      Description copied from interface: Schema
      Returns a lookup object to find sub schemas.
      Specified by:
      subSchemas in interface Schema
      Returns:
      Lookup
    • getSubSchema

      @Deprecated public @Nullable Schema getSubSchema(String name)
      Deprecated.
      Description copied from interface: Schema
      Returns a sub-schema with a given name, or null.

      See also comment for Schema.getTable(String) to find out why you should do so.

      Specified by:
      getSubSchema in interface Schema
      Parameters:
      name - Sub-schema name
      Returns:
      Sub-schema with a given name, or null
    • getSubSchemaNames

      @Deprecated public Set<String> getSubSchemaNames()
      Deprecated.
      Description copied from interface: Schema
      Returns the names of this schema's child schemas.
      Specified by:
      getSubSchemaNames in interface Schema
      Returns:
      Names of this schema's child schemas
    • getType

      public @Nullable RelProtoDataType getType(String name)
      Description copied from interface: Schema
      Returns a type with a given name, or null if not found.
      Specified by:
      getType in interface Schema
      Parameters:
      name - Table name
      Returns:
      Table, or null
    • getTypeNames

      public Set<String> getTypeNames()
      Description copied from interface: Schema
      Returns the names of the types in this schema.
      Specified by:
      getTypeNames in interface Schema
      Returns:
      Names of the tables in this schema
    • getFunctions

      public final Collection<Function> getFunctions(String name)
      Description copied from interface: Schema
      Returns a list of functions in this schema with the given name, or an empty list if there is no such function.
      Specified by:
      getFunctions in interface Schema
      Parameters:
      name - Name of function
      Returns:
      List of functions with given name, or empty list
    • getFunctionNames

      public final Set<String> getFunctionNames()
      Description copied from interface: Schema
      Returns the names of the functions in this schema.
      Specified by:
      getFunctionNames in interface Schema
      Returns:
      Names of the functions in this schema
    • getExpression

      public Expression getExpression(@Nullable SchemaPlus parentSchema, String name)
      Description copied from interface: Schema
      Returns the expression by which this schema can be referenced in generated code.
      Specified by:
      getExpression in interface Schema
      Parameters:
      parentSchema - Parent schema
      name - Name of this schema
      Returns:
      Expression by which this schema can be referenced in generated code
    • isMutable

      public boolean isMutable()
      Description copied from interface: Schema
      Returns whether the user is allowed to create new tables, functions and sub-schemas in this schema, in addition to those returned automatically by methods such as Schema.getTable(String).

      Even if this method returns true, the maps are not modified. Calcite stores the defined objects in a wrapper object.

      Specified by:
      isMutable in interface Schema
      Returns:
      Whether the user is allowed to create new tables, functions and sub-schemas in this schema
    • snapshot

      public Schema snapshot(SchemaVersion version)
      Description copied from interface: Schema
      Returns the snapshot of this schema as of the specified time. The contents of the schema snapshot should not change over time.
      Specified by:
      snapshot in interface Schema
      Parameters:
      version - The current schema version
      Returns:
      the schema snapshot.