53
53
import com .google .common .collect .Iterables ;
54
54
import com .google .spanner .v1 .ResultSetStats ;
55
55
import java .math .BigDecimal ;
56
- import java .math .BigInteger ;
57
56
import java .util .ArrayList ;
58
57
import java .util .Arrays ;
59
58
import java .util .Collections ;
@@ -427,6 +426,8 @@ public void bindDateNull() {
427
426
428
427
@ Test
429
428
public void bindInterval () {
429
+ assumeTrue ("Interval is currently only supported in cloud-devel" , isUsingCloudDevel ());
430
+ assumeFalse ("Emulator does not yet support INTERVAL" , EmulatorSpannerHelper .isUsingEmulator ());
430
431
Interval d = Interval .parseFromString ("P1Y2M3DT4H5M6.789123S" );
431
432
Struct row = execute (Statement .newBuilder (selectValueQuery ).bind ("p1" ).to (d ), Type .interval ());
432
433
assertThat (row .isNull (0 )).isFalse ();
@@ -435,6 +436,8 @@ public void bindInterval() {
435
436
436
437
@ Test
437
438
public void bindIntervalNull () {
439
+ assumeTrue ("Interval is currently only supported in cloud-devel" , isUsingCloudDevel ());
440
+ assumeFalse ("Emulator does not yet support INTERVAL" , EmulatorSpannerHelper .isUsingEmulator ());
438
441
Struct row =
439
442
execute (
440
443
Statement .newBuilder (selectValueQuery ).bind ("p1" ).to ((Interval ) null ), Type .interval ());
@@ -837,6 +840,8 @@ public void bindDateArrayNull() {
837
840
838
841
@ Test
839
842
public void bindIntervalArray () {
843
+ assumeTrue ("Interval is currently only supported in cloud-devel" , isUsingCloudDevel ());
844
+ assumeFalse ("Emulator does not yet support INTERVAL" , EmulatorSpannerHelper .isUsingEmulator ());
840
845
Interval d1 = Interval .parseFromString ("P-1Y-2M-3DT4H5M6.789123S" );
841
846
Interval d2 = Interval .parseFromString ("P1Y2M3DT-4H-5M-6.789123S" );
842
847
Struct row =
@@ -849,6 +854,8 @@ public void bindIntervalArray() {
849
854
850
855
@ Test
851
856
public void bindIntervalArrayEmpty () {
857
+ assumeTrue ("Interval is currently only supported in cloud-devel" , isUsingCloudDevel ());
858
+ assumeFalse ("Emulator does not yet support INTERVAL" , EmulatorSpannerHelper .isUsingEmulator ());
852
859
Struct row =
853
860
execute (
854
861
Statement .newBuilder (selectValueQuery )
@@ -861,6 +868,7 @@ public void bindIntervalArrayEmpty() {
861
868
862
869
@ Test
863
870
public void bindIntervalArrayNull () {
871
+ assumeFalse ("Emulator does not yet support INTERVAL" , EmulatorSpannerHelper .isUsingEmulator ());
864
872
Struct row =
865
873
execute (
866
874
Statement .newBuilder (selectValueQuery ).bind ("p1" ).toIntervalArray (null ),
@@ -1019,6 +1027,7 @@ public void invalidAmbiguousFieldAccess() {
1019
1027
}
1020
1028
1021
1029
private Struct structValue () {
1030
+ // TODO: Add test for interval once interval is supported in emulator.
1022
1031
return Struct .newBuilder ()
1023
1032
.set ("f_int" )
1024
1033
.to (10 )
@@ -1032,8 +1041,6 @@ private Struct structValue() {
1032
1041
.to (Date .fromYearMonthDay (1 , 3 , 1 ))
1033
1042
.set ("f_string" )
1034
1043
.to ("hello" )
1035
- .set ("f_interval" )
1036
- .to (Interval .fromMonthsDaysNanos (100 , 200 , BigInteger .valueOf (5000000L )))
1037
1044
.set ("f_bytes" )
1038
1045
.to (ByteArray .copyFrom ("bytes" ))
1039
1046
.build ();
@@ -1042,6 +1049,7 @@ private Struct structValue() {
1042
1049
@ Test
1043
1050
public void bindStruct () {
1044
1051
assumeFalse ("structs are not supported on POSTGRESQL" , dialect .dialect == Dialect .POSTGRESQL );
1052
+ // TODO: Add test for interval once interval is supported in emulator.
1045
1053
Struct p = structValue ();
1046
1054
String query =
1047
1055
"SELECT "
@@ -1051,7 +1059,6 @@ public void bindStruct() {
1051
1059
+ "@p.f_timestamp,"
1052
1060
+ "@p.f_date,"
1053
1061
+ "@p.f_string,"
1054
- + "@p.f_interval,"
1055
1062
+ "@p.f_bytes" ;
1056
1063
1057
1064
Struct row =
0 commit comments