Joseph Allemandou created CASSANDRA-10481:
---------------------------------------------
Summary: Quoted capitalised keyspace doesn't work as output for
Hadoop
Key: CASSANDRA-10481
URL: https://issues.apache.org/jira/browse/CASSANDRA-10481
Project: Cassandra
Issue Type: Bug
Components: Hadoop
Environment: Linux
Reporter: Joseph Allemandou
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:
{code:title=CqlRecordWriter.java-main constructor|borderStyle=solid}
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));
...
}
{code}
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.
{code:title=CqlRecordWriter.java-main constructor|borderStyle=solid}
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));
...
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)