Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rahulKQL
Copy link
Contributor

What Change this PR contains

  • Adding ModelRowAdapter: To convert models.Row to hbase.client.Result.
  • Added static reference of this in Adapters.java.

Note: This Adapter has a similar implementation as existing RowAdapter, Once all references of existing RowAdapter is migrated then we can remove RowAdapter.

author Rahul Kesharawni <[email protected]> 1547731427 +0530
committer Rahul Kesharwani <[email protected]> 1548146899 +0530

Adding ModelRowAdapter for models.Row

Removed TODOs & extra WS

Removed TODOs & extra WS
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 23, 2019
@rahulKQL rahulKQL changed the title Added ModelRowAdapter for models.Row to Result WIP: Added ModelRowAdapter for models.Row to Result Jan 25, 2019
@rahulKQL
Copy link
Contributor Author

Reason for WIP: Would raise another PR to update existing RowAdapter which will convert models.Row to Result.

@rahulKQL
Copy link
Contributor Author

I have updated SortedSet to ImmutableList to as records received from gcj's readRows would already be sorted.

@sduskis @igorbernstein2 Please have a look

Copy link
Collaborator

@igorbernstein2 igorbernstein2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this model adapter only used for read rows? or will it be used for mutateRow, checkAndMutateRow, readAndModifyRow, etc?

// TODO(kevinsi4508): Filter out targeted {@link WhileMatchFilter} labels.
if (rowCell.getLabels().size() > 0) {
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fishy, shouldn't this be an internal implementation detail of WhileMatchFilter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary code. Please remove the comment and the if statement.

@rahulKQL
Copy link
Contributor Author

Is this model adapter only used for read rows? or will it be used for mutateRow, ?checkAndMutateRow, readAndModifyRow, etc?

yes, Our intent is to use this adapter for all operations involving models.Row (In case of FlatRow we would be using an existing read.FlatRowAdapter).

@igorbernstein2
Copy link
Collaborator

This PR has surfaced an deficiency in google-cloud-java client. Not having the cells ordered by default creates a lot of confusion. For example, ReadModifyWrite returns a row that doesn't use a RowAdapter so it will not be sorted. To avoid guessing I think we should just move the sorting to google-cloud-java.

I put together PR here:
googleapis/google-cloud-java#4421

@rahulKQL
Copy link
Contributor Author

rahulKQL commented Feb 1, 2019

Thanks for adding this sorting feature in GCJ!!

This would make cbt flow easy for converting Row into hbase.Result without any concerns on sorting.
However, As of now we are wrapping existing native CBT implementation using GCJ's model, So until we be moves 100% to GCJ's adapter(i.e. #1973) we should keep this sorting in ModelRowAdapter.

Please let me know your thought on this.

@igorbernstein2
Copy link
Collaborator

I don't quite understand what you mean. When will this be called with a Row that doesn't have sorted cells?

@rahulKQL
Copy link
Contributor Author

rahulKQL commented Feb 1, 2019

This would make cbt flow easy for converting Row into hbase.Result without any concerns on sorting.

I meant by above is, once we move to GCJ's adapter we won't have to sort the cell.

However, As of now we are wrapping existing native CBT implementation using GCJ's model, So until we be moves 100% to GCJ's adapter(i.e. #1973) we should keep this sorting in ModelRowAdapter.

But as of now we would have to keep SortedSet & TreeSet same as exisitng sorting (exsiting cbt RowAdapter) untill we start using GCJ adapters for both data & admin client.

@rahulKQL
Copy link
Contributor Author

rahulKQL commented Feb 5, 2019

@sduskis @igorbernstein2

I know we had already discussed ModelRowAdapter in this PR, But I have put together another approach in #2061 to make existing RowAdpater, adapt to GCJ's models.Row here.

As I mentioned above, we would have to keep TreeSet in RowAdapter till we start using GCJ's adapter(as of now we are just using its model classes, not the actual client).

Please have a look and let me know of your thoughts.

@sduskis
Copy link
Contributor

sduskis commented Feb 5, 2019

Would it be ok to keep a FlatRow instead of using model.Row as the output of reads?

@rahulKQL
Copy link
Contributor Author

rahulKQL commented Feb 6, 2019

I think we should be ok to use FlatRow, as we have its separate adapter i.e. FlatRowAdapter.

here the conversation about the same in #2034.

@rahulKQL
Copy link
Contributor Author

rahulKQL commented Feb 8, 2019

Could we close this PR?
As we are updating existing RowAdapter to convert models.Row to Result, which previously this PR's ModelRowAdapter meant to do.

@sduskis sduskis closed this Feb 8, 2019
@rahulKQL rahulKQL deleted the add_row_adapter branch February 13, 2019 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants