<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
  ~ 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.
  -->

<datamodel name="PROD_TEST_UNSALTED">
    <datamapping>
        <column>
            <!-- This column type defines what will generally happen to VARCHAR fields unless they are explicitly defined or overridden elsewhere -->
            <type>VARCHAR</type>
            <dataSequence>RANDOM</dataSequence>
            <length>15</length>
            <name>GENERAL_VARCHAR</name>
        </column>
        <column>
            <type>CHAR</type>
            <dataSequence>RANDOM</dataSequence>
            <length>15</length>
            <name>GENERAL_CHAR</name>
        </column>
        <column>
            <type>DATE</type>
            <!--SEQUENTIAL is unsupported for DATE -->
            <dataSequence>RANDOM</dataSequence>
            <!-- Number [0-100] that represents the probability of creating a null value -->
            <!-- The higher the number, the more like the value will returned will be null -->
            <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
            <nullChance>0</nullChance>
            <minValue>1975</minValue>
            <maxValue>2025</maxValue>
            <name>GENERAL_DATE</name>
        </column>
        <column>
            <type>DECIMAL</type>
            <dataSequence>RANDOM</dataSequence>
            <minValue>0</minValue>
            <maxValue>1</maxValue>

            <!-- Precision is limited to 18 -->
            <precision>18</precision>
            <!-- Number [0-100] that represents the probability of creating a null value -->
            <!-- The higher the number, the more like the value will returned will be null -->
            <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
            <nullChance>90</nullChance>
            <name>GENERAL_DECIMAL</name>
        </column>
        <column>
            <type>INTEGER</type>
            <dataSequence>RANDOM</dataSequence>
            <minValue>1</minValue>
            <maxValue>50000000</maxValue>
            <!-- Number [0-100] that represents the probability of creating a null value -->
            <!-- The higher the number, the more like the value will returned will be null -->
            <!-- Leaving this tag out is equivalent to having a 0 probability. i.e. never null -->
            <nullChance>100</nullChance>
            <name>GENERAL_INTEGER</name>
        </column>
        <column>
            <type>CHAR</type>
            <userDefined>true</userDefined>
            <dataSequence>LIST</dataSequence>
            <length>15</length>
            <name>TENANT_ID</name>
            <valuelist>
                <datavalue distribution="40">
                    <value>00Dxx0000001gER</value>
                </datavalue>
                <datavalue distribution="20">
                    <value>00Dxx0000001gES</value>
                </datavalue>
                <datavalue distribution="20">
                    <value>00Dxx0000001gET</value>
                </datavalue>
                <datavalue distribution="15">
                    <value>00Dxx0000001gEU</value>
                </datavalue>
                <datavalue distribution="5">
                    <value>00Dxx0000001gEV</value>
                </datavalue>
            </valuelist>
        </column>
        <column>
            <type>DATE</type>
            <userDefined>true</userDefined>
            <dataSequence>LIST</dataSequence>
            <name>CREATED_DATE</name>
            <nullChance>0</nullChance>
            <valuelist>
                <datavalue distribution="2">
                    <minValue>2014-08-31 00:00:00.000</minValue>
                    <maxValue>2014-09-01 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-01 00:00:00.000</minValue>
                    <maxValue>2014-09-02 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-02 00:00:00.000</minValue>
                    <maxValue>2014-09-03 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-03 00:00:00.000</minValue>
                    <maxValue>2014-09-04 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-04 00:00:00.000</minValue>
                    <maxValue>2014-09-05 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-05 00:00:00.000</minValue>
                    <maxValue>2014-09-06 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-06 00:00:00.000</minValue>
                    <maxValue>2014-09-07 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-07 00:00:00.000</minValue>
                    <maxValue>2014-09-08 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-08 00:00:00.000</minValue>
                    <maxValue>2014-09-09 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-09 00:00:00.000</minValue>
                    <maxValue>2014-09-10 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-10 00:00:00.000</minValue>
                    <maxValue>2014-09-11 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-11 00:00:00.000</minValue>
                    <maxValue>2014-09-12 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-12 00:00:00.000</minValue>
                    <maxValue>2014-09-13 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-13 00:00:00.000</minValue>
                    <maxValue>2014-09-14 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-14 00:00:00.000</minValue>
                    <maxValue>2014-09-15 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-15 00:00:00.000</minValue>
                    <maxValue>2014-09-16 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-16 00:00:00.000</minValue>
                    <maxValue>2014-09-17 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-17 00:00:00.000</minValue>
                    <maxValue>2014-09-18 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-18 00:00:00.000</minValue>
                    <maxValue>2014-09-19 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-19 00:00:00.000</minValue>
                    <maxValue>2014-09-20 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-20 00:00:00.000</minValue>
                    <maxValue>2014-09-21 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-21 00:00:00.000</minValue>
                    <maxValue>2014-09-22 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-22 00:00:00.000</minValue>
                    <maxValue>2014-09-23 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-23 00:00:00.000</minValue>
                    <maxValue>2014-09-24 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-24 00:00:00.000</minValue>
                    <maxValue>2014-09-25 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-25 00:00:00.000</minValue>
                    <maxValue>2014-09-26 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-26 00:00:00.000</minValue>
                    <maxValue>2014-09-27 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-27 00:00:00.000</minValue>
                    <maxValue>2014-09-28 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-28 00:00:00.000</minValue>
                    <maxValue>2014-09-29 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-29 00:00:00.000</minValue>
                    <maxValue>2014-09-30 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-09-30 00:00:00.000</minValue>
                    <maxValue>2014-10-01 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-01 00:00:00.000</minValue>
                    <maxValue>2014-10-02 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-02 00:00:00.000</minValue>
                    <maxValue>2014-10-03 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-03 00:00:00.000</minValue>
                    <maxValue>2014-10-04 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-04 00:00:00.000</minValue>
                    <maxValue>2014-10-05 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-05 00:00:00.000</minValue>
                    <maxValue>2014-10-06 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-06 00:00:00.000</minValue>
                    <maxValue>2014-10-07 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-07 00:00:00.000</minValue>
                    <maxValue>2014-10-08 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-08 00:00:00.000</minValue>
                    <maxValue>2014-10-09 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-09 00:00:00.000</minValue>
                    <maxValue>2014-10-10 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-10 00:00:00.000</minValue>
                    <maxValue>2014-10-11 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-11 00:00:00.000</minValue>
                    <maxValue>2014-10-12 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-12 00:00:00.000</minValue>
                    <maxValue>2014-10-13 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-13 00:00:00.000</minValue>
                    <maxValue>2014-10-14 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-14 00:00:00.000</minValue>
                    <maxValue>2014-10-15 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-15 00:00:00.000</minValue>
                    <maxValue>2014-10-16 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-16 00:00:00.000</minValue>
                    <maxValue>2014-10-17 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-17 00:00:00.000</minValue>
                    <maxValue>2014-10-18 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-18 00:00:00.000</minValue>
                    <maxValue>2014-10-19 00:00:00.000</maxValue>
                </datavalue>
                <datavalue distribution="2">
                    <minValue>2014-10-19 00:00:00.000</minValue>
                    <maxValue>2014-10-20 00:00:00.000</maxValue>
                </datavalue>
            </valuelist>
        </column>
    </datamapping>
    <scenarios>
        <scenario tableName="PHERF.PHERF_PROD_TEST_UNSALTED" rowCount="100" name="readWriteScenario">
            <!-- Scenario level rule overrides will be unsupported in V1.
                    You can use the general datamappings in the mean time-->
            <dataOverride>
                <column>
                    <type>VARCHAR</type>
                    <userDefined>true</userDefined>
                    <length>15</length>
                    <dataSequence>LIST</dataSequence>
                    <valueList>
                        <datavalue>
                            <value>00Dxx0000001gER</value>
                        </datavalue>
                        <datavalue>
                            <value>00Dxx0000001gES</value>
                        </datavalue>
                        <datavalue>
                            <value>00Dxx0000001gET</value>
                        </datavalue>
                    </valueList>
                    <name>TENANT_ID</name>
                </column>
            </dataOverride>

            <preScenarioDdls>
                <ddl statement="CREATE INDEX IF NOT EXISTS IDX_DIVISION ON PHERF.PHERF_PROD_TEST_UNSALTED (DIVISION)"/>
            </preScenarioDdls>

            <postScenarioDdls>
                <ddl statement="CREATE INDEX IF NOT EXISTS IDX_OLDVAL_STRING ON PHERF.PHERF_PROD_TEST_UNSALTED (OLDVAL_STRING)"/>
                <ddl statement="CREATE INDEX IF NOT EXISTS IDX_CONNECTION_ID ON PHERF.PHERF_PROD_TEST_UNSALTED (CONNECTION_ID)"/>
            </postScenarioDdls>

            <writeParams executionDurationInMs="10000">
                <!--
                    Number of writer it insert into the threadpool
                -->
                <writerThreadCount>5</writerThreadCount>

                <!--
                    Time in Ms that each thread will sleep between batch writes. This helps to
                    throttle writers.
                -->
                <threadSleepDuration>10</threadSleepDuration>

                <batchSize>100</batchSize>
            </writeParams>
            <!--Minimum of executionDurationInMs or numberOfExecutions. Which ever is reached first -->
            <querySet concurrency="1" executionType="PARALLEL" executionDurationInMs="60000"
                    numberOfExecutions="100">
                <!--  Aggregate queries on a per tenant basis -->
                <query tenantId="00Dxx0000001gER"
                        ddl="CREATE VIEW IF NOT EXISTS PHERF.PHERF_TEST_VIEW_UNSALTED AS SELECT * FROM PHERF.PHERF_PROD_TEST_UNSALTED"
                        statement="select count(*) from PHERF.PHERF_TEST_VIEW_UNSALTED"/>
            </querySet>

        </scenario>
        <scenario tableName="PHERF.PHERF_PROD_TEST_UNSALTED" rowCount="10" name="readWriteScenario">
            <dataOverride>
                <column>
                    <type>VARCHAR</type>
                    <userDefined>true</userDefined>
                    <length>15</length>
                    <dataSequence>LIST</dataSequence>
                    <valueList>
                        <datavalue>
                            <value>00Dxx0000001gER</value>
                        </datavalue>
                        <datavalue>
                            <value>00Dxx0000001gES</value>
                        </datavalue>
                        <datavalue>
                            <value>00Dxx0000001gET</value>
                        </datavalue>
                    </valueList>
                    <name>TENANT_ID</name>
                </column>
            </dataOverride>

            <!--  Pre and post scenario indexes -->
            <preScenarioDdls>
                <ddl statement="CREATE INDEX IF NOT EXISTS IDX_DIVISION ON PHERF.PHERF_PROD_TEST_UNSALTED (DIVISION)"/>
            </preScenarioDdls>

            <postScenarioDdls>
                <ddl statement="CREATE INDEX IF NOT EXISTS IDX_OLDVAL_STRING ON PHERF.PHERF_PROD_TEST_UNSALTED (OLDVAL_STRING)"/>
                <ddl statement="CREATE INDEX IF NOT EXISTS IDX_CONNECTION_ID ON PHERF.PHERF_PROD_TEST_UNSALTED (CONNECTION_ID)"/>
            </postScenarioDdls>

            <!--Minimum of executionDurationInMs or numberOfExecutions. Which ever is reached first -->
            <querySet concurrency="1" executionType="PARALLEL" executionDurationInMs="60000" numberOfExecutions="100">
                <query statement="select count(*) from PHERF.PHERF_PROD_TEST_UNSALTED WHERE TENANT_ID=[TENANT_ID] AND TENANT_ID=[TENANT_ID]"/>
                <!--  Aggregate queries on a per tenant basis -->
                <query tenantId="00Dxx0000001gER"
                        ddl="CREATE VIEW IF NOT EXISTS PHERF.PHERF_TEST_VIEW_UNSALTED AS SELECT * FROM PHERF.PHERF_PROD_TEST_UNSALTED"
                        statement="select count(*) from PHERF.PHERF_TEST_VIEW_UNSALTED"/>
                <query tenantId="00Dxx0000001gES"
                        ddl="CREATE VIEW IF NOT EXISTS PHERF.PHERF_TEST_VIEW_UNSALTED AS SELECT * FROM PHERF.PHERF_PROD_TEST_UNSALTED"
                        statement="select /*+ SMALL*/ count(*) from PHERF.PHERF_TEST_VIEW_UNSALTED"/>
            </querySet>

        </scenario>
    </scenarios>
</datamodel>
