Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9EE2F200B89 for ; Wed, 7 Sep 2016 06:11:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9CFC5160ACE; Wed, 7 Sep 2016 04:11:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E100C160AA9 for ; Wed, 7 Sep 2016 06:11:21 +0200 (CEST) Received: (qmail 80907 invoked by uid 500); 7 Sep 2016 04:11:21 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 80892 invoked by uid 99); 7 Sep 2016 04:11:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Sep 2016 04:11:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 6F3362C1B79 for ; Wed, 7 Sep 2016 04:11:20 +0000 (UTC) Date: Wed, 7 Sep 2016 04:11:20 +0000 (UTC) From: "Andy Tolbert (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-12594) sstabledump fails on frozen collection cells MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 07 Sep 2016 04:11:22 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-12594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15469464#comment-15469464 ] Andy Tolbert commented on CASSANDRA-12594: ------------------------------------------ {quote} sstabledump returns JSON and we now have a proper toJSONString() method in AbstractType that handles that properly so it would make sense to simply use that for everything in sstabledump in my opinion {quote} That makes perfect sense to me, and also likely easy to change. I'll play with that a bit and follow on sometime this week. > sstabledump fails on frozen collection cells > -------------------------------------------- > > Key: CASSANDRA-12594 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12594 > Project: Cassandra > Issue Type: Bug > Reporter: Andy Tolbert > Assignee: Andy Tolbert > Priority: Minor > Fix For: 3.0.9, 3.9 > > Attachments: CASSANDRA-12594-3.0.txt, CASSANDRA-12594-3.0_2.txt > > > sstabledump throws an exception when attempting to parse a cell that is a frozen collection, i.e.: > {noformat} > [ > { > "partition" : { > "key" : [ "0" ], > "position" : 0 > }, > "rows" : [ > { > "type" : "row", > "position" : 18, > "liveness_info" : { "tstamp" : "2016-09-01T22:06:45.670810Z" }, > "cells" : [ > { "name" : "m", "value" } > ] } > ] } > ]Exception in thread "main" java.lang.IllegalArgumentException > at java.nio.Buffer.limit(Buffer.java:275) > at org.apache.cassandra.utils.ByteBufferUtil.readBytes(ByteBufferUtil.java:613) > at org.apache.cassandra.db.marshal.TupleType.getString(TupleType.java:211) > at org.apache.cassandra.tools.JsonTransformer.serializeCell(JsonTransformer.java:441) > at org.apache.cassandra.tools.JsonTransformer.serializeColumnData(JsonTransformer.java:375) > at org.apache.cassandra.tools.JsonTransformer.serializeRow(JsonTransformer.java:279) > at org.apache.cassandra.tools.JsonTransformer.serializePartition(JsonTransformer.java:214) > at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) > at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) > at java.util.Iterator.forEachRemaining(Iterator.java:116) > at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) > at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) > at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) > at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) > at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) > at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) > at org.apache.cassandra.tools.JsonTransformer.toJson(JsonTransformer.java:102) > at org.apache.cassandra.tools.SSTableExport.main(SSTableExport.java:242) > {noformat} > This is because the code doesn't consider that the cell may be a frozen collection, and attempts to get the string representation using the value type which doesn't work. > Example data: > {noformat} > CREATE KEYSPACE simple WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; > CREATE TABLE simple.unfrozen_map ( > k int PRIMARY KEY, > m map>> > ); > CREATE TABLE simple.frozen_map ( > k int PRIMARY KEY, > m frozen>>> > ); > insert into unfrozen_map (k, m) values (0, {'a': ('b', 'c'), 'd': ('e', 'f'), 'g': ('h', 'i')}); > insert into frozen_map (k, m) values (0, {'a': ('b', 'c'), 'd': ('e', 'f'), 'g': ('h', 'i')}); > {noformat} > unfrozen_map will properly dump each cell individually, but frozen_map fails. -- This message was sent by Atlassian JIRA (v6.3.4#6332)