Exemple #1
0
    public List<Map<String, Object>> execute(String columnNames[]) {
      List<Map<String, Object>> combinedRowList = null;
      Set<NoSqlPredicate> inefficientPredicates = new HashSet<NoSqlPredicate>();
      for (NoSqlPredicate predicate : predicateList) {
        if (predicate.canExecuteEfficiently()) {
          List<Map<String, Object>> rowList = predicate.execute(columnNames);
          if (combinedRowList != null) {
            String primaryKeyName = storageSource.getTablePrimaryKeyName(tableName);
            combinedRowList = combineRowLists(primaryKeyName, combinedRowList, rowList, operator);
          } else {
            combinedRowList = rowList;
          }
        } else {
          inefficientPredicates.add(predicate);
        }
      }

      if (inefficientPredicates.isEmpty()) return combinedRowList;

      List<Map<String, Object>> filteredRowList = new ArrayList<Map<String, Object>>();
      for (Map<String, Object> row : combinedRowList) {
        for (NoSqlPredicate predicate : inefficientPredicates) {
          if (predicate.matchesRow(row)) {
            filteredRowList.add(row);
          }
        }
      }

      return filteredRowList;
    }
Exemple #2
0
    public List<Map<String, Object>> execute(String columnNameList[]) {
      List<Map<String, Object>> rowList;
      if (isEqualityRange())
        rowList =
            storageSource.executeEqualityQuery(tableName, columnNameList, columnName, startValue);
      else
        rowList =
            storageSource.executeRangeQuery(
                tableName,
                columnNameList,
                columnName,
                startValue,
                startInclusive,
                endValue,
                endInclusive);

      return rowList;
    }
Exemple #3
0
 public boolean canExecuteEfficiently() {
   ColumnIndexMode indexMode = storageSource.getColumnIndexMode(tableName, columnName);
   switch (indexMode) {
     case NOT_INDEXED:
       return false;
     case RANGE_INDEXED:
       return true;
     case EQUALITY_INDEXED:
       return isEqualityRange();
   }
   return true;
 }