99ce81b4c8c573a246285f745c98598f1e771f41
[phoenix.git] / phoenix-pherf / src / test / resources / scenario / test_scenario.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <!--
3 ~ Licensed to the Apache Software Foundation (ASF) under one
4 ~ or more contributor license agreements. See the NOTICE file
5 ~ distributed with this work for additional information
6 ~ regarding copyright ownership. The ASF licenses this file
7 ~ to you under the Apache License, Version 2.0 (the
8 ~ "License"); you may not use this file except in compliance
9 ~ with the License. You may obtain a copy of the License at
10 ~
11 ~ http://www.apache.org/licenses/LICENSE-2.0
12 ~
13 ~ Unless required by applicable law or agreed to in writing, software
14 ~ distributed under the License is distributed on an "AS IS" BASIS,
15 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 ~ See the License for the specific language governing permissions and
17 ~ limitations under the License.
18 -->
19
20 <datamodel name="test_scenario">
21 <datamapping>
22 <column>
23 <!-- This column type defines what will generally happen to VARCHAR fields unless they are explicitly defined or overridden elsewhere -->
24 <type>VARCHAR</type>
25 <dataSequence>RANDOM</dataSequence>
26 <length>15</length>
27 <name>GENERAL_VARCHAR</name>
28 </column>
29 <column>
30 <type>CHAR</type>
31 <dataSequence>SEQUENTIAL</dataSequence>
32 <length>15</length>
33 <name>GENERAL_CHAR</name>
34 </column>
35 <column>
36 <type>TIMESTAMP</type>
37 <!--SEQUENTIAL is unsupported for DATE -->
38 <dataSequence>RANDOM</dataSequence>
39 <!-- Number [0-100] that represents the probability of creating a null value -->
40 <!-- The higher the number, the more like the value will returned will be null -->
41 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
42 <nullChance>0</nullChance>
43 <minValue>2020</minValue>
44 <maxValue>2025</maxValue>
45 <name>GENERAL_TIMESTAMP</name>
46 </column>
47 <column>
48 <type>DATE</type>
49 <!--SEQUENTIAL is unsupported for DATE -->
50 <dataSequence>RANDOM</dataSequence>
51 <!-- Number [0-100] that represents the probability of creating a null value -->
52 <!-- The higher the number, the more like the value will returned will be null -->
53 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
54 <nullChance>0</nullChance>
55 <minValue>1975</minValue>
56 <maxValue>2025</maxValue>
57 <name>GENERAL_DATE</name>
58 </column>
59 <column>
60 <type>DATE</type>
61 <!--SEQUENTIAL is unsupported for DATE -->
62 <dataSequence>RANDOM</dataSequence>
63 <!-- Number [0-100] that represents the probability of creating a null value -->
64 <!-- The higher the number, the more like the value will returned will be null -->
65 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
66 <nullChance>0</nullChance>
67 <useCurrentDate>true</useCurrentDate>
68 <name>NOW_DATE</name>
69 </column>
70 <column>
71 <type>DECIMAL</type>
72 <dataSequence>RANDOM</dataSequence>
73 <minValue>0</minValue>
74 <maxValue>1</maxValue>
75
76 <!-- Precision is limited to 18 -->
77 <precision>18</precision>
78 <!-- Number [0-100] that represents the probability of creating a null value -->
79 <!-- The higher the number, the more like the value will returned will be null -->
80 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
81 <nullChance>10</nullChance>
82 <name>GENERAL_DECIMAL</name>
83 </column>
84 <column>
85 <type>INTEGER</type>
86 <dataSequence>RANDOM</dataSequence>
87 <minValue>1</minValue>
88 <maxValue>50000000</maxValue>
89 <!-- Number [0-100] that represents the probability of creating a null value -->
90 <!-- The higher the number, the more like the value will returned will be null -->
91 <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
92 <nullChance>100</nullChance>
93 <name>GENERAL_INTEGER</name>
94 </column>
95 <column>
96 <type>DATE</type>
97 <name>CREATED_DATE</name>
98 <minValue>1975</minValue>
99 <maxValue>2025</maxValue>
100 <valuelist>
101 <!-- Distributes randomly with equal chance of being picked -->
102 <datavalue distribution="80">
103 <!-- Joda time format: yyyy-MM-dd HH:mm:ss.SSS ZZZ -->
104 <minValue>2019-09-15 00:01:00.000</minValue>
105 <maxValue>2019-09-15 11:00:00.000</maxValue>
106 </datavalue>
107 <datavalue distribution="10">
108 <value>2019-09-19 00:01:00.000</value>
109 </datavalue>
110 <datavalue distribution="10">
111 <minValue>2019-09-22 00:01:00.000</minValue>
112 <maxValue>2019-09-22 00:01:00.300</maxValue>
113 </datavalue>
114 </valuelist>
115 </column>
116 <column>
117 <type>DATE</type>
118 <name>PRESENT_DATE</name>
119 <minValue>1975</minValue>
120 <maxValue>2025</maxValue>
121 <valuelist>
122 <!-- Distributes randomly with equal chance of being picked -->
123 <datavalue distribution="80">
124 <!-- Joda time format: yyyy-MM-dd HH:mm:ss.SSS z -->
125 <useCurrentDate>true</useCurrentDate>
126 </datavalue>
127 <datavalue distribution="20">
128 <useCurrentDate>true</useCurrentDate>
129 </datavalue>
130 </valuelist>
131 </column>
132 <column>
133 <type>CHAR</type>
134 <userDefined>true</userDefined>
135 <dataSequence>LIST</dataSequence>
136 <length>15</length>
137 <name>PARENT_ID</name>
138 <valuelist>
139 <!-- Distributes according to specified values. These must total 100 -->
140 <datavalue distribution="60">
141 <value>aAAyYhnNbBs9kWk</value>
142 </datavalue>
143 <datavalue distribution="20">
144 <value>bBByYhnNbBs9kWu</value>
145 </datavalue>
146 <datavalue distribution="20">
147 <value>cCCyYhnNbBs9kWr</value>
148 </datavalue>
149 </valuelist>
150 </column>
151 <column>
152 <!-- This column type defines what will generally happen to VARCHAR fields unless they are explicitly defined or overridden elsewhere -->
153 <type>VARCHAR</type>
154 <length>10</length>
155 <userDefined>true</userDefined>
156 <dataSequence>RANDOM</dataSequence>
157 <name>OLDVAL_STRING</name>
158 <prefix>MYPRFX</prefix>
159 </column>
160 <column>
161 <!-- This column type defines what will generally happen to VARCHAR fields unless they are explicitly defined or overridden elsewhere -->
162 <type>VARCHAR</type>
163 <length>15</length>
164 <userDefined>true</userDefined>
165 <dataSequence>SEQUENTIAL</dataSequence>
166 <name>NEWVAL_STRING</name>
167 <prefix>0F90000000000X</prefix>
168 </column>
169 <column>
170 <type>VARCHAR_ARRAY</type>
171 <userDefined>true</userDefined>
172 <name>VAR_ARRAY</name>
173 <valuelist>
174 <datavalue>
175 <value>Foo</value>
176 </datavalue>
177 <datavalue>
178 <value>Bar</value>
179 </datavalue>
180 </valuelist>
181 </column>
182 <column>
183 <type>CHAR</type>
184 <length>3</length>
185 <userDefined>true</userDefined>
186 <dataSequence>LIST</dataSequence>
187 <name>IDENTIFIER</name>
188 <valuelist>
189 <!-- Distributes according to specified values. These must total 100 -->
190 <datavalue distribution="60">
191 <value>ABC</value>
192 </datavalue>
193 <datavalue distribution="20">
194 <value>XYZ</value>
195 </datavalue>
196 <datavalue distribution="20">
197 <value>LMN</value>
198 </datavalue>
199 </valuelist>
200 </column>
201 <column>
202 <type>CHAR</type>
203 <userDefined>true</userDefined>
204 <dataSequence>SEQUENTIAL</dataSequence>
205 <length>8</length>
206 <name>OTHER_ID</name>
207 <prefix>z0Oxx00</prefix>
208 </column>
209 <column>
210 <type>VARBINARY</type>
211 <userDefined>true</userDefined>
212 <dataSequence>SEQUENTIAL</dataSequence>
213 <length>8</length>
214 <name>VAR_BIN</name>
215 <prefix>VBOxx00</prefix>
216 </column>
217 <column>
218 <type>VARCHAR</type>
219 <userDefined>true</userDefined>
220 <dataSequence>SEQUENTIAL</dataSequence>
221 <length>1</length>
222 <name>FIELD</name>
223 </column>
224 </datamapping>
225 <scenarios>
226 <scenario tableName="PHERF.TEST_TABLE" rowCount="100" name="testScenarioRW">
227 <!-- Scenario level rule overrides will be unsupported in V1.
228 You can use the general datamappings in the mean time-->
229 <dataOverride>
230 <column>
231 <type>VARCHAR</type>
232 <userDefined>true</userDefined>
233 <dataSequence>RANDOM</dataSequence>
234 <length>5</length>
235 <name>FIELD</name>
236 </column>
237 </dataOverride>
238
239 <!--
240 This is used to add mixed R/W workloads.
241
242 If this tag exists, a writer pool will be created based on the below properties.
243 These props will override the default values in pherf.properties, but only for this
244 scenario.The write jobs will run in conjunction with the querySet below.
245 -->
246 <writeParams executionDurationInMs="10000">
247 <!--
248 Number of writer it insert into the threadpool
249 -->
250 <writerThreadCount>2</writerThreadCount>
251
252 <!--
253 Time in Ms that each thread will sleep between batch writes. This helps to
254 throttle writers.
255 -->
256 <threadSleepDuration>10</threadSleepDuration>
257
258 <batchSize>1000</batchSize>
259 </writeParams>
260 <querySet concurrency="1" executionType="PARALLEL" executionDurationInMs="10000">
261 <query id="q3" statement="select count(*) from PHERF.TEST_TABLE"/>
262 <query id="q4" statement="select sum(SOME_INT) from PHERF.TEST_TABLE"/>
263 </querySet>
264
265 </scenario>
266
267 <scenario tableName="PHERF.TEST_TABLE" rowCount="30" name="testScenario">
268 <!-- Scenario level rule overrides will be unsupported in V1.
269 You can use the general datamappings in the mean time-->
270 <dataOverride>
271 <column>
272 <type>VARCHAR</type>
273 <userDefined>true</userDefined>
274 <dataSequence>RANDOM</dataSequence>
275 <length>10</length>
276 <name>FIELD</name>
277 </column>
278 </dataOverride>
279
280 <!--Note: 1. Minimum of executionDurationInMs or numberOfExecutions. Which ever is reached first
281 2. DDL included in query are executed only once on start of querySet execution.
282 -->
283 <querySet concurrency="1-3" executionType="SERIAL" executionDurationInMs="5000"
284 numberOfExecutions="100">
285 <query id="q1" tenantId="123456789012345" expectedAggregateRowCount="0"
286 statement="select count(*) from PHERF.TEST_TABLE"/>
287 <!-- queryGroup is a way to organize queries across tables or scenario files.
288 The value will be dumped to results. This gives a value to group by on reporting to compare queries -->
289 <query id="q2" queryGroup="g1"
290 statement="select sum(SOME_INT) from PHERF.TEST_TABLE"/>
291 </querySet>
292 <!--Minimum of executionDurationInMs or numberOfExecutions. Which ever is reached first -->
293 <querySet concurrency="2-3" executionType="PARALLEL" executionDurationInMs="10000"
294 numberOfExecutions="10">
295 <query id="q3" statement="select count(*) from PHERF.TEST_TABLE"/>
296 <query id="q4" statement="select sum(SOME_INT) from PHERF.TEST_TABLE"/>
297 </querySet>
298 </scenario>
299
300 <scenario tableName="PHERF.TEST_TABLE" rowCount="99" name="testPreAndPostDdls">
301 <preScenarioDdls>
302 <ddl statement="CREATE INDEX IDX_DIVISION ON ? (DIVISION)" tableName="PHERF.PHERF_PROD_TEST_UNSALTED"/>
303 </preScenarioDdls>
304
305 <postScenarioDdls>
306 <ddl statement="CREATE INDEX IDX_OLDVAL_STRING ON ? (OLDVAL_STRING)" tableName="PHERF.PHERF_PROD_TEST_UNSALTED"/>
307 <ddl statement="CREATE INDEX IDX_CONNECTION_ID ON ? (CONNECTION_ID)" tableName="PHERF.PHERF_PROD_TEST_UNSALTED"/>
308 </postScenarioDdls>
309
310 <querySet concurrency="1" executionType="SERIAL" executionDurationInMs="5000"
311 numberOfExecutions="1">
312 <query id="q1" expectedAggregateRowCount="99" statement="select count(*) from PHERF.TEST_TABLE"/>
313 </querySet>
314 </scenario>
315
316 <!-- To configure a Write Workload to write to a tenant specific view users need to
317 specify the tenantId attribute on the scenario, specifying the tenant they
318 want to write data for as the attribute value. This tells Pherf to take out a
319 tenant-specific connection for executing the write workload.
320 The name of the tenant specific view to write to can then be specified as the value of
321 the tablename attribute. This assumes the tenant specific view has been created. To
322 dynamically create the view see comments below with regard to the ddl attribute.
323 -->
324 <scenario tableName="PHERF.TEST_VIEW" tenantId="xyzdefghijklmno"
325 rowCount="100" name="testMTWriteScenario">
326 <preScenarioDdls>
327 <ddl statement="CREATE VIEW IF NOT EXISTS PHERF.TEST_VIEW (field1 VARCHAR, field2 VARCHAR) AS SELECT * FROM PHERF.TEST_MULTI_TENANT_TABLE" />
328 </preScenarioDdls>
329 </scenario>
330 <!-- Scenario level DDL that is dynamically executed before the Write Workload is run.
331 This pattern is really useful when you want to write data to multi-tenant view and the tenant id is
332 tightly bound to the scenario. In such cases you can't create the view through the data model flow.
333 The value of the tableName attribute is name of the view that is dynamically created based on the DDL
334 in the ddl attribute. Queries accessing the View will need to manually make sure Pherf was run with the -l option at
335 least once.
336 -->
337 <scenario tableName="PHERF.TEST_MT_VIEW" tenantId="abcdefghijklmno"
338 rowCount="100" name="testMTDdlWriteScenario">
339 <preScenarioDdls>
340 <ddl statement="CREATE VIEW IF NOT EXISTS PHERF.TEST_MT_VIEW (field1 VARCHAR) AS SELECT * FROM PHERF.TEST_MULTI_TENANT_TABLE" />
341 </preScenarioDdls>
342 </scenario>
343
344 </scenarios>
345 </datamodel>