@@ -723,6 +723,7 @@ Please use the format 'prezzy' or '${instance.name}/tables/prezzy'.`);
723723 const maxRetries = is . number ( this . maxRetries ) ? this . maxRetries ! : 3 ;
724724 let activeRequestStream : AbortableDuplex | null ;
725725 let rowKeys : string [ ] ;
726+ let filter : { } | null ;
726727 const rowsLimit = options . limit || 0 ;
727728 const hasLimit = rowsLimit !== 0 ;
728729 let rowsRead = 0 ;
@@ -740,6 +741,10 @@ Please use the format 'prezzy' or '${instance.name}/tables/prezzy'.`);
740741 ranges . push ( { } ) ;
741742 }
742743
744+ if ( options . filter ) {
745+ filter = Filter . parse ( options . filter ) ;
746+ }
747+
743748 const userStream = new PassThrough ( { objectMode : true } ) ;
744749 const end = userStream . end . bind ( userStream ) ;
745750 userStream . end = ( ) => {
@@ -765,6 +770,11 @@ Please use the format 'prezzy' or '${instance.name}/tables/prezzy'.`);
765770 // eslint-disable-next-line @typescript-eslint/no-explicit-any
766771 chunkTransformer = new ChunkTransformer ( { decode : options . decode } as any ) ;
767772
773+ const reqOpts = {
774+ tableName : this . name ,
775+ appProfileId : this . bigtable . appProfileId ,
776+ } as google . bigtable . v2 . IReadRowsRequest ;
777+
768778 const retryOpts = {
769779 currentRetryAttempt : numConsecutiveErrors ,
770780 // Handling retries in this client. Specify the retry options to
@@ -793,7 +803,25 @@ Please use the format 'prezzy' or '${instance.name}/tables/prezzy'.`);
793803 }
794804 }
795805
796- const reqOpts : any = this . readRowsReqOpts ( ranges , rowKeys , options ) ;
806+ // Create the new reqOpts
807+ reqOpts . rows = { } ;
808+
809+ // TODO: preprocess all the keys and ranges to Bytes
810+ reqOpts . rows . rowKeys = rowKeys . map (
811+ Mutation . convertToBytes
812+ ) as { } as Uint8Array [ ] ;
813+
814+ reqOpts . rows . rowRanges = ranges . map ( range =>
815+ Filter . createRange (
816+ range . start as BoundData ,
817+ range . end as BoundData ,
818+ 'Key'
819+ )
820+ ) ;
821+
822+ if ( filter ) {
823+ reqOpts . filter = filter ;
824+ }
797825
798826 if ( hasLimit ) {
799827 reqOpts . rowsLimit = rowsLimit - rowsRead ;
@@ -1545,39 +1573,6 @@ Please use the format 'prezzy' or '${instance.name}/tables/prezzy'.`);
15451573 makeNextBatchRequest ( ) ;
15461574 }
15471575
1548- private readRowsReqOpts (
1549- ranges : PrefixRange [ ] ,
1550- rowKeys : string [ ] ,
1551- options : any
1552- ) {
1553- const reqOpts = {
1554- tableName : this . name ,
1555- appProfileId : this . bigtable . appProfileId ,
1556- } as google . bigtable . v2 . IReadRowsRequest ;
1557-
1558- // Create the new reqOpts
1559- reqOpts . rows = { } ;
1560-
1561- // TODO: preprocess all the keys and ranges to Bytes
1562- reqOpts . rows . rowKeys = rowKeys . map (
1563- Mutation . convertToBytes
1564- ) as { } as Uint8Array [ ] ;
1565-
1566- reqOpts . rows . rowRanges = ranges . map ( range =>
1567- Filter . createRange (
1568- range . start as BoundData ,
1569- range . end as BoundData ,
1570- 'Key'
1571- )
1572- ) ;
1573-
1574- const filter = options . filter ;
1575- if ( filter ) {
1576- reqOpts . filter = Filter . parse ( filter ) ;
1577- }
1578- return reqOpts ;
1579- }
1580-
15811576 /**
15821577 * Get a reference to a table row.
15831578 *
0 commit comments