@@ -874,6 +874,9 @@ func checkReqsForReadOptions(t *testing.T, server InMemSpannerServer, ro ReadOpt
874
874
if got , want := sqlReq .DirectedReadOptions , ro .DirectedReadOptions ; got .String () != want .String () {
875
875
t .Fatalf ("Directed Read Options mismatch, got %v, want %v" , got , want )
876
876
}
877
+ if got , want := sqlReq .OrderBy , ro .OrderBy ; got != want {
878
+ t .Fatalf ("OrderBy mismatch, got %v, want %v" , got , want )
879
+ }
877
880
}
878
881
879
882
func checkReqsForTransactionOptions (t * testing.T , server InMemSpannerServer , txo TransactionOptions ) {
@@ -4436,20 +4439,26 @@ func readOptionsTestCases() []ReadOptionsTestCase {
4436
4439
return []ReadOptionsTestCase {
4437
4440
{
4438
4441
name : "Client level" ,
4439
- client : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" },
4440
- want : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" },
4442
+ client : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" , OrderBy : sppb .ReadRequest_ORDER_BY_NO_ORDER },
4443
+ want : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" , OrderBy : sppb .ReadRequest_ORDER_BY_NO_ORDER },
4444
+ },
4445
+ {
4446
+ name : "Client level has precendence when ORDER_BY_UNSPECIFIED at read level" ,
4447
+ client : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" , OrderBy : sppb .ReadRequest_ORDER_BY_NO_ORDER },
4448
+ read : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" },
4449
+ want : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" , OrderBy : sppb .ReadRequest_ORDER_BY_NO_ORDER },
4441
4450
},
4442
4451
{
4443
4452
name : "Read level" ,
4444
4453
client : & ReadOptions {},
4445
- read : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" },
4446
- want : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" },
4454
+ read : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" , OrderBy : sppb . ReadRequest_ORDER_BY_NO_ORDER },
4455
+ want : & ReadOptions {Index : "testIndex" , Limit : 100 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "testRequestTag" , OrderBy : sppb . ReadRequest_ORDER_BY_NO_ORDER },
4447
4456
},
4448
4457
{
4449
4458
name : "Read level has precedence than client level" ,
4450
- client : & ReadOptions {Index : "clientIndex" , Limit : 10 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "clientRequestTag" },
4451
- read : & ReadOptions {Index : "readIndex" , Limit : 20 , Priority : sppb .RequestOptions_PRIORITY_MEDIUM , RequestTag : "readRequestTag" },
4452
- want : & ReadOptions {Index : "readIndex" , Limit : 20 , Priority : sppb .RequestOptions_PRIORITY_MEDIUM , RequestTag : "readRequestTag" },
4459
+ client : & ReadOptions {Index : "clientIndex" , Limit : 10 , Priority : sppb .RequestOptions_PRIORITY_LOW , RequestTag : "clientRequestTag" , OrderBy : sppb . ReadRequest_ORDER_BY_NO_ORDER },
4460
+ read : & ReadOptions {Index : "readIndex" , Limit : 20 , Priority : sppb .RequestOptions_PRIORITY_MEDIUM , RequestTag : "readRequestTag" , OrderBy : sppb . ReadRequest_ORDER_BY_PRIMARY_KEY },
4461
+ want : & ReadOptions {Index : "readIndex" , Limit : 20 , Priority : sppb .RequestOptions_PRIORITY_MEDIUM , RequestTag : "readRequestTag" , OrderBy : sppb . ReadRequest_ORDER_BY_PRIMARY_KEY },
4453
4462
},
4454
4463
}
4455
4464
}
0 commit comments