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

Guangxu Cheng updated HBASE-21174:
----------------------------------
    Description: 
{code:xml}
GET /t1/*?column=f:c1&column=f:
{code}
If I want to get the values of 'f:'(empty qualifier) for all rows in the table 
by rest server, I will send the above request. However, this request will 
return all column values.
{code:java|title=TableResource#getScanResource|borderStyle=solid}
      for (String csplit : column) {
        String[] familysplit = csplit.trim().split(":");
        if (familysplit.length == 2) {
          if (familysplit[1].length() > 0) {
            if (LOG.isTraceEnabled()) {
              LOG.trace("Scan family and column : " + familysplit[0] + "  " + 
familysplit[1]);
            }
            tableScan.addColumn(Bytes.toBytes(familysplit[0]), 
Bytes.toBytes(familysplit[1]));
          } else {
            tableScan.addFamily(Bytes.toBytes(familysplit[0]));
            if (LOG.isTraceEnabled()) {
              LOG.trace("Scan family : " + familysplit[0] + " and empty 
qualifier.");
            }
            tableScan.addColumn(Bytes.toBytes(familysplit[0]), null);
          }
        } else if (StringUtils.isNotEmpty(familysplit[0])) {
          if (LOG.isTraceEnabled()) {
            LOG.trace("Scan family : " + familysplit[0]);
          }
          tableScan.addFamily(Bytes.toBytes(familysplit[0]));
        }
      }
{code}
Through the above code, when the column has an empty qualifier, the empty 
qualifier cannot be parsed correctly.In other words, 'f:'(empty qualifier) and 
'f' (column family) are considered to have the same meaning, which is wrong.

  was:
{code:title=TableResource#getScanResource|borderStyle=solid}
      for (String csplit : column) {
        String[] familysplit = csplit.trim().split(":");
        if (familysplit.length == 2) {
          if (familysplit[1].length() > 0) {
            if (LOG.isTraceEnabled()) {
              LOG.trace("Scan family and column : " + familysplit[0] + "  " + 
familysplit[1]);
            }
            tableScan.addColumn(Bytes.toBytes(familysplit[0]), 
Bytes.toBytes(familysplit[1]));
          } else {
            tableScan.addFamily(Bytes.toBytes(familysplit[0]));
            if (LOG.isTraceEnabled()) {
              LOG.trace("Scan family : " + familysplit[0] + " and empty 
qualifier.");
            }
            tableScan.addColumn(Bytes.toBytes(familysplit[0]), null);
          }
        } else if (StringUtils.isNotEmpty(familysplit[0])) {
          if (LOG.isTraceEnabled()) {
            LOG.trace("Scan family : " + familysplit[0]);
          }
          tableScan.addFamily(Bytes.toBytes(familysplit[0]));
        }
      }
{code}
{code:xml}
GET /t1/*?column=f:c1&column=f:
{code}


> [REST] Failed to parse empty qualifier in TableResource#getScanResource
> -----------------------------------------------------------------------
>
>                 Key: HBASE-21174
>                 URL: https://issues.apache.org/jira/browse/HBASE-21174
>             Project: HBase
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 3.0.0, 2.2.0
>            Reporter: Guangxu Cheng
>            Assignee: Guangxu Cheng
>            Priority: Major
>
> {code:xml}
> GET /t1/*?column=f:c1&column=f:
> {code}
> If I want to get the values of 'f:'(empty qualifier) for all rows in the 
> table by rest server, I will send the above request. However, this request 
> will return all column values.
> {code:java|title=TableResource#getScanResource|borderStyle=solid}
>       for (String csplit : column) {
>         String[] familysplit = csplit.trim().split(":");
>         if (familysplit.length == 2) {
>           if (familysplit[1].length() > 0) {
>             if (LOG.isTraceEnabled()) {
>               LOG.trace("Scan family and column : " + familysplit[0] + "  " + 
> familysplit[1]);
>             }
>             tableScan.addColumn(Bytes.toBytes(familysplit[0]), 
> Bytes.toBytes(familysplit[1]));
>           } else {
>             tableScan.addFamily(Bytes.toBytes(familysplit[0]));
>             if (LOG.isTraceEnabled()) {
>               LOG.trace("Scan family : " + familysplit[0] + " and empty 
> qualifier.");
>             }
>             tableScan.addColumn(Bytes.toBytes(familysplit[0]), null);
>           }
>         } else if (StringUtils.isNotEmpty(familysplit[0])) {
>           if (LOG.isTraceEnabled()) {
>             LOG.trace("Scan family : " + familysplit[0]);
>           }
>           tableScan.addFamily(Bytes.toBytes(familysplit[0]));
>         }
>       }
> {code}
> Through the above code, when the column has an empty qualifier, the empty 
> qualifier cannot be parsed correctly.In other words, 'f:'(empty qualifier) 
> and 'f' (column family) are considered to have the same meaning, which is 
> wrong.



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

Reply via email to