Beispiel #1
0
  protected RelNode optimizeLoopbackLink(
      RelOptCluster cluster, RelOptConnection connection, String[] actualName) throws SQLException {
    if (directory == null) {
      return null;
    }
    if (directory.server == null) {
      return null;
    }
    if ((directory.server.schemaName != null)
        && !directory.server.useSchemaNameAsForeignQualifier) {
      // Schema name should never be specified for a connection to
      // Farrago; if it is, bail.
      return null;
    }

    Connection loopbackConnection = directory.server.getConnection();
    if (!(loopbackConnection instanceof FarragoJdbcEngineConnection)) {
      Connection conn = loopbackConnection;
      while ((conn != null) && (conn instanceof DelegatingConnection)) {
        conn = ((DelegatingConnection) conn).getDelegate();
      }
      if (!(conn instanceof FarragoJdbcEngineConnection)) {
        return null;
      }
    }

    String catalogName = directory.server.catalogName;
    if (catalogName == null) {
      // No catalog name specified, so try to query the connection for
      // it.
      catalogName = loopbackConnection.getCatalog();
      if (catalogName == null) {
        return null;
      }
    }

    if (actualName[0] == null) {
      actualName[0] = catalogName;
    }

    // REVIEW jvs 14-Aug-2006:  Security security security.
    RelOptTable realTable = getPreparingStmt().getTableForMember(actualName);
    if (realTable == null) {
      return null;
    }
    return realTable.toRel(cluster, connection);
  }
Beispiel #2
0
 // override Object
 public boolean equals(Object obj) {
   if (!(obj instanceof RelColumnOrigin)) {
     return false;
   }
   RelColumnOrigin other = (RelColumnOrigin) obj;
   return Arrays.equals(originTable.getQualifiedName(), other.originTable.getQualifiedName())
       && (iOriginColumn == other.iOriginColumn)
       && (isDerived == other.isDerived);
 }
Beispiel #3
0
 // override Object
 public int hashCode() {
   return Arrays.hashCode(originTable.getQualifiedName()) + iOriginColumn + (isDerived ? 313 : 0);
 }
Beispiel #4
0
 public boolean isKey(BitSet columns) {
   return parent.isKey(columns);
 }
Beispiel #5
0
 public List<RelCollation> getCollationList() {
   return parent.getCollationList();
 }
Beispiel #6
0
 public RelOptSchema getRelOptSchema() {
   return parent.getRelOptSchema();
 }
Beispiel #7
0
 public RelDataType getRowType() {
   return parent.getRowType();
 }
Beispiel #8
0
 public double getRowCount() {
   return parent.getRowCount();
 }
Beispiel #9
0
 public List<String> getQualifiedName() {
   return parent.getQualifiedName();
 }
Beispiel #10
0
 public Expression getExpression(Class clazz) {
   return parent.getExpression(clazz);
 }
Beispiel #11
0
 public <T> T unwrap(Class<T> clazz) {
   if (clazz.isInstance(this)) {
     return clazz.cast(this);
   }
   return parent.unwrap(clazz);
 }