mirror of https://github.com/apache/cassandra
Support BigDecimal in cassanra-stress
patch by Sebastian Estevez; reviewed by Benedict for CASSANDRA-10048
This commit is contained in:
parent
df9e798de6
commit
5bee617fea
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<BigDecimal>
|
||||
{
|
||||
public BigDecimals(String name, GeneratorConfig config)
|
||||
{
|
||||
super(DecimalType.instance, config, name, BigDecimal.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal generate()
|
||||
{
|
||||
return BigDecimal.valueOf(identityDistribution.next());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue