[ 
https://issues.apache.org/jira/browse/CAMEL-7296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

liugang updated CAMEL-7296:
---------------------------

    Description: 
After I tried a little bit, I think there are 2 problems on Consumer side:
# Returned value is null
if we specified family and qualifier options in URI, then all returned values 
will be null.  I did some investigation, and I found the problem is caused by 
the equals method of HBaseCell class. In poll() method of HBaseConsumer, the 
resultRow will apply rowModel first before insert the resultCell, see below 
code:
{code}
             ....
              HBaseData data = new HBaseData();
                HBaseRow resultRow = new HBaseRow();
                resultRow.apply(rowModel);       //the existing HBaseCell in 
rowModel will be insert into resultRow
                byte[] row = result.getRow();
                
resultRow.setId(endpoint.getCamelContext().getTypeConverter().convertTo(rowModel.getRowType(),
 row));

                List<KeyValue> keyValues = result.list();
                if (keyValues != null) {
                    for (KeyValue keyValue : keyValues) {
                        String qualifier = new String(keyValue.getQualifier());
                        String family = new String(keyValue.getFamily());
                        HBaseCell resultCell = new HBaseCell();
                        resultCell.setFamily(family);
                        resultCell.setQualifier(qualifier);
                        
resultCell.setValue(endpoint.getCamelContext().getTypeConverter().convertTo(String.class,
 keyValue.getValue()));
                        resultRow.getCells().add(resultCell); //will fail to 
insert if some cell with same Family and Qualifier exists
                    }
                    ...
              }
{code} 
that means we can't specify family and qualifier option when consuming.
# remove option
the default value of remove option is true, that mean, after scan the table, 
all scanned row will be removed. I think it's not we expect, so user may have 
to add option remove=false to stop that. however this option doesn't describe 
on website http://camel.apache.org/hbase.html .

Besides these problem, I think some descriptions on 
http://camel.apache.org/hbase.html are not correct, for example the demos and 
Header Options. please have a check.

  was:
After I tried a little bit, I think there are 2 problems on Consumer side:
# Returned value is null
if we specified family and qualifier options in URI, then all returned values 
will be null.  I did some investigation, and I found the problem is caused by 
the equals method of HBaseCell class. In poll() method of HBaseConsumer, the 
resultRow will apply rowModel first before insert the resultCell, see below 
code:
{code}
             ....
              HBaseData data = new HBaseData();
                HBaseRow resultRow = new HBaseRow();
                resultRow.apply(rowModel);       //the existing HBaseCell in 
rowModel will be insert into resultRow
                byte[] row = result.getRow();
                
resultRow.setId(endpoint.getCamelContext().getTypeConverter().convertTo(rowModel.getRowType(),
 row));

                List<KeyValue> keyValues = result.list();
                if (keyValues != null) {
                    for (KeyValue keyValue : keyValues) {
                        String qualifier = new String(keyValue.getQualifier());
                        String family = new String(keyValue.getFamily());
                        HBaseCell resultCell = new HBaseCell();
                        resultCell.setFamily(family);
                        resultCell.setQualifier(qualifier);
                        
resultCell.setValue(endpoint.getCamelContext().getTypeConverter().convertTo(String.class,
 keyValue.getValue()));
                        resultRow.getCells().add(resultCell); //will fail to 
insert if some cell with same Family and Qualifier exists
                    }
                    ...
              }
{code} 
that means we can't specify family and qualifier option when consuming.
# remove option
the default value of remove option is true, that mean, after scan the table, 
all scanned row will be removed. I think it's not we expect, so user may have 
to add option remove=false to stop that. however this option doesn't describe 
on website http://camel.apache.org/hbase.html .

Besides these problem, I think some descriptions on 
http://camel.apache.org/hbase.html are not correct. please have a check.


> camel-hbase component have some bugs on Consumer side
> -----------------------------------------------------
>
>                 Key: CAMEL-7296
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7296
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-hbase
>    Affects Versions: 2.12.3
>            Reporter: liugang
>
> After I tried a little bit, I think there are 2 problems on Consumer side:
> # Returned value is null
> if we specified family and qualifier options in URI, then all returned values 
> will be null.  I did some investigation, and I found the problem is caused by 
> the equals method of HBaseCell class. In poll() method of HBaseConsumer, the 
> resultRow will apply rowModel first before insert the resultCell, see below 
> code:
> {code}
>              ....
>               HBaseData data = new HBaseData();
>                 HBaseRow resultRow = new HBaseRow();
>                 resultRow.apply(rowModel);       //the existing HBaseCell in 
> rowModel will be insert into resultRow
>                 byte[] row = result.getRow();
>                 
> resultRow.setId(endpoint.getCamelContext().getTypeConverter().convertTo(rowModel.getRowType(),
>  row));
>                 List<KeyValue> keyValues = result.list();
>                 if (keyValues != null) {
>                     for (KeyValue keyValue : keyValues) {
>                         String qualifier = new 
> String(keyValue.getQualifier());
>                         String family = new String(keyValue.getFamily());
>                         HBaseCell resultCell = new HBaseCell();
>                         resultCell.setFamily(family);
>                         resultCell.setQualifier(qualifier);
>                         
> resultCell.setValue(endpoint.getCamelContext().getTypeConverter().convertTo(String.class,
>  keyValue.getValue()));
>                         resultRow.getCells().add(resultCell); //will fail to 
> insert if some cell with same Family and Qualifier exists
>                     }
>                     ...
>               }
> {code} 
> that means we can't specify family and qualifier option when consuming.
> # remove option
> the default value of remove option is true, that mean, after scan the table, 
> all scanned row will be removed. I think it's not we expect, so user may have 
> to add option remove=false to stop that. however this option doesn't describe 
> on website http://camel.apache.org/hbase.html .
> Besides these problem, I think some descriptions on 
> http://camel.apache.org/hbase.html are not correct, for example the demos and 
> Header Options. please have a check.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to