@Override public List<Boolean> getBooleanList(String columnName) { return getCurrentRowAsStruct().getBooleanList(columnName); }
@Override public List<Boolean> getBooleanList(int columnIndex) { return getCurrentRowAsStruct().getBooleanList(columnIndex); }
@Test public void bindBoolArrayEmpty() { Struct row = execute( Statement.newBuilder("SELECT @v").bind("v").toBoolArray(Arrays.<Boolean>asList()), Type.array(Type.bool())); assertThat(row.isNull(0)).isFalse(); assertThat(row.getBooleanList(0)).containsExactly(); }
@Test public void bindBoolArray() { Struct row = execute( Statement.newBuilder("SELECT @v").bind("v").toBoolArray(asList(true, null, false)), Type.array(Type.bool())); assertThat(row.isNull(0)).isFalse(); assertThat(row.getBooleanList(0)).containsExactly(true, null, false).inOrder(); }
@Test public void writeBoolArrayEmpty() { write(baseInsert().set("BoolArrayValue").toBoolArray(new boolean[] {}).build()); Struct row = readLastRow("BoolArrayValue"); assertThat(row.isNull(0)).isFalse(); assertThat(row.getBooleanList(0)).containsExactly(); }
@Test public void writeBoolArray() { write(baseInsert().set("BoolArrayValue").toBoolArray(Arrays.asList(true, null, false)).build()); Struct row = readLastRow("BoolArrayValue"); assertThat(row.isNull(0)).isFalse(); assertThat(row.getBooleanList(0)).containsExactly(true, null, false).inOrder(); expectedException.expect(NullPointerException.class); row.getBooleanArray(0); }
private List<?> getRawList(Struct actualRow, int index, Type elementType) throws Exception { List<?> rawList = null; switch (elementType.getCode()) { case BOOL: rawList = actualRow.getBooleanList(index); break; case STRING: rawList = actualRow.getStringList(index); break; case BYTES: rawList = actualRow.getBytesList(index); break; case INT64: rawList = actualRow.getLongList(index); break; case FLOAT64: rawList = actualRow.getDoubleList(index); break; case STRUCT: rawList = actualRow.getStructList(index); break; default: Assert.fail("Unexpected type code:" + elementType.getCode()); } return rawList; }
@Override public List<Boolean> getBooleanList(int columnIndex) { return getCurrentRowAsStruct().getBooleanList(columnIndex); }
@Override public List<Boolean> getBooleanList(String columnName) { return getCurrentRowAsStruct().getBooleanList(columnName); }
builder.set(field, nullValue ? null : row.getBooleanList(fieldName)); break; case LONG: