public final class Schemas extends Object
| Modifier and Type | Method and Description |
|---|---|
static CalcitePrepare.AnalyzeViewResult |
analyzeView(CalciteConnection connection,
CalciteSchema schema,
@Nullable List<String> schemaPath,
String viewSql,
@Nullable List<String> viewPath,
boolean fail)
Analyzes a view.
|
static CalcitePrepare.ConvertResult |
convert(CalciteConnection connection,
CalciteSchema schema,
List<String> schemaPath,
String sql)
Parses and validates a SQL query and converts to relational algebra.
|
static DataContext |
createDataContext(Connection connection,
@Nullable SchemaPlus rootSchema) |
static org.apache.calcite.linq4j.Enumerable<Object[]> |
enumerable(FilterableTable table,
DataContext root)
Returns an
Enumerable over the rows of
a given table, not applying any filters, representing each row as an object
array. |
static org.apache.calcite.linq4j.Enumerable<Object[]> |
enumerable(ProjectableFilterableTable table,
DataContext root)
Returns an
Enumerable over the rows of
a given table, not applying any filters and projecting all columns,
representing each row as an object array. |
static org.apache.calcite.linq4j.Enumerable<Object[]> |
enumerable(ScannableTable table,
DataContext root)
Returns an
Enumerable over the rows of
a given table, representing each row as an object array. |
static org.apache.calcite.linq4j.tree.Expression |
expression(SchemaPlus schema)
Returns the expression for a schema.
|
static List<CalciteSchema.LatticeEntry> |
getLatticeEntries(CalciteSchema schema)
Returns the lattices defined in a schema.
|
static List<Lattice> |
getLattices(CalciteSchema schema)
Returns the lattices defined in a schema.
|
static List<CalciteSchema.TableEntry> |
getStarTables(CalciteSchema schema)
Returns the star tables defined in a schema.
|
static org.apache.calcite.linq4j.tree.Expression |
getTableExpression(SchemaPlus schema,
String tableName,
Table table,
Class<?> clazz)
Generates an expression with which table can be referenced in
generated code.
|
static CalcitePrepare.ParseResult |
parse(CalciteConnection connection,
CalciteSchema schema,
@Nullable List<String> schemaPath,
String sql)
Parses and validates a SQL query.
|
static Path |
path(CalciteSchema rootSchema,
Iterable<String> names)
Creates a path with a given list of names starting from a given root
schema.
|
static org.apache.calcite.schema.Schemas.PathImpl |
path(com.google.common.collect.ImmutableList<Pair<String,Schema>> build) |
static Path |
path(SchemaPlus schema)
Returns the path to get to a schema from its root.
|
static CalcitePrepare.CalciteSignature<Object> |
prepare(CalciteConnection connection,
CalciteSchema schema,
@Nullable List<String> schemaPath,
String sql,
com.google.common.collect.ImmutableMap<CalciteConnectionProperty,String> map)
Prepares a SQL query for execution.
|
static RelProtoDataType |
proto(ScalarFunction function)
Returns an implementation of
RelProtoDataType
that asks a given scalar function for its return type with a given type
factory. |
static RelProtoDataType |
proto(Table table)
Returns an implementation of
RelProtoDataType
that asks a given table for its row type with a given type factory. |
static <E> org.apache.calcite.linq4j.Queryable<E> |
queryable(DataContext root,
Class<E> clazz,
Iterable<? extends String> names)
Returns a
Queryable, given a fully-qualified table name as an
iterable. |
static <E> org.apache.calcite.linq4j.Queryable<E> |
queryable(DataContext root,
Class<E> clazz,
String... names)
Returns a
Queryable, given a fully-qualified table name. |
static <E> org.apache.calcite.linq4j.Queryable<E> |
queryable(DataContext root,
SchemaPlus schema,
Class<E> clazz,
String tableName)
Returns a
Queryable, given a schema and table name. |
static CalciteSchema.FunctionEntry |
resolve(RelDataTypeFactory typeFactory,
String name,
Collection<CalciteSchema.FunctionEntry> functionEntries,
List<RelDataType> argumentTypes) |
static @Nullable CalciteSchema |
subSchema(CalciteSchema schema,
Iterable<String> names)
Returns a sub-schema of a given schema obtained by following a sequence
of names.
|
static org.apache.calcite.linq4j.tree.Expression |
subSchemaExpression(SchemaPlus schema,
String name,
Class type)
Returns the expression for a sub-schema.
|
static @Nullable Table |
table(DataContext root,
String... names)
Returns an
Enumerable over object
arrays, given a fully-qualified table name which leads to a
ScannableTable. |
static org.apache.calcite.linq4j.tree.Expression |
tableExpression(SchemaPlus schema,
Type elementType,
String tableName,
Class clazz)
Returns the expression to access a table within a schema.
|
static String |
uniqueTableName(CalciteSchema schema,
String base)
Generates a table name that is unique within the given schema.
|
static org.apache.calcite.linq4j.tree.Expression |
unwrap(org.apache.calcite.linq4j.tree.Expression call,
Class type)
Converts a schema expression to a given type by calling the
SchemaPlus.unwrap(Class) method. |
public static CalciteSchema.FunctionEntry resolve(RelDataTypeFactory typeFactory, String name, Collection<CalciteSchema.FunctionEntry> functionEntries, List<RelDataType> argumentTypes)
public static org.apache.calcite.linq4j.tree.Expression expression(SchemaPlus schema)
public static org.apache.calcite.linq4j.tree.Expression subSchemaExpression(SchemaPlus schema, String name, Class type)
public static org.apache.calcite.linq4j.tree.Expression unwrap(org.apache.calcite.linq4j.tree.Expression call,
Class type)
SchemaPlus.unwrap(Class) method.public static org.apache.calcite.linq4j.tree.Expression tableExpression(SchemaPlus schema, Type elementType, String tableName, Class clazz)
public static org.apache.calcite.linq4j.tree.Expression getTableExpression(SchemaPlus schema, String tableName, Table table, Class<?> clazz)
schema - SchematableName - Table name (unique within schema)table - Table to be referencedclazz - Class that provides specific methods for accessing table data.
It may differ from the table class; for example clazz may be
MongoTable.MongoQueryable, though table is MongoTablepublic static DataContext createDataContext(Connection connection, @Nullable SchemaPlus rootSchema)
public static <E> org.apache.calcite.linq4j.Queryable<E> queryable(DataContext root, Class<E> clazz, String... names)
Queryable, given a fully-qualified table name.public static <E> org.apache.calcite.linq4j.Queryable<E> queryable(DataContext root, Class<E> clazz, Iterable<? extends String> names)
Queryable, given a fully-qualified table name as an
iterable.public static <E> org.apache.calcite.linq4j.Queryable<E> queryable(DataContext root, SchemaPlus schema, Class<E> clazz, String tableName)
Queryable, given a schema and table name.public static org.apache.calcite.linq4j.Enumerable<Object[]> enumerable(ScannableTable table, DataContext root)
Enumerable over the rows of
a given table, representing each row as an object array.public static org.apache.calcite.linq4j.Enumerable<Object[]> enumerable(FilterableTable table, DataContext root)
Enumerable over the rows of
a given table, not applying any filters, representing each row as an object
array.public static org.apache.calcite.linq4j.Enumerable<Object[]> enumerable(ProjectableFilterableTable table, DataContext root)
Enumerable over the rows of
a given table, not applying any filters and projecting all columns,
representing each row as an object array.public static @Nullable Table table(DataContext root, String... names)
Enumerable over object
arrays, given a fully-qualified table name which leads to a
ScannableTable.public static CalcitePrepare.ParseResult parse(CalciteConnection connection, CalciteSchema schema, @Nullable List<String> schemaPath, String sql)
public static CalcitePrepare.ConvertResult convert(CalciteConnection connection, CalciteSchema schema, List<String> schemaPath, String sql)
public static CalcitePrepare.AnalyzeViewResult analyzeView(CalciteConnection connection, CalciteSchema schema, @Nullable List<String> schemaPath, String viewSql, @Nullable List<String> viewPath, boolean fail)
public static CalcitePrepare.CalciteSignature<Object> prepare(CalciteConnection connection, CalciteSchema schema, @Nullable List<String> schemaPath, String sql, com.google.common.collect.ImmutableMap<CalciteConnectionProperty,String> map)
public static RelProtoDataType proto(Table table)
RelProtoDataType
that asks a given table for its row type with a given type factory.public static RelProtoDataType proto(ScalarFunction function)
RelProtoDataType
that asks a given scalar function for its return type with a given type
factory.public static List<CalciteSchema.TableEntry> getStarTables(CalciteSchema schema)
schema - Schemapublic static List<Lattice> getLattices(CalciteSchema schema)
schema - Schemapublic static List<CalciteSchema.LatticeEntry> getLatticeEntries(CalciteSchema schema)
schema - Schemapublic static @Nullable CalciteSchema subSchema(CalciteSchema schema, Iterable<String> names)
The result is null if the initial schema is null or any sub-schema does not exist.
public static String uniqueTableName(CalciteSchema schema, String base)
public static Path path(CalciteSchema rootSchema, Iterable<String> names)
public static org.apache.calcite.schema.Schemas.PathImpl path(com.google.common.collect.ImmutableList<Pair<String,Schema>> build)
public static Path path(SchemaPlus schema)
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.