title: in cassandra-cli how to get all column names in a table and how to get it using hector in java?
body: <p>I'm trying to get column names but could not get way to get only column names.</p>
  
  <p>In cli I executed command <code>describe table nodes</code>, it returned the result:</p>
  
  <pre><code>CREATE TABLE nodes (
    key text PRIMARY KEY,
    id text,
    scores text,
    topic1 text,
    topic2 text,
    topic3 text,
    topic4 text,
    topics text
  ) WITH COMPACT STORAGE AND
    bloom_filter_fp_chance=0.010000 AND
    caching='KEYS_ONLY' AND
    comment='' AND
    dclocal_read_repair_chance=0.000000 AND
    gc_grace_seconds=864000 AND
    read_repair_chance=0.100000 AND
    replicate_on_write='true' AND
    populate_io_cache_on_flush='false' AND
    compaction={'class': 'SizeTieredCompactionStrategy'} AND
    compression={'sstable_compression': 'SnappyCompressor'};
  
  CREATE INDEX idx_nodes_id ON nodes (id);
  </code></pre>
  
  <p>As given in this <a href="https://stackoverflow.com/questions/11393935/how-to-list-all-column-names-in-a-column-family-in-cassandra">question</a>, I tries using following command in cli:</p>
  
  <pre><code>SELECT column_name FROM system.schema_columnfamilies WHERE keyspace_name = 'ianew' AND columnfamily_name = 'nodes';
  </code></pre>
  
  <p>but it gave the error:</p>
  
  <pre><code>Bad Request: Undefined name column_name in selection clause
  Perhaps you meant to use CQL 2? Try using the -2 option when starting cqlsh.
  </code></pre>
  
  <p>Then I tried with:</p>
  
  <pre><code>SELECT * FROM system.schema_columnfamilies WHERE keyspace_name = 'ianew' AND columnfamily_name = 'nodes';
  </code></pre>
  
  <p>It returned all following things:</p>
  
  <pre><code>    keyspace_name | columnfamily_name | bloom_filter_fp_chance | caching   | column_aliases | comment | compaction_strategy_class                                       | compaction_strategy_options | comparator                               | compression_parameters                                                      | default_read_consistency | default_validator                        | default_write_consistency | gc_grace_seconds | id   | key_alias | key_aliases | key_validator                            | local_read_repair_chance | max_compaction_threshold | min_compaction_threshold | populate_io_cache_on_flush | read_repair_chance | replicate_on_write | subcomparator | type     | value_alias
  ---------------+-------------------+------------------------+-----------+----------------+---------+-----------------------------------------------------------------+-----------------------------+------------------------------------------+-----------------------------------------------------------------------------+--------------------------+------------------------------------------+---------------------------+------------------+------+-----------+-------------+------------------------------------------+--------------------------+--------------------------+--------------------------+----------------------------+--------------------+--------------------+---------------+----------+-------------
           ianew |             nodes |                   null | KEYS_ONLY |             [] |         | org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy |                          {} | org.apache.cassandra.db.marshal.UTF8Type | {"sstable_compression":"org.apache.cassandra.io.compress.SnappyCompressor"} |                     null | org.apache.cassandra.db.marshal.UTF8Type |                      null |           864000 | null |      null |          [] | org.apache.cassandra.db.marshal.UTF8Type |                        0 |                       32 |                        4 |                      False |                0.1 |               True |          null | Standard |        null
  </code></pre>
  
  <p>As given in this <a href="http://www.coderpanda.com/listing-columns-from-apache-cassandra-using-java/" rel="nofollow noreferrer">post</a>, I tried using hector in java:</p>
  
  <pre><code>SliceQuery&lt;String, String, String&gt; query = HFactory.createSliceQuery(keyspace, StringSerializer.get(), StringSerializer.get(),  StringSerializer.get());
  query.setColumnFamily(columnFamilyName);
  query.setKey("key");
  query.setRange(null, null, false, Integer.MAX_VALUE);
  
  ColumnSliceIterator&lt;String, String, String&gt; iterator = new ColumnSliceIterator&lt;String, String, String&gt;(query, null, "\uFFFF", false);
  
  while (iterator.hasNext()) {
      HColumnImpl&lt;String, String&gt; column = (HColumnImpl&lt;String, String&gt;) iterator.next();
      System.out.println("Column name = " + column.getName() + "; Column value = " + column.getValue());
      colNames.add(column.getName());
  }
  </code></pre>
  
  <p>but it returned with no results.</p>
  
  <p>I want output to be something like:</p>
  
  <pre><code>TABLE nodes:
  Columns: key text PRIMARY KEY, id text, scores text, topic1 text, topic2 text, topic3 text, topic4 text, topics text
  </code></pre>
  
  <p>and similar result through Hector.</p>
  
  <p>Versions I'm using:</p>
  
  <pre><code>[cqlsh 2.3.0 | Cassandra 1.2.4 | CQL spec 3.0.0 | Thrift protocol 19.35.0]
  </code></pre>