public static Filter andFilterAtIndex(Filter currentFilter, int index, Filter newFilter) { if (currentFilter == null) { return newFilter; } else if (newFilter == null) { return currentFilter; } List<Filter> allFilters = Lists.newArrayList(); if (currentFilter instanceof FilterList && ((FilterList)currentFilter).getOperator() == FilterList.Operator.MUST_PASS_ALL) { allFilters.addAll(((FilterList)currentFilter).getFilters()); } else { allFilters.add(currentFilter); } allFilters.add((index == LAST_FILTER ? allFilters.size() : index), newFilter); return new FilterList(FilterList.Operator.MUST_PASS_ALL, allFilters); }
public static Filter orFilterAtIndex(Filter currentFilter, int index, Filter newFilter) { if (currentFilter == null) { return newFilter; } else if (newFilter == null) { return currentFilter; } List<Filter> allFilters = Lists.newArrayList(); if (currentFilter instanceof FilterList && ((FilterList)currentFilter).getOperator() == FilterList.Operator.MUST_PASS_ONE) { allFilters.addAll(((FilterList)currentFilter).getFilters()); } else { allFilters.add(currentFilter); } allFilters.add((index == LAST_FILTER ? allFilters.size() : index), newFilter); return new FilterList(FilterList.Operator.MUST_PASS_ONE, allFilters); }
static Optional<Filter> createFilter(Object[] args) { if (args.length == 0) { return Optional.empty(); } FilterList filters = new FilterList(); for (int i = 0; i < args.length; i++) { Object filter = args[i]; try { checkArgument(filter instanceof Filter, "Filter " + i + " must be of type " + Filter.class.getName() + " but is of type " + filter.getClass().getName()); } catch (IllegalArgumentException e) { throw new CacheLoaderException(e); } filters.addFilter((Filter) filter); } return Optional.of(filters); }
@Test public void testTwoFilterWithMustAllPassFailed() throws IOException { clean(); { Put put = new Put(Bytes.toBytes(rowPrefix)); put.addColumn(Bytes.toBytes(familyName), Bytes.toBytes("col_1"), Bytes.toBytes("col_1_var")); put.addColumn(Bytes.toBytes(familyName), Bytes.toBytes("col_2"), Bytes.toBytes("col_2_var")); table.put(put); } { Get get = new Get(Bytes.toBytes(rowPrefix)); Filter filter1 = new SingleColumnValueFilter(Bytes.toBytes(familyName), Bytes.toBytes("col_1"), CompareFilter.CompareOp.EQUAL, Bytes.toBytes("col_1_var")); Filter filter2 = new SingleColumnValueFilter(Bytes.toBytes(familyName), Bytes.toBytes("col_2"), CompareFilter.CompareOp.NOT_EQUAL, Bytes.toBytes("col_2_var")); FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL); filterList.addFilter(filter1); filterList.addFilter(filter2); get.setFilter(filterList); Result result = table.get(get); assertTrue(result.getRow() == null); } }
@Test public void testTwoFilterWithMustOnePassFailed() throws IOException { clean(); { Put put = new Put(Bytes.toBytes(rowPrefix)); put.addColumn(Bytes.toBytes(familyName), Bytes.toBytes("col_1"), Bytes.toBytes("col_1_var")); put.addColumn(Bytes.toBytes(familyName), Bytes.toBytes("col_2"), Bytes.toBytes("col_2_var")); table.put(put); } { Get get = new Get(Bytes.toBytes(rowPrefix)); Filter filter1 = new SingleColumnValueFilter(Bytes.toBytes(familyName), Bytes.toBytes("col_1"), CompareFilter.CompareOp.NOT_EQUAL, Bytes.toBytes("col_1_var")); Filter filter2 = new SingleColumnValueFilter(Bytes.toBytes(familyName), Bytes.toBytes("col_2"), CompareFilter.CompareOp.NOT_EQUAL, Bytes.toBytes("col_2_var")); FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL); filterList.addFilter(filter1); filterList.addFilter(filter2); get.setFilter(filterList); Result result = table.get(get); assertTrue(result.getRow() == null); } }
private void doRawScan() throws IOException { FilterList filterList = new FilterList(); CompareFilter.CompareOp startOp = CompareFilter.CompareOp.GREATER_OR_EQUAL; CompareFilter.CompareOp stopOp = CompareFilter.CompareOp.LESS_OR_EQUAL; for (int i = 0; i < indexColumnNames.length && i < scanValues.length; i++) { filterList.addFilter( new SingleColumnValueFilter(familyName, Bytes.toBytes(indexColumnNames[i]), startOp, Bytes.toBytes(scanValues[i][0]))); filterList.addFilter( new SingleColumnValueFilter(familyName, Bytes.toBytes(indexColumnNames[i]), stopOp, Bytes.toBytes(scanValues[i][1]))); } Scan scan = new Scan(); scan.setFilter(filterList); scan.setId("raw-scan"); Table table = conn.getTable(tableName); ResultScanner scanner = table.getScanner(scan); Result result; int count = 0; while ((result = scanner.next()) != null) { ++count; if (PRINT_RESULT) printResult(result); } scanner.close(); System.out.println("raw scan has " + count + " records"); }
public static ConditionTree preprocess(HRegion region, Filter filter, float maxScale) { if (filter == null) return null; ConditionTree tree = null; if (isIndexFilter(region, filter)) { System.out.println("preprocess A"); tree = new ConditionTreeNoneLeafNode(region, (SingleColumnValueFilter) filter, maxScale); } else if (filter instanceof FilterList) { System.out.println("preprocess B"); tree = new ConditionTreeNoneLeafNode(region, (FilterList) filter, maxScale); } if (tree.isPrune()) { System.out.println("return null for prune"); return null; } else { return tree; } }
@Override void testRow(final int i) throws IOException { Scan scan = new Scan(getRandomRow(this.rand, opts.totalRows)); scan.setCaching(opts.caching); FilterList list = new FilterList(); if (opts.addColumns) { scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); } else { scan.addFamily(FAMILY_NAME); } if (opts.filterAll) { list.addFilter(new FilterAllFilter()); } list.addFilter(new WhileMatchFilter(new PageFilter(120))); scan.setFilter(list); ResultScanner s = this.table.getScanner(scan); for (Result rr; (rr = s.next()) != null;) { updateValueSize(rr); } s.close(); }
protected Scan constructScan(byte[] valuePrefix) throws IOException { FilterList list = new FilterList(); Filter filter = new SingleColumnValueFilter( FAMILY_NAME, COLUMN_ZERO, CompareFilter.CompareOp.EQUAL, new BinaryComparator(valuePrefix) ); list.addFilter(filter); if(opts.filterAll) { list.addFilter(new FilterAllFilter()); } Scan scan = new Scan(); scan.setCaching(opts.caching); if (opts.addColumns) { scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); } else { scan.addFamily(FAMILY_NAME); } scan.setFilter(list); return scan; }
private ResultScanner buildScanner(String keyPrefix, String value, Table ht) throws IOException { // OurFilterList allFilters = new OurFilterList(); FilterList allFilters = new FilterList(/* FilterList.Operator.MUST_PASS_ALL */); allFilters.addFilter(new PrefixFilter(Bytes.toBytes(keyPrefix))); SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes .toBytes("trans-tags"), Bytes.toBytes("qual2"), CompareOp.EQUAL, Bytes .toBytes(value)); filter.setFilterIfMissing(true); allFilters.addFilter(filter); // allFilters.addFilter(new // RowExcludingSingleColumnValueFilter(Bytes.toBytes("trans-tags"), // Bytes.toBytes("qual2"), CompareOp.EQUAL, Bytes.toBytes(value))); Scan scan = new Scan(); scan.addFamily(Bytes.toBytes("trans-blob")); scan.addFamily(Bytes.toBytes("trans-type")); scan.addFamily(Bytes.toBytes("trans-date")); scan.addFamily(Bytes.toBytes("trans-tags")); scan.addFamily(Bytes.toBytes("trans-group")); scan.setFilter(allFilters); return ht.getScanner(scan); }
private InternalScanner buildScanner(String keyPrefix, String value, HRegion r) throws IOException { // Defaults FilterList.Operator.MUST_PASS_ALL. FilterList allFilters = new FilterList(); allFilters.addFilter(new PrefixFilter(Bytes.toBytes(keyPrefix))); // Only return rows where this column value exists in the row. SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes.toBytes("trans-tags"), Bytes.toBytes("qual2"), CompareOp.EQUAL, Bytes.toBytes(value)); filter.setFilterIfMissing(true); allFilters.addFilter(filter); Scan scan = new Scan(); scan.addFamily(Bytes.toBytes("trans-blob")); scan.addFamily(Bytes.toBytes("trans-type")); scan.addFamily(Bytes.toBytes("trans-date")); scan.addFamily(Bytes.toBytes("trans-tags")); scan.addFamily(Bytes.toBytes("trans-group")); scan.setFilter(allFilters); return r.getScanner(scan); }
private Scan getVertexIndexScanWithLimit(String label, boolean isUnique, String key, Object from, int limit, boolean reversed) { byte[] prefix = serializeForRead(label, isUnique, key, null); byte[] startRow = from != null ? serializeForRead(label, isUnique, key, from) : prefix; byte[] stopRow = HConstants.EMPTY_END_ROW; if (graph.configuration().getInstanceType() == HBaseGraphConfiguration.InstanceType.BIGTABLE) { if (reversed) { throw new UnsupportedOperationException("Reverse scans not supported by Bigtable"); } else { // PrefixFilter in Bigtable does not automatically stop // See https://github.com/GoogleCloudPlatform/cloud-bigtable-client/issues/1087 stopRow = HBaseGraphUtils.incrementBytes(prefix); } } if (reversed) startRow = HBaseGraphUtils.incrementBytes(startRow); Scan scan = new Scan(startRow, stopRow); FilterList filterList = new FilterList(); filterList.addFilter(new PrefixFilter(prefix)); filterList.addFilter(new PageFilter(limit)); scan.setFilter(filterList); scan.setReversed(reversed); return scan; }
private FilterList getColumnValueFilters(Row row) { FilterList filterList = new FilterList(Operator.MUST_PASS_ALL); Set<String> filterColumnNames = Sets.newHashSet(row.schema().fieldNames()); for (Map.Entry<String, ColumnDef> column : columns.entrySet()) { if (!column.getValue().cf.equals("rowkey")) { if (filterColumnNames.contains(column.getKey())) { byte[] value = getColumnValueAsBytes(column.getValue().name, column.getValue().type, row); if (value != null) { SingleColumnValueFilter columnValueFilter = new SingleColumnValueFilter( Bytes.toBytes(column.getValue().cf), Bytes.toBytes(column.getValue().name), CompareFilter.CompareOp.EQUAL, value ); filterList.addFilter(columnValueFilter); } } } } return filterList; }
@Override public void run() { try (HTableInterface table = connection.getTable(tableName.getBytes())) { // Do not use Get not to increase read request count metric. // Use Scan. Scan scan = new Scan("".getBytes(), "".getBytes()); FilterList filterList = new FilterList(); filterList.addFilter(new KeyOnlyFilter()); filterList.addFilter(new FirstKeyOnlyFilter()); scan.setFilter(filterList); //noinspection EmptyTryBlock try(ResultScanner ignored = table.getScanner(scan)) { } return; } catch (IOException ignore) { } clean(tableName); }
private static Filter constructFilterForContain( HBaseColumnSchema hbaseColumnSchema, CompareOp compareOp, List<Object> list, Operator operator) { Util.checkNull(hbaseColumnSchema); Util.checkNull(compareOp); Util.checkNull(list); Util.checkNull(operator); List<Filter> filters = new ArrayList<Filter>(); for (Object obj : list) { filters.add(constructFilter(hbaseColumnSchema, compareOp, obj)); } FilterList filterList = new FilterList(operator, filters); return filterList; }
public static boolean isReallyEmptyRegion(HConnection connection, String tableName, HRegionInfo regionInfo) throws IOException { boolean emptyRegion = false; // verify really empty region by scanning records try (HTableInterface table = connection.getTable(tableName)) { Scan scan = new Scan(regionInfo.getStartKey(), regionInfo.getEndKey()); FilterList filterList = new FilterList(); filterList.addFilter(new KeyOnlyFilter()); filterList.addFilter(new FirstKeyOnlyFilter()); scan.setFilter(filterList); scan.setCacheBlocks(false); scan.setSmall(true); scan.setCaching(1); try (ResultScanner scanner = table.getScanner(scan)) { if (scanner.next() == null) emptyRegion = true; } } return emptyRegion; }
public void testCustomWritable() throws Exception { Configuration conf = HBaseConfiguration.create(); // test proper serialization of un-encoded custom writables CustomWritable custom = new CustomWritable("test phrase"); Object obj = doType(conf, custom, CustomWritable.class); assertTrue(obj instanceof Writable); assertTrue(obj instanceof CustomWritable); assertEquals("test phrase", ((CustomWritable)obj).getValue()); // test proper serialization of a custom filter CustomFilter filt = new CustomFilter("mykey"); FilterList filtlist = new FilterList(FilterList.Operator.MUST_PASS_ALL); filtlist.addFilter(filt); obj = doType(conf, filtlist, FilterList.class); assertTrue(obj instanceof FilterList); assertNotNull(((FilterList)obj).getFilters()); assertEquals(1, ((FilterList)obj).getFilters().size()); Filter child = ((FilterList)obj).getFilters().get(0); assertTrue(child instanceof CustomFilter); assertEquals("mykey", ((CustomFilter)child).getKey()); }
@Override public ResultScanner getScanner() throws IOException { Scan scan = new Scan(); FilterList filters = new FilterList(); for (Range range : ranges) { if (range.getStartValue() != null) { filters.addFilter(new SingleColumnValueFilter(range.getFamily(), range.getQualifier(), range.getStartType(), range.getStartValue())); } if (range.getStopValue() != null) { filters.addFilter(new SingleColumnValueFilter(range.getFamily(), range.getQualifier(), range.getStopType(), range.getStopValue())); } System.out.println("coffey hbase main index range: " + Bytes.toString(range.getColumn()) + " [" + LCCIndexConstant.getStringOfValueAndType(range.getDataType(), range.getStartValue()) + "," + LCCIndexConstant.getStringOfValueAndType(range.getDataType(), range.getStopValue()) + "]"); scan.setCacheBlocks(false); } scan.setCacheBlocks(false); scan.setFilter(filters); return table.getScanner(scan); }
@Override public ResultScanner getScanner() throws IOException { Scan scan = new Scan(); RangeList list = new RangeList(); FilterList filters = new FilterList(); for (Range r : ranges) { list.addRange(r); if (r.getStartValue() != null) { filters.addFilter(new SingleColumnValueFilter(Bytes.toBytes(TPCHConstants.FAMILY_NAME), r .getQualifier(), r.getStartType(), r.getStartValue())); } if (r.getStopValue() != null) { filters.addFilter(new SingleColumnValueFilter(Bytes.toBytes(TPCHConstants.FAMILY_NAME), r .getQualifier(), r.getStopType(), r.getStopValue())); } } scan.setFilter(filters); scan.setAttribute(IndexConstants.SCAN_WITH_INDEX, Writables.getBytes(list)); scan.setAttribute(IndexConstants.MAX_SCAN_SCALE, Bytes.toBytes(0.3)); scan.setCacheBlocks(false); return table.getScanner(scan); }
@Override public Filter visitBetweenvar(BetweenvarContext ctx) { CidContext cidContext = ctx.cid(); List<VarContext> varContextList = ctx.var(); HBaseColumnSchema hbaseColumnSchema = ContextUtil .parseHBaseColumnSchema(hbaseTableConfig, cidContext); List<Object> list = ContextUtil.parseParaList(varContextList, para); Filter startFilter = constructFilter(hbaseColumnSchema, CompareOp.GREATER_OR_EQUAL, list.get(0)); Filter endFilter = constructFilter(hbaseColumnSchema, CompareOp.LESS_OR_EQUAL, list.get(1)); FilterList filterList = new FilterList(Operator.MUST_PASS_ALL, Arrays.asList(startFilter, endFilter)); return filterList; }
@Override public ResultScanner getScanner() throws IOException { Scan scan = new Scan(); FilterList filters = new FilterList(); List<CF_INFO> cfs = PutTestConstants.getCFInfo(); for (CF_INFO ci : cfs) { if (ci.isIndex) { filters.addFilter(new SingleColumnValueFilter(Bytes.toBytes(FAMILY_NAME), Bytes .toBytes(ci.qualifier), CompareOp.GREATER_OR_EQUAL, LCCIndexConstant .parsingStringToBytesWithType(ci.type, String.valueOf(startValue)))); filters.addFilter(new SingleColumnValueFilter(Bytes.toBytes(FAMILY_NAME), Bytes .toBytes(ci.qualifier), CompareOp.LESS_OR_EQUAL, LCCIndexConstant .parsingStringToBytesWithType(ci.type, String.valueOf(stopValue)))); System.out.println("coffey hbase add filter for type: " + ci.type + " [" + startValue + "," + stopValue + "]"); } } scan.setCacheBlocks(false); scan.setFilter(filters); return table.getScanner(scan); }
@Override public Filter visitBetweenconstant(BetweenconstantContext ctx) { CidContext cidContext = ctx.cid(); HBaseColumnSchema hbaseColumnSchema = ContextUtil .parseHBaseColumnSchema(hbaseTableConfig, cidContext); List<ConstantContext> constantContextList = ctx.constant(); List<Object> list = ContextUtil.parseConstantList(hbaseColumnSchema, constantContextList, runtimeSetting); Filter startFilter = constructFilter(hbaseColumnSchema, CompareOp.GREATER_OR_EQUAL, list.get(0)); Filter endFilter = constructFilter(hbaseColumnSchema, CompareOp.LESS_OR_EQUAL, list.get(1)); FilterList filterList = new FilterList(Operator.MUST_PASS_ALL, Arrays.asList(startFilter, endFilter)); return filterList; }
protected void addTimeConstraints(Scan scan) { List<Filter> filters = new ArrayList<>(); if(context.getQuery().getAfter() != null) { filters.add(new SingleColumnValueFilter(Schema.F_INFO, Schema.Q_EPOCH, CompareFilter.CompareOp.GREATER_OR_EQUAL, Bytes.toBytes(context.getQuery().getAfter()))); } if(context.getQuery().getBefore() != null) { filters.add(new SingleColumnValueFilter(Schema.F_INFO, Schema.Q_EPOCH, CompareFilter.CompareOp.LESS_OR_EQUAL, Bytes.toBytes(context.getQuery().getBefore()))); } if(!filters.isEmpty()) { FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL, filters); scan.setFilter(filterList); } }
/** * Gets filter based on the condition to be performed * @param condition To be applied server sided * @param passAll boolean if all elements have to pass the test * @param famNames to be checked * @param qualNames to be checked * @param params that could be needed * @return FilterList containing all filters needed */ public FilterList getFilter(XPath condition, boolean passAll, String []famNames, String []qualNames, String []params) { FilterList list = new FilterList((passAll)?FilterList.Operator.MUST_PASS_ALL: FilterList.Operator.MUST_PASS_ONE); for (int iCont = 0; iCont < famNames.length; iCont ++) { SingleColumnValueFilter filterTmp = new SingleColumnValueFilter( Bytes.toBytes(famNames[iCont]), Bytes.toBytes(qualNames[iCont]), CompareOp.EQUAL, Bytes.toBytes(params[iCont]) ); list.addFilter(filterTmp); } return list; }
@Override void testRow(final int i) throws IOException { Scan scan = new Scan(getRandomRow(this.rand, opts.totalRows)); FilterList list = new FilterList(); scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); if (opts.filterAll) { list.addFilter(new FilterAllFilter()); } list.addFilter(new WhileMatchFilter(new PageFilter(120))); scan.setFilter(list); ResultScanner s = this.table.getScanner(scan); for (Result rr; (rr = s.next()) != null;) { updateValueSize(rr); } s.close(); }
@Override public Filter visitNotbetweenconstant(NotbetweenconstantContext ctx) { CidContext cidContext = ctx.cid(); HBaseColumnSchema hbaseColumnSchema = ContextUtil .parseHBaseColumnSchema(hbaseTableConfig, cidContext); List<ConstantContext> constantContextList = ctx.constant(); List<Object> list = ContextUtil.parseConstantList(hbaseColumnSchema, constantContextList, runtimeSetting); Filter startFilter = constructFilter(hbaseColumnSchema, CompareOp.LESS, list.get(0)); Filter endFilter = constructFilter(hbaseColumnSchema, CompareOp.GREATER, list.get(1)); FilterList filterList = new FilterList(Operator.MUST_PASS_ONE, Arrays.asList(startFilter, endFilter)); return filterList; }
@Override public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { Authorizations authorizations = null; // If a super user issues a get, he should be able to scan the cells // irrespective of the Visibility labels if (checkIfScanOrGetFromSuperUser()) { return; } try { authorizations = get.getAuthorizations(); } catch (DeserializationException de) { throw new IOException(de); } Filter visibilityLabelFilter = createVisibilityLabelFilter(e.getEnvironment().getRegion(), authorizations); if (visibilityLabelFilter != null) { Filter filter = get.getFilter(); if (filter != null) { get.setFilter(new FilterList(filter, visibilityLabelFilter)); } else { get.setFilter(visibilityLabelFilter); } } }
private ResultScanner buildScanner(String keyPrefix, String value, HTable ht) throws IOException { // OurFilterList allFilters = new OurFilterList(); FilterList allFilters = new FilterList(/* FilterList.Operator.MUST_PASS_ALL */); allFilters.addFilter(new PrefixFilter(Bytes.toBytes(keyPrefix))); SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes .toBytes("trans-tags"), Bytes.toBytes("qual2"), CompareOp.EQUAL, Bytes .toBytes(value)); filter.setFilterIfMissing(true); allFilters.addFilter(filter); // allFilters.addFilter(new // RowExcludingSingleColumnValueFilter(Bytes.toBytes("trans-tags"), // Bytes.toBytes("qual2"), CompareOp.EQUAL, Bytes.toBytes(value))); Scan scan = new Scan(); scan.addFamily(Bytes.toBytes("trans-blob")); scan.addFamily(Bytes.toBytes("trans-type")); scan.addFamily(Bytes.toBytes("trans-date")); scan.addFamily(Bytes.toBytes("trans-tags")); scan.addFamily(Bytes.toBytes("trans-group")); scan.setFilter(allFilters); return ht.getScanner(scan); }
private Filter handleFilterWithinAND(Filter filter) { if (filter instanceof FilterList) { FilterList fList = (FilterList) filter; if (fList.getOperator() == Operator.MUST_PASS_ONE) { return new FilterGroupingWorker().group(fList); } else { List<Filter> filters = fList.getFilters(); for (Filter subFilter : filters) { handleFilterWithinAND(subFilter); } } } else if (filter instanceof SingleColumnValueFilter) { handleScvf((SingleColumnValueFilter) filter); } // TODO when we expose SingleColumnRangeFilter to handle that also here. return null; }
private void addORColsToFinalList(FilterList filterList) { for (Entry<Column, List<Value>> entry : colWithOperatorsOfOR.entrySet()) { List<Value> valueList = entry.getValue(); for (Value value : valueList) { if (value.getOperator() == CompareOp.EQUAL) { filterList.addFilter(value.getFilter()); } else { SingleColumnRangeFilter rangeFltr = new SingleColumnRangeFilter(entry.getKey().getFamily(), entry.getKey().getQualifier(), entry.getKey().getValuePartition(), value.getValue(), value.getOperator(), null, null); filterList.addFilter(rangeFltr); } } } }
FilterNode evalFilterForIndexSelection(Filter filter, List<IndexSpecification> indices) { if (filter instanceof FilterList) { FilterList fList = (FilterList) filter; GroupingCondition condition = (fList.getOperator() == Operator.MUST_PASS_ALL) ? GroupingCondition.AND : GroupingCondition.OR; NonLeafFilterNode nonLeafFilterNode = new NonLeafFilterNode(condition); List<Filter> filters = fList.getFilters(); for (Filter fltr : filters) { FilterNode node = evalFilterForIndexSelection(fltr, indices); nonLeafFilterNode.addFilterNode(node); } return handleNonLeafFilterNode(nonLeafFilterNode); } else if (filter instanceof SingleColumnValueFilter) { // Check for the availability of index return selectBestFitAndPossibleIndicesForSCVF(indices, (SingleColumnValueFilter) filter); } else if (filter instanceof SingleColumnRangeFilter) { return selectBestFitAndPossibleIndicesForSCRF(indices, (SingleColumnRangeFilter) filter); } return new NoIndexFilterNode(); }
@Override public Filter visitNotbetweenvar(NotbetweenvarContext ctx) { CidContext cidContext = ctx.cid(); List<VarContext> varContextList = ctx.var(); HBaseColumnSchema hbaseColumnSchema = ContextUtil .parseHBaseColumnSchema(hbaseTableConfig, cidContext); List<Object> list = ContextUtil.parseParaList(varContextList, para); Filter startFilter = constructFilter(hbaseColumnSchema, CompareOp.LESS, list.get(0)); Filter endFilter = constructFilter(hbaseColumnSchema, CompareOp.GREATER, list.get(1)); FilterList filterList = new FilterList(Operator.MUST_PASS_ONE, Arrays.asList(startFilter, endFilter)); return filterList; }