本文整理汇总了Java中org.voltdb.types.IndexLookupType类的典型用法代码示例。如果您正苦于以下问题:Java IndexLookupType类的具体用法?Java IndexLookupType怎么用?Java IndexLookupType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IndexLookupType类属于org.voltdb.types包,在下文中一共展示了IndexLookupType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadFromJSONObject
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
@Override
protected void loadFromJSONObject(JSONObject obj, Database db) throws JSONException {
super.loadFromJSONObject(obj, db);
m_keyIterate = obj.getBoolean(Members.KEY_ITERATE.name());
m_lookupType = IndexLookupType.valueOf(obj.getString(Members.LOOKUP_TYPE.name()));
m_targetIndexName = obj.getString(Members.TARGET_INDEX_NAME.name());
JSONObject endExpressionObject = null;
if (!obj.isNull(Members.END_EXPRESSION.name())) {
try {
endExpressionObject = obj.getJSONObject(Members.END_EXPRESSION.name());
} catch (JSONException e) {
//okay for it not to be there
}
}
if (endExpressionObject != null) {
m_endExpression = AbstractExpression.fromJSONObject(endExpressionObject, db);
}
JSONArray searchkeyExpressions = obj.getJSONArray(Members.SEARCHKEY_EXPRESSIONS.name());
for (int ii = 0; ii < searchkeyExpressions.length(); ii++) {
JSONObject searchkeyExpressionObj = searchkeyExpressions.getJSONObject(ii);
m_searchkeyExpressions.add(AbstractExpression.fromJSONObject(searchkeyExpressionObj, db));
}
}
示例2: IndexScanPlanNode
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public IndexScanPlanNode(AbstractScanPlanNode srcNode, AggregatePlanNode apn, Index index, SortDirectionType sortDirection) {
super(srcNode.m_targetTableName, srcNode.m_targetTableAlias);
m_tableSchema = srcNode.m_tableSchema;
m_predicate = srcNode.m_predicate;
m_tableScanSchema = srcNode.m_tableScanSchema.clone();
for (AbstractPlanNode inlineChild : srcNode.getInlinePlanNodes().values()) {
addInlinePlanNode(inlineChild);
}
m_catalogIndex = index;
m_targetIndexName = index.getTypeName();
m_lookupType = IndexLookupType.GTE; // a safe way
m_sortDirection = sortDirection;
if (apn != null) {
m_outputSchema = apn.m_outputSchema.clone();
}
m_tableScan = srcNode.getTableScan();
}
示例3: setSkipNullPredicate
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void setSkipNullPredicate() {
// prepare position of non null key
int searchKeySize = m_searchkeyExpressions.size();
if (m_lookupType == IndexLookupType.EQ || searchKeySize == 0 || isReverseScan()) {
m_skip_null_predicate = null;
return;
}
int nextKeyIndex;
if (m_endExpression != null &&
searchKeySize < ExpressionUtil.uncombine(m_endExpression).size()) {
nextKeyIndex = searchKeySize;
} else {
nextKeyIndex = searchKeySize - 1;
}
setSkipNullPredicate(nextKeyIndex);
}
示例4: loadFromJSONObject
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
@Override
public void loadFromJSONObject( JSONObject jobj, Database db ) throws JSONException {
super.loadFromJSONObject(jobj, db);
m_lookupType = IndexLookupType.get( jobj.getString( Members.LOOKUP_TYPE.name() ) );
m_sortDirection = SortDirectionType.get( jobj.getString( Members.SORT_DIRECTION.name() ) );
m_purpose = jobj.has(Members.PURPOSE.name()) ?
jobj.getInt(Members.PURPOSE.name()) : FOR_SCANNING_PERFORMANCE_OR_ORDERING;
m_targetIndexName = jobj.getString(Members.TARGET_INDEX_NAME.name());
m_catalogIndex = db.getTables().get(super.m_targetTableName).getIndexes().get(m_targetIndexName);
//load end_expression
m_endExpression = AbstractExpression.fromJSONChild(jobj, Members.END_EXPRESSION.name(), m_tableScan);
// load initial_expression
m_initialExpression = AbstractExpression.fromJSONChild(jobj, Members.INITIAL_EXPRESSION.name(), m_tableScan);
//load searchkey_expressions
AbstractExpression.loadFromJSONArrayChild(m_searchkeyExpressions, jobj,
Members.SEARCHKEY_EXPRESSIONS.name(), m_tableScan);
m_skip_null_predicate = AbstractExpression.fromJSONChild(jobj, Members.SKIP_NULL_PREDICATE.name(), m_tableScan);
}
示例5: isPredicatesOptimizableForAggregate
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public boolean isPredicatesOptimizableForAggregate() {
// for reverse scan, need to examine "added" predicates
List<AbstractExpression> predicates = ExpressionUtil.uncombine(m_predicate);
// if the size of predicates doesn't equal 1, can't be our added artifact predicates
if (predicates.size() != 1) {
return false;
}
// examin the possible "added" predicates: NOT NULL expr.
AbstractExpression expr = predicates.get(0);
if (expr.getExpressionType() != ExpressionType.OPERATOR_NOT) {
return false;
}
if (expr.getLeft().getExpressionType() != ExpressionType.OPERATOR_IS_NULL) {
return false;
}
// Not reverse scan.
if (m_lookupType != IndexLookupType.LT && m_lookupType != IndexLookupType.LTE) {
return false;
}
return true;
}
示例6: loadFromJSONObject
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
@Override
public void loadFromJSONObject( JSONObject jobj, Database db ) throws JSONException {
super.loadFromJSONObject(jobj, db);
m_lookupType = IndexLookupType.get( jobj.getString( Members.LOOKUP_TYPE.name() ) );
m_endType = IndexLookupType.get( jobj.getString( Members.END_TYPE.name() ) );
m_targetIndexName = jobj.getString(Members.TARGET_INDEX_NAME.name());
m_catalogIndex = db.getTables().get(super.m_targetTableName).getIndexes().get(m_targetIndexName);
//load end_expression
AbstractExpression.loadFromJSONArrayChild(m_endkeyExpressions, jobj,
Members.ENDKEY_EXPRESSIONS.name(), m_tableScan);
AbstractExpression.loadFromJSONArrayChild(m_searchkeyExpressions, jobj,
Members.SEARCHKEY_EXPRESSIONS.name(), m_tableScan);
m_skip_null_predicate = AbstractExpression.fromJSONChild(jobj, Members.SKIP_NULL_PREDICATE.name(), m_tableScan);
}
示例7: explainKeys
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
private static String explainKeys(String[] asIndexed, List<AbstractExpression> keyExpressions,
String targetTableName, IndexLookupType lookupType) {
String conjunction = "";
String result = "(";
int prefixSize = keyExpressions.size() - 1;
for (int ii = 0; ii < prefixSize; ++ii) {
result += conjunction +
asIndexed[ii] + " = " + keyExpressions.get(ii).explain(targetTableName);
conjunction = ") AND (";
}
// last element
result += conjunction +
asIndexed[prefixSize] + " " + lookupType.getSymbol() + " " +
keyExpressions.get(prefixSize).explain(targetTableName) + ")";
return result;
}
示例8: testLegancyTests
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void testLegancyTests()
{
sql = "select a from t where a = ? and b < ?";
checkReverseScan("COVER2_TREE", IndexLookupType.LT, 2, 1, 1, SortDirectionType.INVALID);
sql = "select a from t where a = ? and b <= ?";
checkReverseScan("COVER2_TREE", IndexLookupType.LTE, 2, 1, 1, SortDirectionType.INVALID);
sql = "select a from t where a = ? and c = ? and b < ?;";
checkReverseScan("COVER3_TREE", IndexLookupType.LT, 3, 2, 1, SortDirectionType.INVALID);
sql = "select a from t where a = ? and c = ? and b <= ?";
checkReverseScan("COVER3_TREE", IndexLookupType.LTE, 3, 2, 1, SortDirectionType.INVALID);
// no ORDER BY node because order-by is handled by index scan inherent ordering
sql = "select a, b from t where a = ? and c = ? and b < ? order by b desc;";
checkReverseScan("COVER3_TREE", IndexLookupType.LT, 3, 2, 1, SortDirectionType.DESC);
sql = "select a, b from t where a = ? and b = ? and c < ? order by c desc;";
checkReverseScan("IDX_1_TREE", IndexLookupType.LT, 3, 2, 1, SortDirectionType.DESC);
sql = "select a, b from t where a = ? and c = ? and b <= ? order by b desc;";
checkReverseScan("COVER3_TREE", IndexLookupType.LTE, 3, 2, 1, SortDirectionType.DESC);
}
示例9: testEng3850ComplexIndexablePlan
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void testEng3850ComplexIndexablePlan()
{
AbstractPlanNode pn = compile("select id from a, t where a.id < (t.a + ?);");
pn = pn.getChild(0);
pn = pn.getChild(0);
// System.out.println("DEBUG: " + pn.toExplainPlanString());
assertTrue(pn instanceof NestLoopIndexPlanNode);
IndexScanPlanNode indexScan = (IndexScanPlanNode)pn.getInlinePlanNode(PlanNodeType.INDEXSCAN);
assertEquals(IndexLookupType.LT, indexScan.getLookupType());
assertTrue(indexScan.toJSONString().contains("\"TARGET_INDEX_NAME\":\"" +
HSQLInterface.AUTO_GEN_CONSTRAINT_WRAPPER_PREFIX + "ID"));
pn = pn.getChild(0);
assertTrue(pn instanceof SeqScanPlanNode);
// System.out.println("DEBUG: " + pn.toJSONString());
assertTrue(pn.toJSONString().contains("\"TARGET_TABLE_NAME\":\"T\""));
}
示例10: testEng1023
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void testEng1023()
{
AbstractPlanNode pn = compile("select a from t where a = ? and b < ?;");
pn = pn.getChild(0);
if (pn != null) {
System.out.println(pn.toJSONString());
}
assertTrue(pn instanceof IndexScanPlanNode);
IndexScanPlanNode ispn = (IndexScanPlanNode)pn;
assertEquals("COVER2_TREE", ispn.getTargetIndexName());
assertEquals(IndexLookupType.LT, ispn.getLookupType());
assertEquals(2, ispn.getSearchKeyExpressions().size());
}
示例11: testCover2ColumnsWithEquality
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void testCover2ColumnsWithEquality()
{
AbstractPlanNode pn = compile("select a from t where a = ? and b = ?;");
pn = pn.getChild(0);
if (pn != null) {
System.out.println(pn.toJSONString());
}
assertTrue(pn instanceof IndexScanPlanNode);
IndexScanPlanNode ispn = (IndexScanPlanNode)pn;
assertEquals("COVER2_TREE", ispn.getTargetIndexName());
assertEquals(IndexLookupType.EQ, ispn.getLookupType());
assertEquals(2, ispn.getSearchKeyExpressions().size());
}
示例12: testCover3ColumnsInOrderWithLessThan
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void testCover3ColumnsInOrderWithLessThan()
{
AbstractPlanNode pn = compile("select a from t where a = ? and c = ? and b < ?;");
pn = pn.getChild(0);
if (pn != null) {
System.out.println(pn.toJSONString());
}
assertTrue(pn instanceof IndexScanPlanNode);
IndexScanPlanNode ispn = (IndexScanPlanNode)pn;
assertEquals("COVER3_TREE", ispn.getTargetIndexName());
assertEquals(IndexLookupType.LT, ispn.getLookupType());
assertEquals(3, ispn.getSearchKeyExpressions().size());
}
示例13: testCover3ColumnsWithLessThanAndOrderBy
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void testCover3ColumnsWithLessThanAndOrderBy()
{
AbstractPlanNode pn = compile("select a, b from t where a = ? and c = ? and b < ? order by b;");
pn = pn.getChild(0);
if (pn != null) {
System.out.println(pn.toJSONString());
}
assertTrue(pn instanceof IndexScanPlanNode);
IndexScanPlanNode ispn = (IndexScanPlanNode)pn;
assertEquals("COVER3_TREE", ispn.getTargetIndexName());
assertEquals(IndexLookupType.GTE, ispn.getLookupType());
assertEquals(2, ispn.getSearchKeyExpressions().size());
}
示例14: testCover3ColumnsInOrderWithLessThanAndOrderBy
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void testCover3ColumnsInOrderWithLessThanAndOrderBy()
{
AbstractPlanNode pn = compile("select a, b from t where a = ? and c = ? and b < ? order by b;");
pn = pn.getChild(0);
if (pn != null) {
System.out.println(pn.toJSONString());
}
assertTrue(pn instanceof IndexScanPlanNode);
IndexScanPlanNode ispn = (IndexScanPlanNode)pn;
assertEquals("COVER3_TREE", ispn.getTargetIndexName());
assertEquals(IndexLookupType.GTE, ispn.getLookupType());
assertEquals(2, ispn.getSearchKeyExpressions().size());
}
示例15: testCover3ColumnsOutOfOrderWithLessThan
import org.voltdb.types.IndexLookupType; //导入依赖的package包/类
public void testCover3ColumnsOutOfOrderWithLessThan()
{
AbstractPlanNode pn = compile("select a from t where a = ? and b = ? and c < ?;");
pn = pn.getChild(0);
if (pn != null) {
System.out.println(pn.toJSONString());
}
assertTrue(pn instanceof IndexScanPlanNode);
IndexScanPlanNode ispn = (IndexScanPlanNode)pn;
assertEquals("IDX_1_TREE", ispn.getTargetIndexName());
assertEquals(IndexLookupType.LT, ispn.getLookupType());
assertEquals(3, ispn.getSearchKeyExpressions().size());
}