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,8 @@ public void bindIntervalArrayEmpty() {
861
868
862
869
@ Test
863
870
public void bindIntervalArrayNull () {
871
+ assumeTrue ("Interval is currently only supported in cloud-devel" , isUsingCloudDevel ());
872
+ assumeFalse ("Emulator does not yet support INTERVAL" , EmulatorSpannerHelper .isUsingEmulator ());
864
873
Struct row =
865
874
execute (
866
875
Statement .newBuilder (selectValueQuery ).bind ("p1" ).toIntervalArray (null ),
@@ -1019,6 +1028,7 @@ public void invalidAmbiguousFieldAccess() {
1019
1028
}
1020
1029
1021
1030
private Struct structValue () {
1031
+ // TODO: Add test for interval once interval is supported in emulator.
1022
1032
return Struct .newBuilder ()
1023
1033
.set ("f_int" )
1024
1034
.to (10 )
@@ -1032,8 +1042,6 @@ private Struct structValue() {
1032
1042
.to (Date .fromYearMonthDay (1 , 3 , 1 ))
1033
1043
.set ("f_string" )
1034
1044
.to ("hello" )
1035
- .set ("f_interval" )
1036
- .to (Interval .fromMonthsDaysNanos (100 , 200 , BigInteger .valueOf (5000000L )))
1037
1045
.set ("f_bytes" )
1038
1046
.to (ByteArray .copyFrom ("bytes" ))
1039
1047
.build ();
@@ -1042,6 +1050,7 @@ private Struct structValue() {
1042
1050
@ Test
1043
1051
public void bindStruct () {
1044
1052
assumeFalse ("structs are not supported on POSTGRESQL" , dialect .dialect == Dialect .POSTGRESQL );
1053
+ // TODO: Add test for interval once interval is supported in emulator.
1045
1054
Struct p = structValue ();
1046
1055
String query =
1047
1056
"SELECT "
@@ -1051,7 +1060,6 @@ public void bindStruct() {
1051
1060
+ "@p.f_timestamp,"
1052
1061
+ "@p.f_date,"
1053
1062
+ "@p.f_string,"
1054
- + "@p.f_interval,"
1055
1063
+ "@p.f_bytes" ;
1056
1064
1057
1065
Struct row =
0 commit comments