in jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamBaseResultSet.java [692:718]
public String getString(int columnIndex) throws SQLException {
verifyOpen();
verifyIndex(columnIndex);
final Datum currentCell = this.currentRowData.get(columnIndex - 1);
final TimestreamDataType sourceType = this.tsTypes.get(columnIndex - 1);
if (this.checkNull(currentCell)) {
return null;
}
final String result;
if (sourceType == TimestreamDataType.VARCHAR) {
result = currentCell.getScalarValue();
} else {
result = (String) Conversions
.convert(sourceType, JdbcType.VARCHAR, currentCell, this::addWarning);
}
if (result != null && fieldSize != 0) {
final byte[] bytes = result.getBytes(StandardCharsets.UTF_8);
if (fieldSize < bytes.length) {
final byte[] trimmedBytes = new byte[fieldSize];
System.arraycopy(bytes, 0, trimmedBytes, 0, fieldSize);
return new String(trimmedBytes, StandardCharsets.UTF_8);
}
}
return result;
}