org.apache.calcite.avatica.AvaticaFactory Java Examples

The following examples show how to use org.apache.calcite.avatica.AvaticaFactory. 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: QuarkConnectionImpl.java    From quark with Apache License 2.0 6 votes vote down vote up
protected QuarkConnectionImpl(QuarkDriver driver, AvaticaFactory factory, String url,
                              Properties info, CalciteRootSchema rootSchema,
                              JavaTypeFactory typeFactory) throws SQLException {
  super(driver, factory, url, info);

  CalciteConnectionConfig cfg = new CalciteConnectionConfigImpl(info);

  if (typeFactory != null) {
    this.typeFactory = typeFactory;
  } else {
    final RelDataTypeSystem typeSystem =
        cfg.typeSystem(RelDataTypeSystem.class, RelDataTypeSystem.DEFAULT);
    this.typeFactory = new JavaTypeFactoryImpl(typeSystem);
  }

  this.properties.put(InternalProperty.CASE_SENSITIVE, cfg.caseSensitive());
  this.properties.put(InternalProperty.UNQUOTED_CASING, cfg.unquotedCasing());
  this.properties.put(InternalProperty.QUOTED_CASING, cfg.quotedCasing());
  this.properties.put(InternalProperty.QUOTING, cfg.quoting());
}
 
Example #2
Source File: CalciteConnectionImpl.java    From Quicksql with MIT License 5 votes vote down vote up
/**
 * Creates a CalciteConnectionImpl.
 *
 * <p>Not public; method is called only from the driver.</p>
 *
 * @param driver Driver
 * @param factory Factory for JDBC objects
 * @param url Server URL
 * @param info Other connection properties
 * @param rootSchema Root schema, or null
 * @param typeFactory Type factory, or null
 */
protected CalciteConnectionImpl(Driver driver, AvaticaFactory factory,
    String url, Properties info, CalciteSchema rootSchema,
    JavaTypeFactory typeFactory) {
  super(driver, factory, url, info);
  CalciteConnectionConfig cfg = new CalciteConnectionConfigImpl(info);
  this.prepareFactory = driver.prepareFactory;
  if (typeFactory != null) {
    this.typeFactory = typeFactory;
  } else {
    RelDataTypeSystem typeSystem =
        cfg.typeSystem(RelDataTypeSystem.class, RelDataTypeSystem.DEFAULT);
    if (cfg.conformance().shouldConvertRaggedUnionTypesToVarying()) {
      typeSystem =
          new DelegatingTypeSystem(typeSystem) {
            @Override public boolean
            shouldConvertRaggedUnionTypesToVarying() {
              return true;
            }
          };
    }
    this.typeFactory = new JavaTypeFactoryImpl(typeSystem);
  }
  this.rootSchema =
      Objects.requireNonNull(rootSchema != null
          ? rootSchema
          : CalciteSchema.createRootSchema(true));
  Preconditions.checkArgument(this.rootSchema.isRoot(), "must be root schema");
  this.properties.put(InternalProperty.CASE_SENSITIVE, cfg.caseSensitive());
  this.properties.put(InternalProperty.UNQUOTED_CASING, cfg.unquotedCasing());
  this.properties.put(InternalProperty.QUOTED_CASING, cfg.quotedCasing());
  this.properties.put(InternalProperty.QUOTING, cfg.quoting());
}
 
Example #3
Source File: CalciteFactory.java    From calcite with Apache License 2.0 5 votes vote down vote up
public final AvaticaConnection newConnection(
    UnregisteredDriver driver,
    AvaticaFactory factory,
    String url,
    Properties info) {
  return newConnection(driver, factory, url, info, null, null);
}
 
Example #4
Source File: QuarkJdbcFactory.java    From quark with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Quark connection for Avatica (in terms of Avatica types).
 * <p>
 * This implementation delegates to
 * {@link #newConnection(QuarkDriver, QuarkJdbcFactory, String, Properties, CalciteRootSchema,
 * JavaTypeFactory)}.
 * </p>
 */
@Override
public final AvaticaConnection newConnection(UnregisteredDriver driver,
                                             AvaticaFactory factory,
                                             String url,
                                             Properties info) throws SQLException {
  return newConnection((QuarkDriver) driver, (QuarkJdbcFactory) factory, url, info,
      null, null);
}
 
Example #5
Source File: CalciteFactory.java    From Quicksql with MIT License 5 votes vote down vote up
public final AvaticaConnection newConnection(
    UnregisteredDriver driver,
    AvaticaFactory factory,
    String url,
    Properties info) {
  return newConnection(driver, factory, url, info, null, null);
}
 
Example #6
Source File: DremioFactory.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Dremio connection for Avatica (in terms of Avatica types).
 * <p>
 *   This implementation delegates to
 *   {@link #newDremioConnection(DriverImpl, DremioFactory, String, Properties)}.
 * </p>
 */
@Override
public final AvaticaConnection newConnection(UnregisteredDriver driver,
                                             AvaticaFactory factory,
                                             String url,
                                             Properties info) throws SQLException {
  return newConnection((DriverImpl) driver, (DremioFactory) factory, url, info);
}
 
Example #7
Source File: KylinConnection.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
private AvaticaFactory factory() {
    return factory;
}
 
Example #8
Source File: CalciteConnectionImpl.java    From calcite with Apache License 2.0 4 votes vote down vote up
AvaticaFactory getFactory() {
  return factory;
}
 
Example #9
Source File: CalciteJdbc41Factory.java    From calcite with Apache License 2.0 4 votes vote down vote up
CalciteJdbc41Connection(Driver driver, AvaticaFactory factory, String url,
    Properties info, CalciteSchema rootSchema,
    JavaTypeFactory typeFactory) {
  super(driver, factory, url, info, rootSchema, typeFactory);
}
 
Example #10
Source File: CalciteJdbc41Factory.java    From calcite with Apache License 2.0 4 votes vote down vote up
public CalciteJdbc41Connection newConnection(UnregisteredDriver driver,
    AvaticaFactory factory, String url, Properties info,
    CalciteSchema rootSchema, JavaTypeFactory typeFactory) {
  return new CalciteJdbc41Connection(
      (Driver) driver, factory, url, info, rootSchema, typeFactory);
}
 
Example #11
Source File: CalciteFactory.java    From calcite with Apache License 2.0 4 votes vote down vote up
/** Creates a connection with a root schema. */
public abstract AvaticaConnection newConnection(UnregisteredDriver driver,
    AvaticaFactory factory, String url, Properties info,
    CalciteSchema rootSchema, JavaTypeFactory typeFactory);
 
Example #12
Source File: KylinConnection.java    From kylin with Apache License 2.0 4 votes vote down vote up
private AvaticaFactory factory() {
    return factory;
}
 
Example #13
Source File: KylinJdbcFactory.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public AvaticaConnection newConnection(UnregisteredDriver driver, AvaticaFactory factory, String url, Properties info) throws SQLException {
    return new KylinConnection(driver, (KylinJdbcFactory) factory, url, info);
}
 
Example #14
Source File: DremioConnectionImpl.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
AvaticaFactory getFactory() {
  return factory;
}
 
Example #15
Source File: KylinJdbcFactory.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public AvaticaConnection newConnection(UnregisteredDriver driver, AvaticaFactory factory, String url, Properties info) throws SQLException {
    return new KylinConnection(driver, (KylinJdbcFactory) factory, url, info);
}
 
Example #16
Source File: QuicksqlFactory.java    From Quicksql with MIT License 4 votes vote down vote up
/** Creates a connection with a root schema. */
public abstract AvaticaConnection newConnection(UnregisteredDriver driver,
    AvaticaFactory factory, String url, Properties info);
 
Example #17
Source File: QuicksqlJdbc41Factory.java    From Quicksql with MIT License 4 votes vote down vote up
QuickSqlJdbc41Connection(UnregisteredDriver driver, AvaticaFactory factory, String url,
    Properties info) {
  super(driver, factory, url, info);
}
 
Example #18
Source File: QuicksqlJdbc41Factory.java    From Quicksql with MIT License 4 votes vote down vote up
public QuickSqlJdbc41Connection newConnection(UnregisteredDriver driver,
    AvaticaFactory factory, String url, Properties info) {
  return new QuickSqlJdbc41Connection(driver, factory, url, info);
}
 
Example #19
Source File: CalciteConnectionImpl.java    From Quicksql with MIT License 4 votes vote down vote up
AvaticaFactory getFactory() {
  return factory;
}
 
Example #20
Source File: CalciteJdbc41Factory.java    From Quicksql with MIT License 4 votes vote down vote up
CalciteJdbc41Connection(Driver driver, AvaticaFactory factory, String url,
    Properties info, CalciteSchema rootSchema,
    JavaTypeFactory typeFactory) {
  super(driver, factory, url, info, rootSchema, typeFactory);
}
 
Example #21
Source File: CalciteJdbc41Factory.java    From Quicksql with MIT License 4 votes vote down vote up
public CalciteJdbc41Connection newConnection(UnregisteredDriver driver,
    AvaticaFactory factory, String url, Properties info,
    CalciteSchema rootSchema, JavaTypeFactory typeFactory) {
  return new CalciteJdbc41Connection(
      (Driver) driver, factory, url, info, rootSchema, typeFactory);
}
 
Example #22
Source File: CalciteFactory.java    From Quicksql with MIT License 4 votes vote down vote up
/** Creates a connection with a root schema. */
public abstract AvaticaConnection newConnection(UnregisteredDriver driver,
    AvaticaFactory factory, String url, Properties info,
    CalciteSchema rootSchema, JavaTypeFactory typeFactory);
 
Example #23
Source File: QuicksqlConnectionImpl.java    From Quicksql with MIT License 2 votes vote down vote up
/**
 * Creates a QuicksqlConnectionImpl.
 *
 * <p>Not public; method is called only from the driver.</p>
 *
 * @param driver Driver
 * @param factory Factory for JDBC objects
 * @param url Server URL
 * @param info Other connection properties
 */
protected QuicksqlConnectionImpl(UnregisteredDriver driver, AvaticaFactory factory,
    String url, Properties info) {
    super(driver, factory, url, info);
}