use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method nonNumberArray.
@Test
public void nonNumberArray() {
Struct row = execute(Statement.newBuilder("SELECT [IEEE_DIVIDE(1, 0), IEEE_DIVIDE(-1, 0), IEEE_DIVIDE(0, 0)]"), Type.array(Type.float64()));
assertThat(row.getDoubleList(0)).hasSize(3);
assertThat(row.getDoubleList(0).get(0)).isPositiveInfinity();
assertThat(row.getDoubleList(0).get(1)).isNegativeInfinity();
assertThat(row.getDoubleList(0).get(2)).isNaN();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindFloat64Array.
@Test
public void bindFloat64Array() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toFloat64Array(Arrays.asList(null, 1.0, 2.0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NaN)), Type.array(Type.float64()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDoubleList(0)).containsExactly(null, 1.0, 2.0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NaN).inOrder();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindBytesArray.
@Test
public void bindBytesArray() {
ByteArray e1 = ByteArray.copyFrom("x");
ByteArray e2 = ByteArray.copyFrom("y");
ByteArray e3 = null;
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toBytesArray(Arrays.asList(e1, e2, e3)), Type.array(Type.bytes()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getBytesList(0)).containsExactly(e1, e2, e3).inOrder();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindFloat64ArrayEmpty.
@Test
public void bindFloat64ArrayEmpty() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toFloat64Array(Arrays.<Double>asList()), Type.array(Type.float64()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDoubleList(0)).containsExactly();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindDateNull.
@Test
public void bindDateNull() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to((Date) null), Type.date());
assertThat(row.isNull(0)).isTrue();
}
Aggregations