public final class Schemas extends Object
Modifier and Type | Method and Description |
---|---|
static CalcitePrepare.AnalyzeViewResult |
analyzeView(CalciteConnection connection,
CalciteSchema schema,
List<String> schemaPath,
String viewSql,
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,
SchemaPlus rootSchema) |
static 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 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 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 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 CalcitePrepare.ParseResult |
parse(CalciteConnection connection,
CalciteSchema schema,
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,
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> 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> Queryable<E> |
queryable(DataContext root,
Class<E> clazz,
String... names)
Returns a
Queryable , given a fully-qualified table name. |
static <E> 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 CalciteSchema |
subSchema(CalciteSchema schema,
Iterable<String> names)
Returns a sub-schema of a given schema obtained by following a sequence
of names.
|
static Expression |
subSchemaExpression(SchemaPlus schema,
String name,
Class type)
Returns the expression for a sub-schema.
|
static Table |
table(DataContext root,
String... names)
Returns an
Enumerable over object
arrays, given a fully-qualified table name which leads to a
ScannableTable . |
static 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 Expression |
unwrap(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 Expression expression(SchemaPlus schema)
public static Expression subSchemaExpression(SchemaPlus schema, String name, Class type)
public static Expression unwrap(Expression call, Class type)
SchemaPlus.unwrap(Class)
method.public static Expression tableExpression(SchemaPlus schema, Type elementType, String tableName, Class clazz)
public static DataContext createDataContext(Connection connection, SchemaPlus rootSchema)
public static <E> Queryable<E> queryable(DataContext root, Class<E> clazz, String... names)
Queryable
, given a fully-qualified table name.public static <E> 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> Queryable<E> queryable(DataContext root, SchemaPlus schema, Class<E> clazz, String tableName)
Queryable
, given a schema and table name.public static Enumerable<Object[]> enumerable(ScannableTable table, DataContext root)
Enumerable
over the rows of
a given table, representing each row as an object array.public static 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 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 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, 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, List<String> schemaPath, String viewSql, List<String> viewPath, boolean fail)
public static CalcitePrepare.CalciteSignature<Object> prepare(CalciteConnection connection, CalciteSchema schema, 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 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–2018 The Apache Software Foundation. All rights reserved.