@Override public List<Timestamp> getTimestampList(int columnIndex) { return getCurrentRowAsStruct().getTimestampList(columnIndex); }
@Override public List<Timestamp> getTimestampList(String columnName) { return getCurrentRowAsStruct().getTimestampList(columnName); }
@Test public void writeTimestampArrayEmpty() { write( baseInsert() .set("TimestampArrayValue") .toTimestampArray(Arrays.<Timestamp>asList()) .build()); Struct row = readLastRow("TimestampArrayValue"); assertThat(row.isNull(0)).isFalse(); assertThat(row.getTimestampList(0)).containsExactly(); }
@Test public void bindTimestampArrayEmpty() { Struct row = execute( Statement.newBuilder("SELECT @v") .bind("v") .toTimestampArray(Arrays.<Timestamp>asList()), Type.array(Type.timestamp())); assertThat(row.isNull(0)).isFalse(); assertThat(row.getTimestampList(0)).containsExactly(); }
@Test public void writeTimestampArray() { Timestamp t1 = Timestamp.parseTimestamp("2016-09-18T00:00:00Z"); Timestamp t2 = Timestamp.parseTimestamp("2016-09-19T00:00:00Z"); write( baseInsert() .set("TimestampArrayValue") .toTimestampArray(Arrays.asList(t1, null, t2)) .build()); Struct row = readLastRow("TimestampArrayValue"); assertThat(row.isNull(0)).isFalse(); assertThat(row.getTimestampList(0)).containsExactly(t1, null, t2).inOrder(); }
@Test public void bindTimestampArray() { Timestamp t1 = Timestamp.parseTimestamp("2016-09-18T00:00:00Z"); Timestamp t2 = Timestamp.parseTimestamp("2016-09-19T00:00:00Z"); Struct row = execute( Statement.newBuilder("SELECT @v").bind("v").toTimestampArray(asList(t1, t2, null)), Type.array(Type.timestamp())); assertThat(row.isNull(0)).isFalse(); assertThat(row.getTimestampList(0)).containsExactly(t1, t2, null).inOrder(); }
return Value.dateArray(value.getDateList(fieldIndex)); case TIMESTAMP: return Value.timestampArray(value.getTimestampList(fieldIndex)); case STRUCT: return Value.structArray(elementType, value.getStructList(fieldIndex));
@Override public List<Timestamp> getTimestampList(int columnIndex) { return getCurrentRowAsStruct().getTimestampList(columnIndex); }
@Override public List<Timestamp> getTimestampList(String columnName) { return getCurrentRowAsStruct().getTimestampList(columnName); }
return GSON.toJson( currentRow .getTimestampList(columnName) .stream() .map(Timestamp::toString)
} else { List<String> values = row.getTimestampList(fieldName) .stream() .map(timestamp -> timestamp == null ? null : timestamp.toString())
return Value.dateArray(value.getDateList(fieldIndex)); case TIMESTAMP: return Value.timestampArray(value.getTimestampList(fieldIndex)); case STRUCT: return Value.structArray(elementType, value.getStructList(fieldIndex));