Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-10481

Quoted capitalised keyspace doesn't work as output for Hadoop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • 2.2.x
    • 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));
                      ...    
          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            jobar Joseph Allemandou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: