Details
-
Bug
-
Status: Open
-
Normal
-
Resolution: Unresolved
-
None
-
None
-
Linux
-
Normal
Description
When using CqlOutputFormat with a quoted keyspace containing capital letters, the initialisation of the CqlRecordWriter fails.
In the code,error is hapenning at metadata table creation in the core constructor:
CqlRecordWriter.java-main constructor
CqlRecordWriter(Configuration conf) { ... try { String keyspace = ConfigHelper.getOutputKeyspace(conf); try (Session client = CqlConfigHelper.getOutputCluster(ConfigHelper.getOutputInitialAddress(conf), conf).connect(keyspace)) { ringCache = new NativeRingCache(conf); if (client != null) { TableMetadata tableMetadata = client.getCluster().getMetadata().getKeyspace(client.getLoggedKeyspace()).getTable(ConfigHelper.getOutputColumnFamily(conf)); ... }
It seemed to be dues to the reused function Metadata.handleId(keyspace) that, applied mulitple times, removes uoptes and finally lowercase the keyspace name.
A valid solution (working for us at WMF) is to reuse the keyspace variable defined earlier instead of using the client one.
CqlRecordWriter.java-main constructor
CqlRecordWriter(Configuration conf) { ... try { String keyspace = ConfigHelper.getOutputKeyspace(conf); try (Session client = CqlConfigHelper.getOutputCluster(ConfigHelper.getOutputInitialAddress(conf), conf).connect(keyspace)) { ringCache = new NativeRingCache(conf); if (client != null) { TableMetadata tableMetadata = client.getCluster().getMetadata().getKeyspace(keyspace).getTable(ConfigHelper.getOutputColumnFamily(conf)); ... }