From 97bd39a27daa19ab87b11cb2aa3b1ccfbaa5c467 Mon Sep 17 00:00:00 2001 From: Imran M Yousuf Date: Wed, 25 Aug 2010 11:43:19 +0600 Subject: [PATCH] Add simple query param API based read implementation in DAO Currently only a very small subset of the query API is implemented. Only operations on a property, i.e. cell, is supported comprehensively enough to be compared to the SQL implementation. Conjunction and disjunction is also supported quite comprehensively. Next step would be to add a test case for testing the read and write operations. Signed-off-by: Imran M Yousuf --- .../dao/impl/hbase/AbstractCommonDao.java | 353 ++++++++++++++++++++- 1 file changed, 342 insertions(+), 11 deletions(-) diff --git a/smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/AbstractCommonDao.java b/smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/AbstractCommonDao.java index 7bb875d..4aec844 100644 --- a/smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/AbstractCommonDao.java +++ b/smart-hbase-dao/src/main/java/com/smartitengineering/dao/impl/hbase/AbstractCommonDao.java @@ -20,12 +20,27 @@ package com.smartitengineering.dao.impl.hbase; import com.smartitengineering.dao.common.CommonReadDao; import com.smartitengineering.dao.common.CommonWriteDao; +import com.smartitengineering.dao.common.queryparam.BasicCompoundQueryParameter; +import com.smartitengineering.dao.common.queryparam.BiOperandQueryParameter; +import com.smartitengineering.dao.common.queryparam.MatchMode; +import com.smartitengineering.dao.common.queryparam.OperatorType; +import com.smartitengineering.dao.common.queryparam.ParameterType; import com.smartitengineering.dao.common.queryparam.QueryParameter; +import com.smartitengineering.dao.common.queryparam.QueryParameterCastHelper; +import com.smartitengineering.dao.common.queryparam.QueryParameterWithOperator; +import com.smartitengineering.dao.common.queryparam.QueryParameterWithPropertyName; +import com.smartitengineering.dao.common.queryparam.QueryParameterWithValue; +import com.smartitengineering.dao.common.queryparam.ValueOnlyQueryParameter; +import com.smartitengineering.dao.impl.hbase.spi.FilterConfig; import com.smartitengineering.dao.impl.hbase.spi.ObjectRowConverter; import com.smartitengineering.dao.impl.hbase.spi.SchemaInfoProvider; +import com.smartitengineering.dao.impl.hbase.spi.impl.BinarySuffixComparator; +import com.smartitengineering.dao.impl.hbase.spi.impl.RangeComparator; import com.smartitengineering.domain.PersistentDTO; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -39,20 +54,43 @@ import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.hadoop.hbase.client.HTablePool; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.client.ResultScanner; +import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.filter.BinaryComparator; +import org.apache.hadoop.hbase.filter.BinaryPrefixComparator; +import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; +import org.apache.hadoop.hbase.filter.Filter; +import org.apache.hadoop.hbase.filter.FilterList; +import org.apache.hadoop.hbase.filter.FilterList.Operator; +import org.apache.hadoop.hbase.filter.SingleColumnValueExcludeFilter; +import org.apache.hadoop.hbase.filter.SkipFilter; +import org.apache.hadoop.hbase.filter.SubstringComparator; +import org.apache.hadoop.hbase.filter.WritableByteArrayComparable; import org.apache.hadoop.hbase.util.Bytes; /** - * + * A common DAO implementation for HBase. Please note that all parameters for reading (i.e. Scan) assumes that the + * toString() method returns the string representation of the value to be compared in byte[] form. * @author imyousuf */ public class AbstractCommonDao