From cc2cfa5ed6d8abeec111e11be78d7508d0efa90e Mon Sep 17 00:00:00 2001 From: Eric Enzler <92583189+ETHenzlere@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:30:49 -0400 Subject: [PATCH] Feat: Support for Distributions in Templated Workloads (#385) PR adds support for various Numerical Distributions in templated benchmarks - Uniform - Binomial - Zipfian - Scrambled The distributions work not only for integers, but also different types such as timestamps, long, float A table of supported combinations can be found in the templated benchmarks readme. | Type | uniform | binomial | zipfian | scrambled (zipfian) | |---|:---:|:---:|:---:|:---:| | INTEGER | X | X | X | X | | FLOAT / REAL | X | X|- | - | | BIGINT | X | X | X | X | | VARCHAR / STRING | X | -| -| -| | TIMESTAMP | X | X |X |X | | DATE | X | X| X| X| | TIME | X |X | X| X| Usage example: ```xml ``` This PR is not a breaking change - One can still use a static value in the templated queries. `10` In the future, I could see a breaking change that adds the datatype directly to the values so the TemplatedValue can do the type handling directly. ``. This would make type checking easier and remove the need to store the original min/max values as strings for all datatypes. --------- Co-authored-by: Brian Kroth --- data/templated/example.xml | 39 ++- .../api/templates/ObjectFactory.java | 31 +- .../api/templates/TemplateType.java | 93 ++++-- .../api/templates/TemplatesType.java | 45 +-- .../api/templates/TypesType.java | 36 ++- .../api/templates/ValueType.java | 140 +++++++++ .../api/templates/ValuesType.java | 44 +-- .../benchmarks/templated/README.md | 106 ++++++- .../templated/TemplatedBenchmark.java | 99 ++++++- .../templated/procedures/GenericQuery.java | 134 ++++++++- .../templated/util/GenericQueryOperation.java | 6 +- .../templated/util/TemplatedValue.java | 274 ++++++++++++++++++ .../templated/util/ValueGenerator.java | 8 + .../oltpbenchmark/util/JDBCSupportedType.java | 22 ++ src/main/resources/templates.xsd | 18 +- 15 files changed, 971 insertions(+), 124 deletions(-) create mode 100644 src/main/java/com/oltpbenchmark/api/templates/ValueType.java create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/templated/util/TemplatedValue.java create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/templated/util/ValueGenerator.java create mode 100644 src/main/java/com/oltpbenchmark/util/JDBCSupportedType.java diff --git a/data/templated/example.xml b/data/templated/example.xml index 4051b8a7b..e4c428b14 100644 --- a/data/templated/example.xml +++ b/data/templated/example.xml @@ -9,12 +9,12 @@ INTEGER - 3 - 4 + + - 5 - 6 + +