@@ -874,6 +874,9 @@ func checkReqsForReadOptions(t *testing.T, server InMemSpannerServer, ro ReadOpt
874874 if got , want := sqlReq .DirectedReadOptions , ro .DirectedReadOptions ; got .String () != want .String () {
875875 t .Fatalf ("Directed Read Options mismatch, got %v, want %v" , got , want )
876876 }
877+ if got , want := sqlReq .OrderBy , ro .OrderBy ; got != want {
878+ t .Fatalf ("OrderBy mismatch, got %v, want %v" , got , want )
879+ }
877880}
878881
879882func checkReqsForTransactionOptions (t * testing.T , server InMemSpannerServer , txo TransactionOptions ) {
@@ -4436,20 +4439,26 @@ func readOptionsTestCases() []ReadOptionsTestCase {
44364439 return []ReadOptionsTestCase {
44374440 {
44384441 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 },
44414450 },
44424451 {
44434452 name : "Read level" ,
44444453 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 },
44474456 },
44484457 {
44494458 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 },
44534462 },
44544463 }
44554464}
0 commit comments