You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Sahil Aggarwal (JIRA)" <ji...@apache.org> on 2018/06/07 11:57:00 UTC

[jira] [Commented] (HBASE-18612) Update comparators to be more declarative

    [ https://issues.apache.org/jira/browse/HBASE-18612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16504568#comment-16504568 ] 

Sahil Aggarwal commented on HBASE-18612:
----------------------------------------

[~mdrob] On cursory look I see that at some places we use comparators where we compare multiple things, do we intend to convert them to different comparators and chain them instead of having one fat comparator? For eg:

 

In TableDescriptor.getComparator, we compare tableName, then we compare columnFamilies. 

in RegionInfo.COMPARATOR, we compare TableName, startkey, endkey, regionId, replicaId. 

 

Do we intend to chain each compare in all the fat compare methods?

> Update comparators to be more declarative
> -----------------------------------------
>
>                 Key: HBASE-18612
>                 URL: https://issues.apache.org/jira/browse/HBASE-18612
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Mike Drob
>            Priority: Major
>              Labels: beginner, java8
>         Attachments: HBASE-18612-WIP.patch
>
>
> We can write less code if we use factory methods present on Comparator to build the chains. Also has the advantage of being easier to update in the future and hopefully easier for incoming folks to understand.
> See also: https://praveer09.github.io/technology/2016/06/21/writing-comparators-the-java8-way/



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)