Java Code Examples for org.apache.calcite.schema.Schemas#subSchemaExpression()

The following examples show how to use org.apache.calcite.schema.Schemas#subSchemaExpression() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JournalledJdbcSchema.java    From calcite-sql-rewriter with Apache License 2.0 6 votes vote down vote up
public static JournalledJdbcSchema create(
		SchemaPlus parentSchema,
		String name,
		Map<String, Object> operand
) {
	DataSource dataSource;
	try {
		dataSource = parseDataSource(operand);
	} catch (Exception e) {
		throw new IllegalArgumentException("Error while reading dataSource", e);
	}
	String catalog = (String) operand.get("jdbcCatalog");
	String schema = (String) operand.get("jdbcSchema");
	Expression expression = null;
	if (parentSchema != null) {
		expression = Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class);
	}
	final SqlDialect dialect = createDialect(dataSource);
	final JdbcConvention convention = JdbcConvention.of(dialect, expression, name);
	return new JournalledJdbcSchema(dataSource, dialect, convention, catalog, schema, operand);
}
 
Example 2
Source File: JdbcCatalogSchema.java    From calcite with Apache License 2.0 6 votes vote down vote up
public static JdbcCatalogSchema create(
    SchemaPlus parentSchema,
    String name,
    DataSource dataSource,
    SqlDialectFactory dialectFactory,
    String catalog) {
  final Expression expression =
      parentSchema != null
          ? Schemas.subSchemaExpression(parentSchema, name,
              JdbcCatalogSchema.class)
          : Expressions.call(DataContext.ROOT,
              BuiltInMethod.DATA_CONTEXT_GET_ROOT_SCHEMA.method);
  final SqlDialect dialect =
      JdbcSchema.createDialect(dialectFactory, dataSource);
  final JdbcConvention convention =
      JdbcConvention.of(dialect, expression, name);
  return new JdbcCatalogSchema(dataSource, dialect, convention, catalog);
}
 
Example 3
Source File: JdbcSchema.java    From calcite with Apache License 2.0 5 votes vote down vote up
public static JdbcSchema create(
    SchemaPlus parentSchema,
    String name,
    DataSource dataSource,
    SqlDialectFactory dialectFactory,
    String catalog,
    String schema) {
  final Expression expression =
      Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class);
  final SqlDialect dialect = createDialect(dialectFactory, dataSource);
  final JdbcConvention convention =
      JdbcConvention.of(dialect, expression, name);
  return new JdbcSchema(dataSource, dialect, convention, catalog, schema);
}
 
Example 4
Source File: DatabaseCalciteSchema.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Expression getExpression(SchemaPlus parentSchema, String name) {
	return Schemas.subSchemaExpression(parentSchema, name, getClass());
}
 
Example 5
Source File: CatalogCalciteSchema.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Expression getExpression(SchemaPlus parentSchema, String name) {
	return  Schemas.subSchemaExpression(parentSchema, name, getClass());
}
 
Example 6
Source File: DatabaseCalciteSchema.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Expression getExpression(SchemaPlus parentSchema, String name) {
	return Schemas.subSchemaExpression(parentSchema, name, getClass());
}
 
Example 7
Source File: CatalogCalciteSchema.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Expression getExpression(SchemaPlus parentSchema, String name) {
	return  Schemas.subSchemaExpression(parentSchema, name, getClass());
}
 
Example 8
Source File: DatabaseCalciteSchema.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Expression getExpression(SchemaPlus parentSchema, String name) {
	return Schemas.subSchemaExpression(parentSchema, name, getClass());
}
 
Example 9
Source File: CatalogCalciteSchema.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Expression getExpression(SchemaPlus parentSchema, String name) {
	return  Schemas.subSchemaExpression(parentSchema, name, getClass());
}
 
Example 10
Source File: DatabaseCalciteSchema.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Expression getExpression(SchemaPlus parentSchema, String name) {
	return Schemas.subSchemaExpression(parentSchema, name, getClass());
}
 
Example 11
Source File: CatalogCalciteSchema.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Expression getExpression(SchemaPlus parentSchema, String name) {
	return  Schemas.subSchemaExpression(parentSchema, name, getClass());
}
 
Example 12
Source File: JdbcSchema.java    From calcite with Apache License 2.0 4 votes vote down vote up
public Expression getExpression(SchemaPlus parentSchema, String name) {
  return Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class);
}
 
Example 13
Source File: AbstractSchema.java    From calcite with Apache License 2.0 4 votes vote down vote up
public Expression getExpression(SchemaPlus parentSchema, String name) {
  return Schemas.subSchemaExpression(parentSchema, name, getClass());
}