amazon-archives / sql-jdbc

🔍 Open Distro for Elasticsearch JDBC Driver
Apache License 2.0
111 stars 49 forks source link

JDBC driver returns Elasticsearch type name in ResultSet meta data #43

Closed dai-chen closed 4 years ago

dai-chen commented 4 years ago

For some reason, JDBC driver returns KEYWORD type rather than standard VARCHAR or NVARCHAR. I checked that there is no keyword type in the spec: https://docs.oracle.com/javase/8/docs/api/java/sql/Types.html. I don't remember if we do this on purpose or not.

dai-chen commented 4 years ago

This seems a bug because ResultSetMetaDataImpl.getColumnType() returns JDBC type: https://github.com/opendistro-for-elasticsearch/sql-jdbc/blob/625614647c5110daa4e524143d55ecabb8e50794/src/main/java/com/amazon/opendistroforelasticsearch/jdbc/ResultSetMetaDataImpl.java#L127

But getColumnTypeName() returns Elastissearch type name: https://github.com/opendistro-for-elasticsearch/sql-jdbc/blob/625614647c5110daa4e524143d55ecabb8e50794/src/main/java/com/amazon/opendistroforelasticsearch/jdbc/ResultSetMetaDataImpl.java#L133