本文整理汇总了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);
}
示例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));
}
示例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());
}
示例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);
}