Ejemplo n.º 1
0
 private void initResolverForColumnIfApplicable() {
   assert this.tqi != null;
   AbstractRegion rgn = this.tqi.getRegion();
   GfxdPartitionResolver rslvr = GemFireXDUtils.getResolver(rgn);
   if (rslvr != null && rslvr.isUsedInPartitioning(this.actualColumnName)) {
     this.resolver = rslvr;
     this.partitioningColPos = rslvr.getPartitioningColumnIndex(this.actualColumnName);
   }
 }
Ejemplo n.º 2
0
  private void initResolverForOuterScopeColumn(
      ColumnReference cr, QueryInfoContext qic, Scope owningScope) throws StandardException {
    // we want to find the following:
    // The owning table's Resolver so that we can find the column number as per
    // colocation criteria.
    // That column number will be the same as the root table's colocation column
    // number.

    final int tableNumber = cr.getTableNumber();
    DMLQueryInfo owningDML = owningScope.getDMLQueryInfo();
    this.tqi = owningDML.getTableQueryInfo(tableNumber);
    this.initResolverForColumnIfApplicable();
    SubQueryInfo sqi = (SubQueryInfo) qic.getCurrentScopeQueryInfo();
    // Now the partitioning column position is correctly set based on the owning region's resolver
    // of outer scope,
    // in case it is a  partitioned table
    // Now we need the resolver of the independent PR based table ( i.e   if this column is part of
    // resolver.)
    // the partitioning column position will remain unchanged.
    if (this.resolver != null) {
      // Check if the owning scope's level is less than independent PR scope level. If yes throw
      // exception

      int independentPRScopeLevel = sqi.getLastPushedPRBasedIndependentScopeLevel();
      if (owningScope.getScopeLevel() < independentPRScopeLevel) {
        throw StandardException.newException(SQLState.COLOCATION_CRITERIA_UNSATISFIED);
      }
      // reset the resolver to the immediate independent query. Note that from this point onwards
      // the resolver will not point to that
      // of owning region but that of immediate independent PR query's resolver. Though rest of the
      // data will point correctly
      // to owning table
      // This will be the master table of the independent query on which we will base our colocation
      // criteria
      AbstractRegion master = qic.getScopeAt(independentPRScopeLevel).getDMLQueryInfo().getRegion();
      assert master.getDataPolicy().withPartitioning();
      this.resolver = GemFireXDUtils.getResolver(master);
    }
  }