<?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="model_1">
    <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>
            <userDefined>true</userDefined>
            <dataSequence>RANDOM</dataSequence>
            <length>15</length>
            <name>GENERAL_CHAR</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>0</nullChance>
            <name>GENERAL_INTEGER</name>
        </column>
        <column>
            <type>INTEGER</type>
            <dataSequence>SEQUENTIAL</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>
            <name>INT_ID</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>
            <useCurrentDate>true</useCurrentDate>
            <name>GENERAL_DATE</name>
        </column>
        <column>
            <type>CHAR</type>
            <length>3</length>
            <userDefined>true</userDefined>
            <dataSequence>LIST</dataSequence>
            <name>TYPE</name>
            <valuelist>
                <!-- Distributes according to specified values. These must total 100 -->
                <datavalue distribution="60">
                    <value>ABC</value>
                </datavalue>
                <datavalue distribution="20">
                    <value>XYZ</value>
                </datavalue>
                <datavalue distribution="20">
                    <value>LMN</value>
                </datavalue>
            </valuelist>
        </column>
        <column>
            <type>CHAR</type>
            <length>3</length>
            <name>IDENTIFIER</name>
        </column>
    </datamapping>
    <scenarios>
        <scenario tableName="PHERF.EVT_1" name="EVT_1" generatorName="WEIGHTED">
            <loadProfile>
                <batchSize>1</batchSize>
                <numOperations>10000</numOperations>
                <!-- Case 1 : Upsert Operation test -->
                <tenantDistribution id="tg1" weight="10" numTenants="1"/>
                <tenantDistribution id="tg2" weight="40" numTenants="9"/>
                <tenantDistribution id="tg3" weight="50" numTenants="10"/>
                <opDistribution id="upsertOp" weight="20"/>
                <opDistribution id="queryOp1" weight="20"/>
                <opDistribution id="queryOp2" weight="20"/>
                <opDistribution id="idleOp" weight="20"/>
                <opDistribution id="udfOp" weight="20"/>
            </loadProfile>
            <preScenarioDdls>
                <ddl statement="CREATE VIEW IF NOT EXISTS PHERF.EVT_1 (ZID CHAR(15), TYPE VARCHAR) AS SELECT * FROM PHERF.TEST_GLOBAL_VIEW1" />
            </preScenarioDdls>

            <upserts>
                <upsert id="upsertOp">
                    <column>
                        <type>CHAR</type>
                        <name>ID</name>
                    </column>
                    <column>
                        <type>INTEGER</type>
                        <name>SOME_INT</name>
                    </column>
                    <column>
                        <type>CHAR</type>
                        <name>GID</name>
                    </column>
                    <column>
                        <type>VARCHAR</type>
                        <name>FIELD1</name>
                    </column>
                    <column>
                        <type>INTEGER</type>
                        <name>OTHER_INT</name>
                    </column>
                    <column>
                        <type>CHAR</type>
                        <name>ZID</name>
                    </column>
                    <column>
                        <type>CHAR</type>
                        <name>TYPE</name>
                    </column>
                </upsert>
            </upserts>

            <querySet>
                <query id="queryOp1" statement="select count(*) from PHERF.EVT_1"/>
                <query id="queryOp2" statement="select * from PHERF.EVT_1"/>
            </querySet>
            <idleTimes>
                <idleTime id="idleOp" idleTime="50"></idleTime>
            </idleTimes>
            <udfs>
                <udf id="udfOp" >
                    <clazzName>org.apache.phoenix.pherf.ConfigurationParserTest.TestUDF</clazzName>
                    <args>Hello</args>
                    <args>World</args>
                </udf>
            </udfs>
        </scenario>
        <scenario tableName="PHERF.EVT_2" name="EVT_21"  generatorName="WEIGHTED">
            <loadProfile>
                <batchSize>1</batchSize>
                <numOperations>10000</numOperations>
                <!-- Case 1 : Upsert Operation test -->
                <tenantDistribution id="tg1" weight="10" numTenants="1"/>
                <tenantDistribution id="tg2" weight="40" numTenants="9"/>
                <tenantDistribution id="tg3" weight="50" numTenants="10"/>
                <opDistribution id="upsertOp" weight="20"/>
                <opDistribution id="queryOp1" weight="20"/>
                <opDistribution id="queryOp2" weight="20"/>
                <opDistribution id="idleOp" weight="20"/>
                <opDistribution id="udfOp" weight="20"/>
            </loadProfile>
            <preScenarioDdls>
                <ddl statement="CREATE VIEW IF NOT EXISTS PHERF.EVT_2 (INT_ID INTEGER, TYPE VARCHAR) AS SELECT * FROM PHERF.TEST_GLOBAL_VIEW2" />
            </preScenarioDdls>

            <upserts>
                <upsert id="upsertOp">
                <column>
                    <type>CHAR</type>
                    <name>ID</name>
                </column>
                <column>
                    <type>INTEGER</type>
                    <name>SOME_INT</name>
                </column>
                <column>
                    <type>CHAR</type>
                    <name>GID</name>
                </column>
                <column>
                    <type>VARCHAR</type>
                    <name>FIELD1</name>
                </column>
                <column>
                    <type>INTEGER</type>
                    <name>OTHER_INT</name>
                </column>
                <column>
                    <type>INTEGER</type>
                    <name>INT_ID</name>
                </column>
                <column>
                    <type>CHAR</type>
                    <name>TYPE</name>
                </column>
                </upsert>
            </upserts>

            <querySet>
                <query id="queryOp1" statement="select count(*) from PHERF.EVT_2"/>
                <query id="queryOp2" statement="select * from PHERF.EVT_2"/>
            </querySet>
            <idleTimes>
                <idleTime id="idleOp" idleTime="50"/>
            </idleTimes>
            <udfs>
                <udf id="udfOp" >
                    <clazzName>org.apache.phoenix.pherf.ConfigurationParserTest.TestUDF</clazzName>
                    <args>Hello</args>
                    <args>World</args>
                </udf>
            </udfs>
        </scenario>
    </scenarios>
</datamodel>
