Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D50459B54 for ; Mon, 23 Jan 2012 22:05:17 +0000 (UTC) Received: (qmail 30415 invoked by uid 500); 23 Jan 2012 22:05:17 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 30378 invoked by uid 500); 23 Jan 2012 22:05:17 -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 30370 invoked by uid 99); 23 Jan 2012 22:05:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2012 22:05:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.114] (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2012 22:05:14 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B66443192E5; Mon, 23 Jan 2012 22:04:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: jbellis@apache.org To: commits@cassandra.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [4/9] git commit: reformat Message-Id: <20120123220452.B66443192E5@tyr.zones.apache.org> Date: Mon, 23 Jan 2012 22:04:52 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org reformat Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e31879e5 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e31879e5 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e31879e5 Branch: refs/heads/trunk Commit: e31879e595a71e08519f94408be7eac069dd2096 Parents: 5409af4 Author: Jonathan Ellis Authored: Fri Jan 20 17:40:21 2012 -0600 Committer: Jonathan Ellis Committed: Mon Jan 23 16:02:44 2012 -0600 ---------------------------------------------------------------------- examples/hadoop_word_count/src/WordCountSetup.java | 56 +++++---- .../org/apache/cassandra/db/ColumnFamilyStore.java | 90 +++++++------- 2 files changed, 75 insertions(+), 71 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e31879e5/examples/hadoop_word_count/src/WordCountSetup.java ---------------------------------------------------------------------- diff --git a/examples/hadoop_word_count/src/WordCountSetup.java b/examples/hadoop_word_count/src/WordCountSetup.java index dd3c824..0139ea4 100644 --- a/examples/hadoop_word_count/src/WordCountSetup.java +++ b/examples/hadoop_word_count/src/WordCountSetup.java @@ -28,6 +28,7 @@ import org.apache.thrift.transport.TFramedTransport; import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransport; import org.apache.thrift.transport.TTransportException; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,7 +46,7 @@ public class WordCountSetup client.set_keyspace(WordCount.KEYSPACE); - Map>> mutationMap; + Map>> mutationMap; Column c; // text0: no rows @@ -69,8 +70,8 @@ public class WordCountSetup logger.info("added text2"); // text3: 1000 rows, 1 word - mutationMap = new HashMap>>(); - for (int i=0; i<1000; i++) + mutationMap = new HashMap>>(); + for (int i = 0; i < 1000; i++) { c = new Column() .setName(ByteBufferUtil.bytes("text3")) @@ -89,35 +90,37 @@ public class WordCountSetup client.add(key, colParent, new CounterColumn(ByteBufferUtil.bytes(sentence), - (long)sentence.split("\\s").length), - ConsistencyLevel.ONE ); + (long) sentence.split("\\s").length), + ConsistencyLevel.ONE); } logger.info("added key-if-verse1"); System.exit(0); } - private static Map>> getMutationMap(ByteBuffer key, String cf, Column c) + private static Map>> getMutationMap(ByteBuffer key, String cf, Column c) { - Map>> mutationMap = new HashMap>>(); + Map>> mutationMap = new HashMap>>(); addToMutationMap(mutationMap, key, cf, c); return mutationMap; } - private static void addToMutationMap(Map>> mutationMap, ByteBuffer key, String cf, Column c) + private static void addToMutationMap(Map>> mutationMap, ByteBuffer key, String cf, Column c) { Map> cfMutation = mutationMap.get(key); - if (cfMutation == null) { + if (cfMutation == null) + { cfMutation = new HashMap>(); mutationMap.put(key, cfMutation); } - + List mutationList = cfMutation.get(cf); - if (mutationList == null) { + if (mutationList == null) + { mutationList = new ArrayList(); - cfMutation.put(cf, mutationList); + cfMutation.put(cf, mutationList); } - + ColumnOrSuperColumn cc = new ColumnOrSuperColumn(); Mutation m = new Mutation(); @@ -126,7 +129,8 @@ public class WordCountSetup mutationList.add(m); } - private static void setupKeyspace(Cassandra.Iface client) throws TException, InvalidRequestException, SchemaDisagreementException { + private static void setupKeyspace(Cassandra.Iface client) throws TException, InvalidRequestException, SchemaDisagreementException + { List cfDefList = new ArrayList(); CfDef input = new CfDef(WordCount.KEYSPACE, WordCount.COLUMN_FAMILY); input.setComparator_type("AsciiType"); @@ -161,11 +165,11 @@ public class WordCountSetup { if (System.getProperty("cassandra.host") == null || System.getProperty("cassandra.port") == null) { - logger.warn("cassandra.host or cassandra.port is not defined, using default"); + logger.warn("cassandra.host or cassandra.port is not defined, using default"); } - return createConnection( System.getProperty("cassandra.host","localhost"), - Integer.valueOf(System.getProperty("cassandra.port","9160")), - Boolean.valueOf(System.getProperty("cassandra.framed", "true")) ); + return createConnection(System.getProperty("cassandra.host", "localhost"), + Integer.valueOf(System.getProperty("cassandra.port", "9160")), + Boolean.valueOf(System.getProperty("cassandra.framed", "true"))); } private static Cassandra.Client createConnection(String host, Integer port, boolean framed) throws TTransportException @@ -181,14 +185,14 @@ public class WordCountSetup private static String[] sentenceData() { // Public domain context, source http://en.wikisource.org/wiki/If%E2%80%94 return new String[]{ - "If you can keep your head when all about you", - "Are losing theirs and blaming it on you", - "If you can trust yourself when all men doubt you,", - "But make allowance for their doubting too:", - "If you can wait and not be tired by waiting,", - "Or being lied about, don’t deal in lies,", - "Or being hated, don’t give way to hating,", - "And yet don’t look too good, nor talk too wise;" + "If you can keep your head when all about you", + "Are losing theirs and blaming it on you", + "If you can trust yourself when all men doubt you,", + "But make allowance for their doubting too:", + "If you can wait and not be tired by waiting,", + "Or being lied about, don’t deal in lies,", + "Or being hated, don’t give way to hating,", + "And yet don’t look too good, nor talk too wise;" }; } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/e31879e5/src/java/org/apache/cassandra/db/ColumnFamilyStore.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java index 7ff46c9..0edae3f 100644 --- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java +++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java @@ -1306,51 +1306,51 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean { if (logger.isDebugEnabled()) logger.debug("Filtering {} for rows matching {}", rowIterator, filter); - List rows = new ArrayList(); - int columnsCount = 0; - try - { - while (rowIterator.hasNext() && rows.size() < filter.maxRows() && columnsCount < filter.maxColumns()) - { - // get the raw columns requested, and additional columns for the expressions if necessary - Row rawRow = rowIterator.next(); - ColumnFamily data = rawRow.cf; - - // roughtly - IFilter extraFilter = filter.getExtraFilter(data); - if (extraFilter != null) - { - QueryPath path = new QueryPath(columnFamily); - ColumnFamily cf = filter.cfs.getColumnFamily(new QueryFilter(rawRow.key, path, extraFilter)); - if (cf != null) - data.addAll(cf, HeapAllocator.instance); - } - - if (!filter.isSatisfiedBy(data)) - continue; - - logger.debug("{} satisfies all filter expressions", data); - // cut the resultset back to what was requested, if necessary - data = filter.prune(data); - rows.add(new Row(rawRow.key, data)); - if (data != null) - columnsCount += data.getLiveColumnCount(); - // Update the underlying filter to avoid querying more columns per slice than necessary - filter.updateColumnsLimit(columnsCount); - } - return rows; - } - finally - { - try - { - rowIterator.close(); - } - catch (IOException e) - { - throw new IOError(e); - } - } + List rows = new ArrayList(); + int columnsCount = 0; + try + { + while (rowIterator.hasNext() && rows.size() < filter.maxRows() && columnsCount < filter.maxColumns()) + { + // get the raw columns requested, and additional columns for the expressions if necessary + Row rawRow = rowIterator.next(); + ColumnFamily data = rawRow.cf; + + // roughtly + IFilter extraFilter = filter.getExtraFilter(data); + if (extraFilter != null) + { + QueryPath path = new QueryPath(columnFamily); + ColumnFamily cf = filter.cfs.getColumnFamily(new QueryFilter(rawRow.key, path, extraFilter)); + if (cf != null) + data.addAll(cf, HeapAllocator.instance); + } + + if (!filter.isSatisfiedBy(data)) + continue; + + logger.debug("{} satisfies all filter expressions", data); + // cut the resultset back to what was requested, if necessary + data = filter.prune(data); + rows.add(new Row(rawRow.key, data)); + if (data != null) + columnsCount += data.getLiveColumnCount(); + // Update the underlying filter to avoid querying more columns per slice than necessary + filter.updateColumnsLimit(columnsCount); + } + return rows; + } + finally + { + try + { + rowIterator.close(); + } + catch (IOException e) + { + throw new IOError(e); + } + } } public AbstractType getComparator()