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

cqlsh: COPY FROM should check that explicit column names are valid

    XMLWordPrintableJSON

    Details

    • Severity:
      Low

      Description

      If an invalid column is specified in the COPY FROM command, then it fails without an appropriate error notification.

      For example using this schema:

      CREATE TABLE bulk_read.value500k_cluster1 (
          pk int,
          c1 int,
          v1 text,
          v2 text,
          PRIMARY KEY (pk, c1)
      );
      

      and this COPY FROM command (note the third column name is wrong:

      COPY bulk_read.value500k_cluster1 (pk, c1, vv, v2) FROM 'test.csv';
      

      we get the following error:

      Starting copy of bulk_read.value500k_cluster1 with columns ['pk', 'c1', 'vv', 'v2'].
      1 child process(es) died unexpectedly, aborting
      Processed: 0 rows; Rate:       0 rows/s; Avg. rate:       0 rows/s
      0 rows imported from 0 files in 0.109 seconds (0 skipped).
      

      Running cqlsh with --debug reveals where the problem is:

      Starting copy of bulk_read.value500k_cluster1 with columns ['pk', 'c1', 'vv', 'v2'].
      Traceback (most recent call last):
        File "/home/automaton/cassandra-src/bin/../pylib/cqlshlib/copyutil.py", line 2005, in run
          self.inner_run(*self.make_params())
        File "/home/automaton/cassandra-src/bin/../pylib/cqlshlib/copyutil.py", line 2027, in make_params
          is_counter = ("counter" in [table_meta.columns[name].cql_type for name in self.valid_columns])
      

      The parent process should check that all column names are valid and output an appropriate error message rather than letting worker processes crash.

        Attachments

          Activity

            People

            • Assignee:
              stefania Stefania Alborghetti
              Reporter:
              stefania Stefania Alborghetti
              Authors:
              Stefania Alborghetti
              Reviewers:
              Paulo Motta (Deprecated)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: