Hi All,

I'm using Calcite to connect to Hive DB via JDBC adapter that connects to
Thrift JDBC server running on a VM with Spark and Hive installed there. The
schema looks like this:

{
  name: 'thrift',
  type: 'custom',
  factory: 'org.apache.calcite.adapter.jdbc.JdbcSchema$Factory',
  operand: {
    jdbcDriver: 'org.apache.hive.jdbc.HiveDriver',
    jdbcUrl: 'jdbc:hive2://127.0.0.1:10000/default', // please use
VirtualBox port forwarding to the VM with Thrift server running
    jdbcUser: '',
    jdbcPassword: ''
  }
}

I get an error about null collation though.

The error is caused by the Hive’s
HiveDatabaseMetadata.nullsAreSortedAtEnd() method:

public boolean nullsAreSortedAtEnd() throws SQLException {
    throw new SQLException("Method not supported");
}

This method is called by the Calcite’s
SqlDialectFactoryImpl.getNullCollation() method:

private NullCollation getNullCollation(DatabaseMetaData databaseMetaData) {
    try {
        if (databaseMetaData.nullsAreSortedAtEnd()) {
            return NullCollation.LAST;
        } else if (databaseMetaData.nullsAreSortedAtStart()) {
            return NullCollation.FIRST;
        } else if (databaseMetaData.nullsAreSortedLow()) {
            return NullCollation.LOW;
        } else if (databaseMetaData.nullsAreSortedHigh()) {
            return NullCollation.HIGH;
        } else {
            throw new IllegalArgumentException("cannot deduce null collation");
        }
    } catch (SQLException var3) {
        throw new IllegalArgumentException("cannot deduce null
collation", var3);
    }
}

Which means that Calcite requires to know the null collation of the DB but
Hive doesn’t have it.

Does it mean that Calcite doesn't support connecting to Hive via JDBC or am
I missing something?


Thanks,

Val

Reply via email to