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 7E75E17BE9 for ; Sun, 23 Aug 2015 10:31:23 +0000 (UTC) Received: (qmail 56542 invoked by uid 500); 23 Aug 2015 10:31:23 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 56436 invoked by uid 500); 23 Aug 2015 10:31:23 -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 56092 invoked by uid 99); 23 Aug 2015 10:31:22 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Aug 2015 10:31:22 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B2C3EE04BE; Sun, 23 Aug 2015 10:31:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: benedict@apache.org To: commits@cassandra.apache.org Date: Sun, 23 Aug 2015 10:31:24 -0000 Message-Id: <7b790dbd34734fdea432866a9f2b0254@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [03/10] cassandra git commit: Support BigDecimal in cassanra-stress Support BigDecimal in cassanra-stress patch by Sebastian Estevez; reviewed by Benedict for CASSANDRA-10048 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5bee617f Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5bee617f Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5bee617f Branch: refs/heads/cassandra-3.0 Commit: 5bee617fea68e7b745c18d14b9b7076ab6fe219b Parents: df9e798 Author: phact Authored: Fri Aug 21 09:50:43 2015 +0100 Committer: Benedict Elliott Smith Committed: Sun Aug 23 11:27:16 2015 +0100 ---------------------------------------------------------------------- .../apache/cassandra/stress/StressProfile.java | 3 +- .../stress/generate/values/BigDecimals.java | 39 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/5bee617f/tools/stress/src/org/apache/cassandra/stress/StressProfile.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java index 49c4682..192b535 100644 --- a/tools/stress/src/org/apache/cassandra/stress/StressProfile.java +++ b/tools/stress/src/org/apache/cassandra/stress/StressProfile.java @@ -502,6 +502,7 @@ public class StressProfile implements Serializable case BOOLEAN: return new Booleans(name, config); case DECIMAL: + return new BigDecimals(name, config); case DOUBLE: return new Doubles(name, config); case FLOAT: @@ -523,7 +524,7 @@ public class StressProfile implements Serializable case LIST: return new Lists(name, getGenerator(name, type.getTypeArguments().get(0), config), config); default: - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException("Because of this name: "+name+" if you removed it from the yaml and are still seeing this, make sure to drop table"); } } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/5bee617f/tools/stress/src/org/apache/cassandra/stress/generate/values/BigDecimals.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/generate/values/BigDecimals.java b/tools/stress/src/org/apache/cassandra/stress/generate/values/BigDecimals.java new file mode 100644 index 0000000..42758ed --- /dev/null +++ b/tools/stress/src/org/apache/cassandra/stress/generate/values/BigDecimals.java @@ -0,0 +1,39 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.cassandra.stress.generate.values; + +import org.apache.cassandra.db.marshal.DecimalType; + +import java.math.BigDecimal; + +public class BigDecimals extends Generator +{ + public BigDecimals(String name, GeneratorConfig config) + { + super(DecimalType.instance, config, name, BigDecimal.class); + } + + @Override + public BigDecimal generate() + { + return BigDecimal.valueOf(identityDistribution.next()); + } +}