Java Code Examples for org.apache.hadoop.hbase.filter.CompareFilter.CompareOp#GREATER
The following examples show how to use
org.apache.hadoop.hbase.filter.CompareFilter.CompareOp#GREATER .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HBaseTest.java From xxhadoop with Apache License 2.0 | 6 votes |
@Test public void testScan() throws IOException { Connection connection = admin.getConnection(); Table table = connection.getTable(TableName.valueOf("tbl_girls")); Scan scan = new Scan(Bytes.toBytes("0001"), Bytes.toBytes("0004")); // RowKeyFilter Filter filter = new PrefixFilter(Bytes.toBytes("000")); scan.setFilter(filter); Filter filter2 = new RowFilter(CompareOp.EQUAL, new SubstringComparator("000")); scan.setFilter(filter2); //BinaryComparator binaryComparator = new BinaryComparator(Bytes.toBytes(29)); Filter filter3 = new SingleColumnValueFilter(Bytes.toBytes("base_info"), Bytes.toBytes("age"), CompareOp.GREATER, Bytes.toBytes(29)); scan.setFilter(filter3); ResultScanner resultScanner = table.getScanner(scan); for (Result result : resultScanner) { LOGGER.info(result.toString()); int value = Bytes.toInt(result.getValue(Bytes.toBytes("base_info"), Bytes.toBytes("age"))); LOGGER.info(String.valueOf(value)); } }
Example 2
Source File: HBaseFilterBuilder.java From eagle with Apache License 2.0 | 6 votes |
/** * Convert ComparisonOperator to native HBase CompareOp Support: =, =~,CONTAINS,<,<=,>,>=,!=,!=~ * * @param comp * @return */ protected static CompareOp convertToHBaseCompareOp(ComparisonOperator comp) { if (comp == ComparisonOperator.EQUAL || comp == ComparisonOperator.LIKE || comp == ComparisonOperator.CONTAINS || comp == ComparisonOperator.IN || comp == ComparisonOperator.IS) { return CompareOp.EQUAL; } else if (comp == ComparisonOperator.LESS) { return CompareOp.LESS; } else if (comp == ComparisonOperator.LESS_OR_EQUAL) { return CompareOp.LESS_OR_EQUAL; } else if (comp == ComparisonOperator.GREATER) { return CompareOp.GREATER; } else if (comp == ComparisonOperator.GREATER_OR_EQUAL) { return CompareOp.GREATER_OR_EQUAL; } else if (comp == ComparisonOperator.NOT_EQUAL || comp == ComparisonOperator.NOT_LIKE || comp == ComparisonOperator.NOT_CONTAINS || comp == ComparisonOperator.IS_NOT || comp == ComparisonOperator.NOT_IN) { return CompareOp.NOT_EQUAL; } else { LOG.error("{} operation is not supported now\n", comp); throw new IllegalArgumentException("Illegal operation: " + comp + ", avaliable options: " + Arrays.toString(ComparisonOperator.values())); } }
Example 3
Source File: HBaseFilterBuilder.java From Eagle with Apache License 2.0 | 5 votes |
/** * Convert ComparisonOperator to native HBase CompareOp * * Support: * =, =~,CONTAINS,<,<=,>,>=,!=,!=~ * * @param comp * @return */ protected static CompareOp convertToHBaseCompareOp(ComparisonOperator comp) { if(comp == ComparisonOperator.EQUAL || comp == ComparisonOperator.LIKE || comp == ComparisonOperator.CONTAINS || comp == ComparisonOperator.IN || comp == ComparisonOperator.IS ) { return CompareOp.EQUAL; }else if(comp == ComparisonOperator.LESS) { return CompareOp.LESS; } else if(comp == ComparisonOperator.LESS_OR_EQUAL){ return CompareOp.LESS_OR_EQUAL; }else if(comp == ComparisonOperator.GREATER) { return CompareOp.GREATER; } else if(comp == ComparisonOperator.GREATER_OR_EQUAL){ return CompareOp.GREATER_OR_EQUAL; } else if(comp == ComparisonOperator.NOT_EQUAL || comp == ComparisonOperator.NOT_LIKE || comp == ComparisonOperator.NOT_CONTAINS || comp == ComparisonOperator.IS_NOT || comp == ComparisonOperator.NOT_IN) { return CompareOp.NOT_EQUAL; } else { LOG.error("{} operation is not supported now\n", comp); throw new IllegalArgumentException("Illegal operation: "+comp+ ", avaliable options: "+ Arrays.toString(ComparisonOperator.values())); } }
Example 4
Source File: LessThanParseNode.java From phoenix with Apache License 2.0 | 4 votes |
@Override public CompareOp getInvertFilterOp() { return CompareOp.GREATER; }
Example 5
Source File: LessThanParseNode.java From phoenix with Apache License 2.0 | 4 votes |
@Override public CompareOp getInvertFilterOp() { return CompareOp.GREATER; }
Example 6
Source File: LessThanParseNode.java From phoenix with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public CompareOp getInvertFilterOp() { return CompareOp.GREATER; }