当前位置: 首页>>代码示例>>Java>>正文


Java ExpressionType.COMPARE_EQUAL属性代码示例

本文整理汇总了Java中org.voltdb.types.ExpressionType.COMPARE_EQUAL属性的典型用法代码示例。如果您正苦于以下问题:Java ExpressionType.COMPARE_EQUAL属性的具体用法?Java ExpressionType.COMPARE_EQUAL怎么用?Java ExpressionType.COMPARE_EQUAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.voltdb.types.ExpressionType的用法示例。


在下文中一共展示了ExpressionType.COMPARE_EQUAL属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isEqualityIndexScan

/**
 * Returns true if the given query is an equality predicate (with all the columns)
 * on a unique index. This essentially means that the query will only return
 * one row at runtime.
 * <B>WARNING:</B> This is wildly inaccurate and should not used by to make runtime decisions.
 * @param catalog_stmt
 * @return
 */
public static boolean isEqualityIndexScan(Statement catalog_stmt) {
    Collection<Table> tables = getReferencedTables(catalog_stmt);
    PredicatePairs cset = extractStatementPredicates(catalog_stmt, false, tables.toArray(new Table[0]));
    
    Collection<Index> indexes = getReferencedIndexes(catalog_stmt);
    
    for (CatalogPair cp : cset) {
        if (cp.getComparisonExp() != ExpressionType.COMPARE_EQUAL) {
            return (false);
        }
        
        CatalogType ctypes[] = { cp.getFirst(), cp.getSecond() };
        for (int i = 0; i < ctypes.length; i++) {
            if (ctypes[i] instanceof Column) {
                Column target_col = (Column)ctypes[i];
                Table target_tbl = target_col.getParent();

                // Find what index it's using
                // This is a rough approximation...
                Index target_idx = null;
                for (Index idx : indexes) {
                    if (idx.getParent().equals(target_tbl)) {
                        for (Column col : CatalogUtil.getColumns(idx.getColumns())) {
                            if (col.equals(target_col)) {
                                target_idx = idx;
                                break;
                            }
                        } // FOR
                    }
                } // FOR
                if (target_idx == null) {
                    return (false);
                }
            }
        } // FOR

    } // FOR
    return (true);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:47,代码来源:CatalogUtil.java

示例2: createTempExpression

/**
 * Create a temporary column expression that can be used with
 * extractExpressionColumnSet
 * 
 * @param catalog_col
 * @param exp
 * @return
 */
private static AbstractExpression createTempExpression(Column catalog_col, AbstractExpression exp) {
    Table catalog_tbl = (Table) catalog_col.getParent();

    TupleValueExpression tuple_exp = new TupleValueExpression();
    tuple_exp.setTableName(catalog_tbl.getName());
    tuple_exp.setColumnIndex(catalog_col.getIndex());
    tuple_exp.setColumnAlias(catalog_col.getName());
    tuple_exp.setColumnName(catalog_col.getName());

    return (new ComparisonExpression(ExpressionType.COMPARE_EQUAL, tuple_exp, exp));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:19,代码来源:CatalogUtil.java

示例3: testClone

/**
 * testClone
 */
@Test
public void testClone() throws Exception {
    AggregateExpression exp = new AggregateExpression(ExpressionType.COMPARE_EQUAL);
    exp.m_distinct = true;
    AggregateExpression clone = (AggregateExpression)exp.clone();
    assertNotNull(clone);
    
    assertEquals(exp.getId(), clone.getId());
    assertEquals(exp.isJoiningClause(), clone.isJoiningClause());
    assertEquals(exp.getExpressionType(), clone.getExpressionType());
    assertEquals(exp.getValueType(), clone.getValueType());
    assertEquals(exp.getValueSize(), clone.getValueSize());
    assertEquals(exp.isDistinct(), clone.isDistinct());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:TestExpressionUtil.java

示例4: getStatementEstimationParameters

/**
 * Return the set of StmtParameter offsets that can be used to figure out
 * what partitions the Statement invocation will touch. This is used to
 * quickly figure out whether that invocation is single-partition or not. If
 * this Statement will always be multi-partition, or if the tables it
 * references uses a MultiColumn partitioning attribute, then the return
 * set will be null. This is at a coarse-grained level. You still need to
 * use the other PartitionEstimator methods to figure out where to send
 * PlanFragments.
 * 
 * @param catalog_stmt
 * @return
 */
public int[] getStatementEstimationParameters(final Statement catalog_stmt) {
    if (debug.val)
        LOG.debug("Retrieving estimation parameter offsets for " + catalog_stmt.fullName());
    
    int[] all_param_idxs = this.cache_stmtPartitionParameters.get(catalog_stmt);
    if (all_param_idxs == null) {
        List<Integer> param_idxs = new ArrayList<Integer>();

        // Assume single-partition
        if (catalog_stmt.getHas_singlesited() == false) {
            if (debug.val)
                LOG.warn("There is no single-partition query plan for " + catalog_stmt.fullName());
            return (null);
        }

        for (PlanFragment catalog_frag : catalog_stmt.getFragments().values()) {
            PartitionEstimator.CacheEntry cache_entry = null;
            try {
                cache_entry = this.getFragmentCacheEntry(catalog_frag);
            } catch (Exception ex) {
                throw new RuntimeException("Failed to retrieve CacheEntry for " + catalog_frag.fullName());
            }

            // If this PlanFragment has a broadcast, then this statment
            // can't be used for fast look-ups
            if (cache_entry.hasBroadcast()) {
                if (debug.val)
                    LOG.warn(String.format("%s contains an operation that must be broadcast." +
                    		 "Cannot be used for fast look-ups", catalog_frag.fullName()));
                return (null);
            }

            for (Table catalog_tbl : cache_entry.getTables()) {
                if (catalog_tbl.getMaterializer() != null) {
                    catalog_tbl = catalog_tbl.getMaterializer();
                }
                Column partition_col = catalog_tbl.getPartitioncolumn();
                if (partition_col instanceof MultiColumn) {
                    if (debug.val)
                        LOG.warn(String.format("%s references %s, which is partitioned on %s. " +
                        		 "Cannot be used for fast look-ups",
                        		 catalog_frag.fullName(), catalog_tbl.getName(), partition_col.fullName()));
                    return (null);
                }
                else if (partition_col != null && cache_entry.predicates.containsKey(partition_col)) {
                    for (Pair<ExpressionType, CatalogType> pair : cache_entry.predicates.get(partition_col)) {
                        if (pair.getFirst() == ExpressionType.COMPARE_EQUAL &&
                                pair.getSecond() instanceof StmtParameter) {
                            param_idxs.add(((StmtParameter)pair.getSecond()).getIndex());
                        }
                    } // FOR
                }
            } // FOR
            if (param_idxs.isEmpty() == false) all_param_idxs = CollectionUtil.toIntArray(param_idxs);
        } // FOR
        this.cache_stmtPartitionParameters.put(catalog_stmt, all_param_idxs);
    }
    return (all_param_idxs);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:72,代码来源:PartitionEstimator.java


注:本文中的org.voltdb.types.ExpressionType.COMPARE_EQUAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。