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 08386200CB0 for ; Fri, 23 Jun 2017 16:42:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 06DFF160BD4; Fri, 23 Jun 2017 14:42:06 +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 4D808160BCA for ; Fri, 23 Jun 2017 16:42:05 +0200 (CEST) Received: (qmail 13829 invoked by uid 500); 23 Jun 2017 14:42:04 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 13818 invoked by uid 99); 23 Jun 2017 14:42:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jun 2017 14:42:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 051121AFD0B for ; Fri, 23 Jun 2017 14:42:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id eqg_PNNAUOOr for ; Fri, 23 Jun 2017 14:42:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id DFD8F5F6D3 for ; Fri, 23 Jun 2017 14:42:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5292FE05BF for ; Fri, 23 Jun 2017 14:42:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0A6842193E for ; Fri, 23 Jun 2017 14:42:00 +0000 (UTC) Date: Fri, 23 Jun 2017 14:42:00 +0000 (UTC) From: "Arpan Khandelwal (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CASSANDRA-13633) Data not loading to keyspace using sstable create via CQLSSTableWriter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 23 Jun 2017 14:42:06 -0000 Arpan Khandelwal created CASSANDRA-13633: -------------------------------------------- Summary: Data not loading to keyspace using sstable create via CQLSSTableWriter Key: CASSANDRA-13633 URL: https://issues.apache.org/jira/browse/CASSANDRA-13633 Project: Cassandra Issue Type: Bug Components: Tools Environment: Linux Reporter: Arpan Khandelwal Fix For: 3.10 Attachments: dataloading_result.png Scenario : Need to read CSV, Write SSTable using CQLSSTableWriter and load it to the keyspace. [Explained here|https://stackoverflow.com/questions/44713777/json-cassandra-field-value-parsing-using-antlr4] . That was not working so tried a simple test case available here[https://github.com/apache/cassandra/blob/cassandra-3.11/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java#L378] Which did not worked either. Following is what i tried. Created cql_keyspace3 with below table and types. {code:java} CREATE TYPE cql_keyspace3.tuple2 (a int, b int); CREATE TYPE cql_keyspace3.tuple3 (a int, b int, c int) CREATE TABLE cql_keyspace3.table3 ( k int, v1 list>, v2 frozen, PRIMARY KEY (k)); {code} ran code {code:java} final String KS = "cql_keyspace3"; final String TABLE = "table3"; final String schema = "CREATE TABLE " + KS + "." + TABLE + " (" + " k int," + " v1 list>," + " v2 frozen," + " PRIMARY KEY (k)" + ")"; File tempdir = Files.createTempDir(); File dataDir = new File(tempdir.getAbsolutePath() + File.separator + KS + File.separator + TABLE); System.out.println(dataDir); assert dataDir.mkdirs(); CQLSSTableWriter writer = CQLSSTableWriter.builder().inDirectory(dataDir) .withType("CREATE TYPE " + KS + ".tuple2 (a int, b int)") .withType("CREATE TYPE " + KS + ".tuple3 (a int, b int, c int)").forTable(schema) .using("INSERT INTO " + KS + "." + TABLE + " (k, v1, v2) " + "VALUES (?, ?, ?)").build(); UserType tuple2Type = writer.getUDType("tuple2"); UserType tuple3Type = writer.getUDType("tuple3"); for (int i = 0; i < 100; i++) { writer.addRow(i, ImmutableList.builder().add(tuple2Type.newValue().setInt("a", i * 10).setInt("b", i * 20)) .add(tuple2Type.newValue().setInt("a", i * 30).setInt("b", i * 40)).build(), tuple3Type.newValue().setInt("a", i * 100).setInt("b", i * 200).setInt("c", i * 300)); } writer.close(); {code} It generated sstable in "/tmp/1498224996687-0/cql_keyspace3" dir Loaded data using following command {code:java} /tmp/1498224996687-0/cql_keyspace3 $ sstableloader -d localhost table3-e6e0fa61581911e78be6a72ebce4c745/ Established connection to initial hosts Opening sstables and calculating sections to stream Streaming relevant part of /tmp/1498224996687-0/cql_keyspace3/table3-e6e0fa61581911e78be6a72ebce4c745/mc-2-big-Data.db to [localhost/127.0.0.1] progress: [localhost/127.0.0.1]0:1/1 100% total: 100% 1.060KiB/s (avg: 1.060KiB/s) progress: [localhost/127.0.0.1]0:1/1 100% total: 100% 0.000KiB/s (avg: 0.984KiB/s) Summary statistics: Connections per host : 1 Total files transferred : 1 Total bytes transferred : 5.572KiB Total duration : 5668 ms Average transfer rate : 0.982KiB/s Peak transfer rate : 1.060KiB/s {code} ||k||v1||v2|| |92|[{a:920,b:1840}, {a:2760,b:3680}]| find full result in attached snapshot. Please let me know which version of cassandra I should which can allow me to load reseverd types, collections, UDT from sstable create using CQLSSTableWriter. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org For additional commands, e-mail: commits-help@cassandra.apache.org