Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> Problem in filters


Copy link to this message
-
Re: Problem in filters
If you specify producIdFilter without using FilterList, what would you get ?

Thanks

On Apr 17, 2013, at 4:51 AM, Omkar Joshi <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I'm having the a table named ORDERS with 1000851 rows:
>
> rowkey :                       ORDER_ID
>
> column family : ORDER_DETAILS
>            columns : CUSTOMER_ID
>                                    PRODUCT_ID
>                                    REQUEST_DATE
>                                    PRODUCT_QUANTITY
>                                    PRICE
>                                    PAYMENT_MODE
>
> I'm using the following code to access the data :
>
> public void executeOrdersQuery() {
>            /*
>            * SELECT ORDER_ID,CUSTOMER_ID,PRODUCT_ID,QUANTITY FROM ORDERS WHERE
>            * QUANTITY >=16 and PRODUCT_ID='P60337998'
>            */
>            String tableName = "ORDERS";
>
>            String family = "ORDER_DETAILS";
>            int quantity = 16;
>            String productId = "P60337998";
>
>            SingleColumnValueFilter quantityFilter = new SingleColumnValueFilter(
>                        Bytes.toBytes(family), Bytes.toBytes("PRODUCT_QUANTITY"),
>                        CompareFilter.CompareOp.GREATER_OR_EQUAL,
>                        Bytes.toBytes(quantity));
>
>            SingleColumnValueFilter productIdFilter = new SingleColumnValueFilter(
>                        Bytes.toBytes(family), Bytes.toBytes("PRODUCT_ID"),
>                        CompareFilter.CompareOp.EQUAL, Bytes.toBytes(productId));
>
>            FilterList filterList = new FilterList(
>                        FilterList.Operator.MUST_PASS_ALL);
>            // filterList.addFilter(quantityFilter);
>            filterList.addFilter(productIdFilter);
>
>            Scan scan = new Scan();
>            scan.addColumn(Bytes.toBytes(family), Bytes.toBytes("ORDER_ID"));
>            scan.addColumn(Bytes.toBytes(family), Bytes.toBytes("CUSTOMER_ID"));
>            scan.addColumn(Bytes.toBytes(family), Bytes.toBytes("PRODUCT_ID"));
>            scan.addColumn(Bytes.toBytes(family), Bytes.toBytes("QUANTITY"));
>
>            scan.setFilter(filterList);
>
>            HTableInterface tbl = hTablePool.getTable(Bytes.toBytes(tableName));
>            ResultScanner scanResults = null;
>            try {
>                  scanResults = tbl.getScanner(scan);
>
>                  System.out.println("scanResults : ");
>
>                  for (Result result : scanResults) {
>                        System.out.println("The result is " + result);
>                  }
>
>            } catch (IOException e) {
>                  // TODO Auto-generated catch block
>                  e.printStackTrace();
>            } finally {
>                  try {
>                        tbl.close();
>                  } catch (IOException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                  }
>            }
>
>      }
>
> First few records of the table are :
>
> O12004457;C110;P60337998;2000-5-17;16;19184.0;cash;Customer is the new emperor. Either you give him what he desires or you are
> banished from his kingdom.;Before you place your order, we reserve the right to change these terms and conditions at any time
> .Any such changes will take effect when posted on this website and it is your responsibility to read these terms and condition
> s on each occasion you use this website. We will never supply you with substitute goods.Our VAT registration number is 875 505
> 5 01.;
>
> O12004458;C425;P50478434;2008-4-30;3;831825.0;debit;In times of change, the learners will inherit the earth, while the knowers
> will find themselves beautifully equipped to deal with a world that no longer exists;Before you place your order, we reserve
> the right to change these terms and conditions at any time.Any such changes will take effect when posted on this website and i
> t is your responsibility to read these terms and conditions on each occasion you use this website. We will never supply you wi
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB