Currently the DuckDBAppender supports appending objects of type java.lang.String and primitive types like int, short, boolean and long.
When appending to a table that has nullable columns, it would be very convenient to have methods for these wrapper classes:
- java.lang.Boolean
- java.lang.Long
- java.lang.Integer
- java.lang.Short
Given a class like
class Person {
Integer age;
Long ssn;
}
Currently, one has to write
public void append(DuckDBAppender appender, Person person) throws SQLException {
appender.beginRow();
if (person.age != null) {
appender.append(person.age);
} else {
appender.append((String) null);
}
if (person.ssn != null) {
appender.append(person.ssn);
} else {
appender.append((String) null);
}
appender.endRow();
}
While it could become:
public void append(DuckDBAppender appender, Person person) throws SQLException {
appender.beginRow();
appender.append(person.age);
appender.append(person.ssn);
appender.endRow();
}
if DuckDBAppender would have support for the wrapper classes and do the null checking.
Currently the DuckDBAppender supports appending objects of type java.lang.String and primitive types like int, short, boolean and long.
When appending to a table that has nullable columns, it would be very convenient to have methods for these wrapper classes:
Given a class like
Currently, one has to write
While it could become:
if DuckDBAppender would have support for the wrapper classes and do the null checking.