分享

hbase轻量级中间件simplehbase v1.0简介

zhang_xzhi 发表于 2014-12-13 20:34:18 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 5 16501
https://github.com/zhang-xzhi/simplehbase/
https://github.com/zhang-xzhi/simplehbase/wiki


simplehbase的主要功能

数据类型映射:java类型和hbase的bytes之间的数据转换。
简单操作封装:封装了hbase的put,get,scan等操作为简单的java操作方式。
hbase query封装:封装了hbase的filter,可以使用sql-like的方式操作hbase。
动态query封装:类似于myibatis,可以使用xml配置动态语句查询hbase。
insert,update支持: 建立在hbase的checkAndPut之上。
hbase多版本支持:提供接口可以对hbase多版本数据进行查询,映射。
hbase批量操作支持。
hbase原生接口支持。
HTablePool管理。
HTable count和sum功能。




V1.0发布note.

Data Object需要被simpleHbase识别,除了原有annotation方式,新增POJO和xml配置方式。

新增count的实现,count时可以limit。

public long count(RowKey startRowKey, RowKey endRowKey,
@Nullable AggregateExtInfo aggregateExtInfo);
public long count(RowKey startRowKey, RowKey endRowKey,
@Nullable String id, @Nullable Map para,
@Nullable AggregateExtInfo aggregateExtInfo);

新增countAndSum。

public long[] countAndSum(RowKey startRowKey, RowKey endRowKey);
public long[] countAndSum(RowKey startRowKey, RowKey endRowKey,
@Nullable AggregateExtInfo aggregateExtInfo);
public long[] countAndSum(RowKey startRowKey, RowKey endRowKey,
@Nullable String id, @Nullable Map para);
public long[] countAndSum(RowKey startRowKey, RowKey endRowKey,
@Nullable String id, @Nullable Map para,
@Nullable AggregateExtInfo aggregateExtInfo);

新增batch get功能。

public List findObjectBatch(List rowKeyList,Class<? extends T> type);
public List> findObjectAndKeyBatch(List rowKeyList, Class<? extends T> type);

增加异常描述family和qualifier,rowKeyHandler,方便问题排查。

调整测试代码。

已有(5)人评论

跳转到指定楼层
271592448 发表于 2014-12-15 09:12:08
group by 之类的sql函数能封装下就好了。
回复

使用道具 举报

uu_snow 发表于 2015-1-4 16:11:21
“动态query封装:类似于myibatis,可以使用xml配置动态语句查询hbase。”

这个功能在什么情况下会用到?
hbase上的数据查询都要基于ROWKEY,还需要动态query吗?
回复

使用道具 举报

uu_snow 发表于 2015-1-4 16:18:57
楼主,hbase0.98.x中,操作HTable的方式都变了
你的这个产品是对应的0.98.x这个版本吗?
回复

使用道具 举报

zhang_xzhi 发表于 2015-1-7 16:43:56
当有动态查询的时候用到 可以参考一下ibatis的使用场景。

目前有对应0.98.x的版本 可以看github上面的release记录。
回复

使用道具 举报

zhang_xzhi 发表于 2015-1-7 16:45:41
本帖最后由 zhang_xzhi 于 2015-1-7 16:46 编辑
uu_snow 发表于 2015-1-4 16:11
“动态query封装:类似于myibatis,可以使用xml配置动态语句查询hbase。”

这个功能在什么情况下会用到 ...

还是有用的,比如scan一段数据,有可能根据不同的列做动态过滤。

    <statement id="queryByNameAndAge">
            select where id greaterequal #id#
            <isPropertyAvailable prepend="and" property="name">
                name equal #name#
            </isPropertyAvailable>
            <isPropertyAvailable prepend="and" property="age">
                age greater #age#
            </isPropertyAvailable>
        </statement>   
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条