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

Sudeep Sunthankar commented on HBASE-17283:
-------------------------------------------

{quote}
Remove empty and readonly attributes from Result. empty is not needed since it 
is dynamically computable. readonly is an artifact from MR in the Java code 
base. No need in C++ client.
{quote}
I had added empty_ as we initialized Cells only in the constructor and there is 
no other way at present to add more Cells. So at the time of construction I was 
assigning it. I have removed it.

{quote}
Why are we returning Cells via std::make_unique()? It does an extra copy of the 
Cells which is pretty costly. Should we return via a shared_ptr, or a plain 
reference?
{quote}
# Using a return by value will have an overhead of temporaries. Returning a 
reference of local variable is not safe. Since we need the Cell instance to 
live beyond the scope of the method we can create it on heap and we are using a 
smart pointer i.e. unique_ptr in our case.
# unique pointer is used so that the caller can get the ownership of the object 
and it will be destroyed once the caller is done. An object is owned by exactly 
one unique_ptr. I can't think of a scenario, where we will have to share the  
Cell created as such. 
# make_unique was introduced in C++14 and it is exception safe. unique pointers 
dont allow copying and in our case we are transferring the ownership of the 
unique pointer so there shouldn't be a extra copy of Cells.

{quote}
Result::ColumnLatestCell(), Result::Size(), Result::FamilyMap(), Result::Map(), 
Result:: seem important to implement as well.
{quote}
Added 

Thanks,
Sudeep S

> [C++] Result and ResultScanner classes
> --------------------------------------
>
>                 Key: HBASE-17283
>                 URL: https://issues.apache.org/jira/browse/HBASE-17283
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Sudeep Sunthankar
>            Assignee: Sudeep Sunthankar
>         Attachments: HBASE-17283.HBASE-14850.v1.patch, 
> HBASE-17283.HBASE-14850.v3.patch, hbase-17283_v2.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to