-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Readrows Filter and system test #1322
Readrows Filter and system test #1322
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a cursory review of the DataClient
. Will follow up after taking a look at the system tests :).
Bigtable/src/DataClient.php
Outdated
@@ -241,6 +241,7 @@ public function upsert(array $rows, array $options = []) | |||
* associative array which may contain a start key | |||
* (`startKeyClosed` or `startKeyOpen`) and/or an end key | |||
* (`endKeyOpen` or `endKeyClosed`). | |||
* @type filter $filter A {@see Google\Cloud\Bigtable\Filter\FilterInterface} object to filter the rows. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Bigtable/src/DataClient.php
Outdated
|
||
array_walk($ranges, function (&$range) { | ||
$range = $this->serializer->decodeMessage( | ||
new RowRange(), | ||
$range | ||
); | ||
}); | ||
|
||
if (is_string($rowKeys)) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@dwsupplee can you please review now? |
Bigtable/src/DataClient.php
Outdated
@@ -241,6 +242,9 @@ public function upsert(array $rows, array $options = []) | |||
* associative array which may contain a start key | |||
* (`startKeyClosed` or `startKeyOpen`) and/or an end key | |||
* (`endKeyOpen` or `endKeyClosed`). | |||
* @type FilterInterface $filter A filter used to take an input row and produce an alternate view of the row |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Bigtable/src/DataClient.php
Outdated
if (!is_array($rowKeys)) { | ||
throw new \InvalidArgumentException( | ||
sprintf( | ||
'Expected rowKeys to be of array, instead got \'%s\'.', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -267,6 +279,10 @@ public function readRows(array $options = []) | |||
); | |||
} | |||
|
|||
if ($filter !== null) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
] | ||
)->readAll() | ||
); | ||
$expectedRows = ['rk1' => [ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
public function testThen() | ||
{ | ||
$rowFilter = Filter::condition(Filter::key()->exactMatch('rk1')) | ||
->then(Filter::family()->exactMatch('cf1')); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* @group bigtable | ||
* @group bigtabledata | ||
*/ | ||
class ChainFilterTest extends FilterTest |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
)->readAll() | ||
); | ||
$expectedRows = ['rk1' => self::$expectedRows['rk1'] | ||
]; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
'rk3' => [ | ||
'cf0' => [ | ||
'cq0' => [ | ||
'value' => 'value1002', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
] | ||
] | ||
]; | ||
self::$dataClient->upsert($insertExtraCell); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
public function testLabel() | ||
{ | ||
//TODO Implement label test |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@dwsupplee Can you please review again? testLabel is not working correctly from server side, thats why its in TODO. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor notes, otherwise looking very nice!
Bigtable/src/DataClient.php
Outdated
if (!$filter instanceof FilterInterface) { | ||
throw new \InvalidArgumentException( | ||
sprintf( | ||
'Expected filter to be of type FilterInterface, instead got \'%s\'.', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Bigtable/tests/System/FilterTest.php
Outdated
'cf1' => $expectedRows['rk1']['cf1'] | ||
] | ||
], | ||
'testCondtionThen failed' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Bigtable/tests/System/FilterTest.php
Outdated
[ | ||
'rk1' => $expectedRows['rk1'] | ||
], | ||
'testCondtionOtherwise failed' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Bigtable/tests/System/FilterTest.php
Outdated
] | ||
] | ||
], | ||
'testinterleave failed' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Bigtable/tests/System/FilterTest.php
Outdated
[ | ||
[ | ||
'rowKeys' => ['rk6'], | ||
'filter' => Filter::qualifier()->rangeWithInFamily('cf1')->of('cq1', 'cq3') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Bigtable/tests/System/FilterTest.php
Outdated
] | ||
] | ||
], | ||
'testQualifierRangeWithInFamily failed' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Bigtable/tests/System/FilterTest.php
Outdated
] | ||
)->readAll() | ||
); | ||
$this->assertTrue(count($rows) > 0); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@dwsupplee Updated as per your latest feedback. |
Thank you @ajaaym 👍 |
* Bigtable data operation mutate rows (#1230) * mutate rows * Fixed type in comment * Bigtable Mutate rows optional parameter (#1233) * add mutate rows optional configuration parameter * update order of append operation * Bigtable data read rows (#1234) * read rows * read rows acceptance test * fix type in parameter * fix param type in comment * Fix the state value * fix error in php5.5 * fix for protobuf extension * fix doc issue * review updates * fix rows->readAll * fix cs * Bigtable: Read rows filter (#1253) * read rows filter * fix test case * Filter * add comments * add espace for literal regex * Fix failing test * add snippet test * Fix doc * code review updates * moved builder in to its own namespace * add snippet test * arrange use statement * fix failing test case * Fix documentation * Readrows Filter and system test (#1322) * System test for filter * update doc * throw exception if rowKeys is not array in readRows * Simplified some fitler test * use dataprovider for filter system test * formatting * address feedback * Provide test name in message for conformance test (#1332) * provide message for failed test * update message * Bigtable: Read modify write row model (#1334) * readModifyWriteRowRule model * read modify write row * read modify write row api * update comments * fix static initializer * fix exception check for php < 7 * fix test case * update pack and unpack for php5.5 * address feedback * fix php 5.5 snippet test case * update doc and check * address feedback * Bigtable: Sample row keys api (#1338) * sample row keys * sample row keys * fix system test case * address feedback * fix snippet test * Bigtable: checkAndMutateRow api implementation (#1333) * checkAndMutateRow api * fix doc * fix snippet test * change snippet test * address feedback * update note * update comment * apply note to truemutations * fix comment * fix snippet test * Bigtable: refactor mutation model (#1367) * refactor mutation model * fix doc comment * address feedback * use ternary operator * fix comment * mutateRow api (#1382) * Rename DataClient -> Table and add BigtableClient (#1387) * rename DataClient to Table and add generic constructor options * update documentation * update snippets * update and rename system tests * update unit tests * add projectId/credentials to client * update mutateRow * update mutateRow system test * add imports for documentation * fix tests * potential fix for hhvm * fix projectId * Prep Bigtable handwritten client for release (#1388) * prepare bigtable handwritten layer for release * fix trailing comma * Update readme/projectID detection (#1391) * add note about differences in handwritten client * update projectID detection (we cannot reliably use the ClientTrait with the new client configuration options) * remove ClientTrait * add note on providing a keyfile * add note about authentication * Add 64 or 32 bit test (#1393) * Add 64 or 32 bit test * remove test annotation
Added option for filter in readRows of DataClient and system test for filters