forked from cmu-db/benchbase
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added array data type support (#146)
- Loading branch information
1 parent
d864c9d
commit ec48a36
Showing
8 changed files
with
171 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomLongArrayGen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.oltpbenchmark.benchmarks.featurebench.utils; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Random; | ||
|
||
public class RandomLongArrayGen implements BaseUtil { | ||
|
||
private List<Long> longArray; | ||
|
||
private Long minValue; | ||
private Long maxValue; | ||
private int arraySize; | ||
|
||
public RandomLongArrayGen(List<Object> values) { | ||
if (values.size() != 3) { | ||
throw new RuntimeException("Incorrect number of parameters for util function " | ||
+ this.getClass()); | ||
} | ||
this.arraySize = ((Number) values.get(0)).intValue(); | ||
if (arraySize <= 0) | ||
throw new RuntimeException("Please enter positive integer array length"); | ||
this.minValue = ((Number) values.get(1)).longValue(); | ||
this.maxValue = ((Number) values.get(2)).longValue(); | ||
if (minValue > maxValue) | ||
throw new RuntimeException("Please enter correct bounds for max and min value"); | ||
} | ||
|
||
public RandomLongArrayGen(List<Object> values, int workerId, int totalWorkers) { | ||
if (values.size() != 3) { | ||
throw new RuntimeException("Incorrect number of parameters for util function " | ||
+ this.getClass()); | ||
} | ||
this.arraySize = ((Number) values.get(0)).intValue(); | ||
if (arraySize <= 0) | ||
throw new RuntimeException("Please enter positive integer array length"); | ||
this.minValue = ((Number) values.get(1)).longValue(); | ||
this.maxValue = ((Number) values.get(2)).longValue(); | ||
if (minValue > maxValue) | ||
throw new RuntimeException("Please enter correct bounds for max and min value"); | ||
} | ||
|
||
@Override | ||
public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { | ||
Random random = new Random(); | ||
longArray = new ArrayList<>(); | ||
for (int i = 0; i < arraySize; i++) { | ||
Long rd = random.nextLong((maxValue - minValue) + 1) + minValue; | ||
longArray.add(rd); | ||
} | ||
return longArray.toString().replaceFirst("\\[", "{").replace("]", "}"); | ||
} | ||
} | ||
|
32 changes: 32 additions & 0 deletions
32
src/main/resources/benchmarks/perf-dataloader/array-mapping.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# arraySize, minLength,maxLength | ||
int2=RandomIntegerArrayGen:3:1,1,32767 | ||
int4=RandomIntegerArrayGen:3:1,1,2147483647 | ||
int8=RandomLongArrayGen:3:1,1,9223372036854775807 | ||
smallint=RandomIntegerArrayGen:3:1,1,32767 | ||
integer=RandomIntegerArrayGen:3:1,1,2147483647 | ||
bigint=RandomLongArrayGen:3:1,1,9223372036854775807 | ||
|
||
#int2=RandomIntegerArrayGen:3:2,-32768,32767 | ||
#int4=RandomIntegerArrayGen:3:2,-2147483648,2147483647 | ||
#int8=RandomLongArrayGen:3:2,-9223372036854775808,9223372036854775807 | ||
#smallint=RandomIntegerArrayGen:3:2,-32768,32767 | ||
#integer=RandomIntegerArrayGen:3:2,-2147483648,2147483647 | ||
#bigint=RandomLongArrayGen:3:2,-9223372036854775808,9223372036854775807 | ||
|
||
#decimal | ||
#numeric | ||
#real | ||
serial=RandomIntegerArrayGen:3:2,1,2147483647 | ||
bigserial=RandomLongArrayGen:3:2,1,9223372036854775807 | ||
#money | ||
#char | ||
#varchar | ||
#date | ||
#time | ||
#timestamp | ||
#timestamptz | ||
#interval | ||
#boolean | ||
#json | ||
#jsonb | ||
text=RandomTextArrayGen:3:1,20,20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters