Polypheny-DB
Polypheny-DB copied to clipboard
Cottontail DB Adapter: EXISTS in prepared statement
There seems to be an issue when executing an EXISTS statement in a prepared statement:
SELECT EXISTS(SELECT id FROM cineast.test_feature_vector WHERE id = '0')
The table cineast.test_feature_vector
fully resides on Cottontail DB and consists of two rows id (varchar) and feature (float vector).
If I execute this query via UI, it succeeds. However, if I execute it as prepared statement from within Cineast, I run into a null pointer exception. The exception is raised in the Cottontail DB adapter. However, even though Cottontail DB supports EXISTS and COUNT aggregations, they are currently not pushed down to Cottontail DB (and never have been). Hence, it seems that something gets pushed down to the adapter by Polypheny DB, which should not.
Here is the example code executed in Cineast:
try (final PreparedStatement stmt = this.wrapper.connection.prepareStatement("SELECT EXISTS(SELECT " + key + " FROM " + this.fqn + " WHERE " + key + " = ?)")) {
stmt.setString(1, value);
final ResultSet rs = stmt.executeQuery();
}