public HBaseScanSpec parseTree() { HBaseScanSpec parsedSpec = le.accept(this, null); if (parsedSpec != null) { parsedSpec = mergeScanSpecs("booleanAnd", this.groupScan.getHBaseScanSpec(), parsedSpec); /* * If RowFilter is THE filter attached to the scan specification, * remove it since its effect is also achieved through startRow and stopRow. */ if (parsedSpec.filter instanceof RowFilter && ((RowFilter)parsedSpec.filter).getOperator() != CompareOp.NOT_EQUAL && ((RowFilter)parsedSpec.filter).getComparator() instanceof BinaryComparator) { parsedSpec.filter = null; } } return parsedSpec; }
public HBaseScanSpec parseTree() { HBaseScanSpec parsedSpec = le.accept(this, null); if (parsedSpec != null) { parsedSpec = mergeScanSpecs("booleanAnd", this.groupScan.getHBaseScanSpec(), parsedSpec); /* * If RowFilter is THE filter attached to the scan specification, * remove it since its effect is also achieved through startRow and stopRow. */ Filter filter = parsedSpec.getFilter(); if (filter instanceof RowFilter && ((RowFilter)filter).getOperator() != CompareOp.NOT_EQUAL && ((RowFilter)filter).getComparator() instanceof BinaryComparator) { parsedSpec = new HBaseScanSpec(parsedSpec.getTableName(), parsedSpec.getStartRow(), parsedSpec.getStopRow(), null); } } return parsedSpec; }
/** {@inheritDoc} */ @Override public FilterSupportStatus isFilterSupported( FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) { ByteArrayComparable comparator = filter.getComparator(); if (!(comparator instanceof RegexStringComparator) && !(comparator instanceof BinaryComparator)) { return FilterSupportStatus.newNotSupported(comparator.getClass().getName() + " comparator is not supported"); } if (filter.getOperator() != CompareFilter.CompareOp.EQUAL) { return FilterSupportStatus.newNotSupported(filter.getOperator() + " operator is not supported"); } return FilterSupportStatus.SUPPORTED; } }
/** {@inheritDoc} */ @Override public FilterSupportStatus isFilterSupported( FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) { ByteArrayComparable comparator = filter.getComparator(); if (!(comparator instanceof RegexStringComparator) && !(comparator instanceof BinaryComparator)) { return FilterSupportStatus.newNotSupported(comparator.getClass().getName() + " comparator is not supported"); } if (filter.getOperator() != CompareFilter.CompareOp.EQUAL) { return FilterSupportStatus.newNotSupported(filter.getOperator() + " operator is not supported"); } return FilterSupportStatus.SUPPORTED; } }
/** {@inheritDoc} */ @Override public Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException(String.format("Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); ByteString regexValue; if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { regexValue = ByteString.copyFrom(comparator.getValue()); } else if (comparator instanceof BinaryComparator) { regexValue = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); } else { throw new IllegalStateException(String.format("Cannot adapt comparator %s", comparator .getClass().getCanonicalName())); } return FILTERS.key().regex(regexValue); }
/** {@inheritDoc} */ @Override public Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException(String.format("Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); ByteString regexValue; if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { regexValue = ByteString.copyFrom(comparator.getValue()); } else if (comparator instanceof BinaryComparator) { regexValue = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); } else { throw new IllegalStateException(String.format("Cannot adapt comparator %s", comparator .getClass().getCanonicalName())); } return FILTERS.key().regex(regexValue); }
public HBaseScanSpec parseTree() { HBaseScanSpec parsedSpec = le.accept(this, null); if (parsedSpec != null) { parsedSpec = mergeScanSpecs("booleanAnd", this.groupScan.getHBaseScanSpec(), parsedSpec); /* * If RowFilter is THE filter attached to the scan specification, * remove it since its effect is also achieved through startRow and stopRow. */ if (parsedSpec.filter instanceof RowFilter && ((RowFilter)parsedSpec.filter).getOperator() != CompareOp.NOT_EQUAL && ((RowFilter)parsedSpec.filter).getComparator() instanceof BinaryComparator) { parsedSpec.filter = null; } } return parsedSpec; }
public HBaseScanSpec parseTree() { HBaseScanSpec parsedSpec = le.accept(this, null); if (parsedSpec != null) { parsedSpec = mergeScanSpecs("booleanAnd", this.groupScan.getHBaseScanSpec(), parsedSpec); /* * If RowFilter is THE filter attached to the scan specification, * remove it since its effect is also achieved through startRow and stopRow. */ Filter filter = parsedSpec.getFilter(); if (filter instanceof RowFilter && ((RowFilter)filter).getOperator() != CompareOp.NOT_EQUAL && ((RowFilter)filter).getComparator() instanceof BinaryComparator) { parsedSpec = new HBaseScanSpec(parsedSpec.getTableName(), parsedSpec.getStartRow(), parsedSpec.getStopRow(), null); } } return parsedSpec; }