[
https://issues.apache.org/jira/browse/CASSANDRA-9813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14630079#comment-14630079
]
Tyler Hobbs commented on CASSANDRA-9813:
----------------------------------------
For more background on the problem, the driver doesn't directly expose the
result metadata, it only uses it to decode the values and supply the column
names to the row factory. If there are no rows, the row factory is never
called, so column names don't make it into the results that are passed back.
We _could_ prepare statements and use the result metadata from those, but it's
probably not worth polluting the prepared statement cache just to fix column
headers for empty results.
One potential workaround (admittedly pretty hacky) is to subclass the drivers
{{ResultMessage}} class and store the result of {{recv_results_metdata()}}
somewhere that we can access later.
> cqlsh column header can be incorrect when no rows are returned
> --------------------------------------------------------------
>
> Key: CASSANDRA-9813
> URL: https://issues.apache.org/jira/browse/CASSANDRA-9813
> Project: Cassandra
> Issue Type: Bug
> Reporter: Aleksey Yeschenko
> Assignee: Sylvain Lebresne
> Labels: cqlsh
> Fix For: 3.x, 2.1.x, 2.2.x
>
> Attachments: Test-for-9813.txt
>
>
> Upon migration, we internally create a pair of surrogate clustering/regular
> columns for compact static tables. These shouldn't be exposed to the user.
> That is, for the table
> {code}
> CREATE TABLE bar (k int, c int, PRIMARY KEY (k)) WITH COMPACT STORAGE;
> {code}
> {{SELECT * FROM bar}} should not be returning this result set:
> {code}
> cqlsh:test> select * from bar;
> c | column1 | k | value
> ---+---------+---+-------
> (0 rows)
> {code}
> Should only contain the defined {{c}} and {{k}} columns.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)