本文整理了Java中org.apache.hadoop.hbase.filter.RowFilter.getOperator
方法的一些代码示例,展示了RowFilter.getOperator
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RowFilter.getOperator
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.filter.RowFilter
类名称:RowFilter
方法名:getOperator
暂无
代码示例来源:origin: apache/drill
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;
}
代码示例来源:origin: apache/drill
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;
}
代码示例来源:origin: com.google.cloud.bigtable/bigtable-hbase
/** {@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;
}
}
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
/** {@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;
}
}
代码示例来源:origin: com.google.cloud.bigtable/bigtable-hbase
/** {@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);
}
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
/** {@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);
}
代码示例来源:origin: org.apache.drill.contrib/drill-storage-hbase
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;
}
代码示例来源:origin: org.apache.drill.contrib/drill-format-mapr
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;
}
内容来源于网络,如有侵权,请联系作者删除!