Conversation
ad12c53 to
5db4849
Compare
Remote query cannot be constructed with empty columns list
5db4849 to
a98ca5d
Compare
| ResultSetMetaData metadata = preparedStatement.getMetaData(); | ||
| if (metadata == null) { | ||
| // SingleStore returns empty metadata instead of a null value | ||
| if (metadata == null || metadata.getColumnCount() == 0) { |
There was a problem hiding this comment.
As I've stated in a commit message: constructing Query PTF without columns doesn't make sense any way so this condition seems fine to me.
There was a problem hiding this comment.
This method is supposed to create a table handle for a PreparedQuery. Apparently, it is able to create a valid TableHandle with no columns. Let the caller take responsibility of handling the "no columns" condition. A TableHandle without columns might make no sense for a Table Function, but it might be OK in some other context (in the future). If a TableHandle with no columns is never OK, then maybe we miss a check in the JdbcTableHandle constructor?
There was a problem hiding this comment.
Can relation have no columns?
There was a problem hiding this comment.
A relation should have at least one column (though there exist sub-plans with no columns as a result of optimization).
My point is that a TH with no columns could still be potentially useful if it represents e.g. an insert. Adding the column on Trino side would not be a big issue.
Replaces #12696
All tests are passing locally