[ https://issues.apache.org/jira/browse/CASSANDRA-11534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15426021#comment-15426021 ]
Arunkumar M edited comment on CASSANDRA-11534 at 8/18/16 7:29 AM: ------------------------------------------------------------------ This is because while formatting the row values the corresponding "cql_types" (ex: list[text], text) are None for all the aliases. In the line /bin/cqlsh.py#L1339 cql_types = [CqlType(table_meta.columns[c].cql_type, ks_meta) if c in table_meta.columns else None for c in column_names] formatted_values = [map(self.myformat_value, row.values(), cql_types) for row in rows] "table_meta.columns" contains the actual column names but "column_names" from result query contains the aliases so the cql_types list contains None for the aliases. Related ticket: https://issues.apache.org/jira/browse/CASSANDRA-11274 was (Author: arunkumar): This is because while formatting the row values the corresponding "cql_types" (ex: list[text], text) are None for all the aliases. In the line /bin/cqlsh.py#L1339 cql_types = [CqlType(table_meta.columns[c].cql_type, ks_meta) if c in table_meta.columns else None for c in column_names] "table_meta.columns" contains the actual column names but "column_names" from result query contains the aliases so the cql_types list contains None for the aliases. Related ticket: https://issues.apache.org/jira/browse/CASSANDRA-11274 > cqlsh fails to format collections when using aliases > ---------------------------------------------------- > > Key: CASSANDRA-11534 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11534 > Project: Cassandra > Issue Type: Bug > Reporter: Robert Stupp > Priority: Minor > > Given is a simple table. Selecting the columns without an alias works fine. > However, if the map is selected using an alias, cqlsh fails to format the > value. > {code} > create keyspace foo WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': 1}; > CREATE TABLE foo.foo (id int primary key, m map<int, text>); > insert into foo.foo (id, m) VALUES ( 1, {1: 'one', 2: 'two', 3:'three'}); > insert into foo.foo (id, m) VALUES ( 2, {1: '1one', 2: '2two', 3:'3three'}); > cqlsh> select id, m from foo.foo; > id | m > ----+------------------------------------- > 1 | {1: 'one', 2: 'two', 3: 'three'} > 2 | {1: '1one', 2: '2two', 3: '3three'} > (2 rows) > cqlsh> select id, m as "weofjkewopf" from foo.foo; > id | weofjkewopf > ----+----------------------------------------------------------------------- > 1 | OrderedMapSerializedKey([(1, u'one'), (2, u'two'), (3, u'three')]) > 2 | OrderedMapSerializedKey([(1, u'1one'), (2, u'2two'), (3, u'3three')]) > (2 rows) > Failed to format value OrderedMapSerializedKey([(1, u'one'), (2, u'two'), (3, > u'three')]) : 'NoneType' object has no attribute 'sub_types' > Failed to format value OrderedMapSerializedKey([(1, u'1one'), (2, u'2two'), > (3, u'3three')]) : 'NoneType' object has no attribute 'sub_types' > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)