FlowHigh schema (XSD)

The output of the FlowHigh parser is based on a schema. For XML we have published the schema as an XSD.

The XSD is structured hierarchically and made up of various complex types. At the root of this tree we have the complexType ParseQL. It contains various elements, e.g. the element of type Statements. The constraint maxOccurs means that multiple SQL statements can be sent to the FlowHigh SQL parser in a single request.

   <xs:complexType name="ParseQL">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element type="Statements" name="statements" maxOccurs="unbounded"/>
            <xs:element type="Errors" name="errors" maxOccurs="unbounded"/>
            <xs:element type="DBOHier" name="DBOHier"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="version"/>
        <xs:attribute type="xs:string" name="status"/>
        <xs:attribute type="xs:dateTime" name="ts"/>
   </xs:complexType>

Let’s look at the child elements of the complexType Statement, e.g. Ds. Ds stands for Dataset and corresponds to a SELECT statement. There are other elements such as Update, Delete etc.

  <xs:complexType name="Statement">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="Ds" name="ds" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Update" name="update" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Delete" name="delete" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Merge" name="merge" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Create" name="create" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="CreateStage" name="createStage" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="CreateView" name="createView" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Copy" name="copy" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Insert" name="insert" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="AntiPattern" name="antipatterns" maxOccurs="1"/>
            <xs:element type="xs:string" name="rawInput"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="pos"/>
    </xs:complexType>

XSD download

Download the XSD

View the XSD

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink">
    <xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.w3.org/1999/xlink.xsd"/>
    <xs:element name="parSeQL" type="ParseQL"/>

    <!--ParseQL Schema-->
    <xs:annotation>
        <xs:appinfo>ParseQL Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            The main application schema.
            Contains a number of statements in the Statements object, errors,
            version attribute, status attribute, and timestamp attribute.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="ParseQL">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element type="Statements" name="statements" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Acts as wrapper for statement. Holds multiple statement within the tag.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Errors" name="errors" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Acts as wrapper for Error. Holds multiple Error within the tag.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DBOHier" name="DBOHier"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="version">
            <xs:annotation>
                <xs:documentation>
                    Provides version information
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="status">
            <xs:annotation>
                <xs:documentation>
                    Indicates the status of the API
                    Can be -
                    • OK : Everything works as expected
                    • FATAL_ERROR : Caused due to a bug in the API, invalid json input to the API,
                    some exception being thrown by the API, etc.
                    • SYNTAX_ERROR : Errors which are caused due to an invalid/unsupported query being passed to the API.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:dateTime" name="ts">
            <xs:annotation>
                <xs:documentation>
                    Displays the time when the API call was made.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="DBOHier">
        <xs:annotation>
            <xs:appinfo>DBOHier Documentation</xs:appinfo>
            <xs:documentation xml:lang="en">
                Contains all database objects that are detected in the query
            </xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded">
            <xs:element type="DBO" name="dbo" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        List of all object present in the query
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="DBO">
        <xs:annotation>
            <xs:appinfo>Database Object Documentation</xs:appinfo>
            <xs:documentation xml:lang="en">
                Contains information about individual database object and its children
            </xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded" minOccurs="0">
            <xs:element name="dbo" type="DBO">
                <xs:annotation>
                    <xs:documentation>
                        List of all children object of the current DBO
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute name="oid" type="xs:string">
            <xs:annotation>
                <xs:documentation>
                    The object ID for the current database Object
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="type" type="DBOType">
            <xs:annotation>
                <xs:documentation>
                    The Type of the current database Object
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="name" type="xs:string">
            <xs:annotation>
                <xs:documentation>
                    The name of the current database Object
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="poidArr" type="xs:string">
            <xs:annotation>
                <xs:documentation>
                    The list of parent ID separated by a comma
                    Ex: poid="T1,T2,T3"
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:simpleType name="DBOType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="TABLE"/>
            <xs:enumeration value="COLUMN"/>
            <xs:enumeration value="DB"/>
            <xs:enumeration value="SCHEMA"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:annotation>
        <xs:appinfo>Statements Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Acts as wrapper for the SQL statement.

            Ex: `create table tab (col1 int, col2 int);
            select * from tab;`
            Statements tag will contain 2 Statement: 1. Create Statement 2. Select Statement
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Statements">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="Statement" name="statement" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains a number of DDL, DQL, or DML statements
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="rawInput">
                <xs:annotation>
                    <xs:documentation>
                        Displays the user input
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--Main Statement Body-->
    <xs:annotation>
        <xs:appinfo>Statement Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Contains a number of DDL, DML or DQL statements.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Statement">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="Create" name="create" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Creates a new table in the current/specified schema.
                        It can be combined with REPLACE to replace an existing table (CREATE OR REPLACE).
                        A table can have multiple columns, with each column definition consisting of a name,
                        data type, and optionally, column constraints.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Copy" name="copy" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Copy contains details about data that is to be loaded from staged files
                        to an existing table/location
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="CreateStage" name="createStage" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Create stage contains info on creating a new named internal or external
                        stage to use for loading data from files
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="CreateView" name="createView" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Creates a new view in the current/specified schema,
                        based on a query of one or more existing tables.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Insert" name="insert" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Insert tag contains information about insert statement.
                        Inserts one or more rows into a table.
                        The values inserted into each column in the table can be explicitly-specified or
                        the results of a query.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Update" name="update" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Update uses a dataset to update the target dataset
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Delete" name="delete" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Remove rows from a table.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Merge" name="merge" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Inserts, updates, and/or deletes values in a table based on values in a second table or
                        a subquery.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="ds" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        DS - Dataset - Acts as a wrapper and contains all the data of a query.
                        Contains select, from, joins, where, groupBy, having, qualify, sorting,
                        and/or paging details.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="AntiPattern" name="antiPatterns"/>
            <xs:element type="xs:string" name="rawInput">
                <xs:annotation>
                    <xs:documentation>
                        Displays the user input
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="type">
            <xs:annotation>
                <xs:documentation>
                    Specifies whether it's a simple select statement, an insert, update or delete
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--Create Table-->
    <xs:annotation>
        <xs:appinfo>Create Table Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Creates a new table in the current/specified schema.
            It can be combined with REPLACE to replace an existing table (CREATE OR REPLACE).
            A table can have multiple columns, with each column definition consisting of a name,
            data type, and optionally, column constraints.

            Ex.1: `CREATE TABLE mytable (date timestamp_ntz, id number, content variant) CLUSTER BY (date, id);`
            date timestamp_ntz, id number, content variant -> Are the 3 columnDef in the statement
            date, id are also the clusterBy expressions

            Ex.2: `CREATE TABLE mytable_copy (b) AS SELECT * from mytable;`
            `Select * from mytable` -> is the DS in a Create Table as Select(CTAS) Statement.

            Ex.3: `create global temporary table demo_global_temporary (i integer);`
            global is the scope of the CREATE statement
            temporary is the type of the CREATE statement.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Create">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="ColumnDef" name="columnDef" maxOccurs="unbounded"  minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        ColumnDefinition contains the name of the column, data type, precision, and scale.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="ds" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        A DS is used in a CREATE TABLE statement if it is being used as a CREATE TABLE...AS SELECT
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="ClusterBy" name="clusterBy" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Specifies one or more columns or column expressions in the table as the clustering key.
                        A clustering key is a subset of columns in a table (or expressions on a table)
                        that are explicitly designated to co-locate the data in the table
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="type">
            <xs:annotation>
                <xs:documentation>
                    Can be either TEMPORARY, TRANSIENT, OR VOLATILE
                    • TEMPORARY: Temporary tables only exist within the session in which they were created
                    and persist only for the remainder of the session
                    • TRANSIENT: Transient tables are similar to permanent tables with the key difference
                    that they do not have a Fail-safe period. As a result, transient tables are specifically
                    designed for transitory data that needs to be maintained beyond each session
                    (in contrast to temporary tables), but does not need the same level of data protection and
                    recovery provided by permanent tables.
                    VOLATILE: Same as TEMPORARY.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="scope">
            <xs:annotation>
                <xs:documentation>
                    Can be either LOCAL or GLOBAL.
                    Scope is provided for compatibility with other databases (e.g. to prevent errors when
                    migrating CREATE TABLE statements). Tables created with any of these keywords appear
                    and behave identically to tables created using TEMPORARY
                    • LOCAL: Specifies that the table is only visible to the current session that it is being used.
                    • GLOBAL: Specifies that the table is only visible to all sessions.
                    So if you create a global temporary table in one session, you can start using it in other sessions.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refds">
            <xs:annotation>
                <xs:documentation>
                    Specifies the name or alias of the dataset that the CREATE statement is referring to.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refdb">
            <xs:annotation>
                <xs:documentation>
                    Specifies the name or alias of the database that the CREATE statement is referring to.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refdsch">
            <xs:annotation>
                <xs:documentation>
                    Specifies the name or alias of the schema that the CREATE statement is referring to.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="fullref">
            <xs:annotation>
                <xs:documentation>
                    Specifies the complete location of the dataset that the CREATE statement is referring to.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!-- COPY statement -->
    <xs:annotation>
        <xs:appinfo>Copy Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Copy contains details about data that is to be loaded from staged files to an existing table/location
            • targetCol - contains the list of columns to which the data will be loaded
            • fromExp - is the data source in case the source is specified through select statement
            • selectElement - Specifies an explicit set of fields/columns (separated by commas) to load from the
            staged data files. The fields/columns are selected from the files using a standard SQL query.
            The list must match the sequence of columns in the target table
            • copyPartition - contains a list of expressions which are used for partitioning
            • into - contains the dataset to which the data needs to be loaded
            • fromQuery - is the data source if the source is an entire query
            • fromStage - is the data source if the location of the stage is specified
            • fileFormat - specifies the format of the data source
            • file - specifies the name of the file
            • header - Specifies whether to include the table column headings in the output files.
            Set this option to TRUE to include the table column headings to the output files
            Default is FALSE.
            • pattern - Used for pattern matching (regex)
            • copyOptions - contains information about things like:
            1. Specifying size limit,
            2. Enabling purging,
            3. Error handling for the load operation,
            4. Return only files that have failed to load in the statement result,
            5. Whether to load semi-structured data into columns in the target table that match corresponding columns represented in the data,
            6. Whether to truncate text strings that exceed the target column length
            7. Load all files, regardless of whether they’ve been loaded previously
            8. Load files for which the load status is unknown (Copy doesn't load these by default)
            • validation - String (constant) that instructs the COPY command to return the results of the query
            in the SQL statement instead of unloading the results to the specified cloud storage location.
            The only supported validation option is RETURN_ROWS. This option returns all rows produced by the query.

            Ex.1: `COPY INTO @my_stage FROM (SELECT * FROM orderstiny LIMIT 5) VALIDATION_MODE='RETURN_ROWS' header=TRUE;`
            `VALIDATION_MODE='RETURN_ROWS'` -> validation
            `@my_stage` -> into
            `SELECT * FROM orderstiny LIMIT 5` -> fromQuery
            `header=TRUE` -> header

            Ex.2: `COPY INTO mytable FILE_FORMAT = (TYPE = 'CSV') PATTERN='.*/.*/.*[.]csv[.]gz';`
            `@my_stage` -> into
            `FILE_FORMAT = (TYPE = 'CSV')` -> fileFormat
            `PATTERN='.*/.*/.*[.]csv[.]gz';` -> pattern
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Copy">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="xs:string" name="targetCol" maxOccurs="unbounded"  minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains the list of columns to which the data will be loaded
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="fromExp" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        It is the data source in case the source is specified through select statement
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="ExprWrapper" name="selectElement" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        defines a numbered set of field/columns in the data files you are loading from.
                        The list must match the sequence of columns in the target table
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:group ref="Expr" id="copyPartition" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of expressions which are used for partitioning
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
            <xs:element type="DS" name="into">
                <xs:annotation>
                    <xs:documentation>
                        Contains the dataset to which the data needs to be loaded
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="fromQuery">
                <xs:annotation>
                    <xs:documentation>
                        It is the data source if the source is an entire query
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="fromStage">
                <xs:annotation>
                    <xs:documentation>
                        It is the data source if the location of the stage is specified
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="fileFormat">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the format of the data source
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="file">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the name of the file
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="header">
                <xs:annotation>
                    <xs:documentation>
                        Specifies whether to include the table column headings in the output files.
                        Set this option to TRUE to include the table column headings to the output files
                        Default is FALSE
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="pattern">
                <xs:annotation>
                    <xs:documentation>
                        Used for pattern matching (regex)
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="copyOptions">
                <xs:annotation>
                    <xs:documentation>
                        Contains information about things like:
                        1. Specifying size limit,
                        2. Enabling purging,
                        3. Error handling for the load operation,
                        4. Return only files that have failed to load in the statement result,
                        5. Whether to load semi-structured data into columns in the target table that match corresponding columns represented in the data,
                        6. Whether to truncate text strings that exceed the target column length
                        7. Load all files, regardless of whether they’ve been loaded previously
                        8. Load files for which the load status is unknown (Copy doesn't load these by default)
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="validation">
                <xs:annotation>
                    <xs:documentation>
                        String (constant) that instructs the COPY command to return the results of
                        the query in the SQL statement instead of unloading the results to the specified
                        cloud storage location. The only supported validation option is RETURN_ROWS. This
                        option returns all rows produced by the query.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!-- Create Stage statement -->
    <xs:annotation>
        <xs:appinfo>Create Stage Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Create stage contains info on creating a new named internal or external stage to use for loading data from files
            • tag - contains a list of tag names and it's values
            • location - is the source of the data for the stage OR the internal stage parameters
            • directoryParam - Specifies whether to add a directory table to the stage. When the value is TRUE,
            a directory table is created with the stage.
            Other options include:
            1. Whether to automatically refresh the directory table metadata once, immediately after
            the stage is created
            2. Whether Snowflake should enable triggering automatic refreshes of the directory table
            metadata when new or updated data files are available in the named external stage
            3. The name of the notification integration used to automatically refresh the directory
            table metadata using GCS Pub/Sub or Azure Event notifications.
            • fileFormat - specifies the format of the file
            • comments - contain comments about the stage
            • copyOptions - Specifies one (or more) copy options for the stage
            • stageName - contains the name of the new stage
            • with - is used to specify if "with" is used in the "tag" part of the statement

            Ex.1: `CREATE STAGE my_int_stage ENCRYPTION = (TYPE = 'SNOWFLAKE_SSE') COPY_OPTIONS = (ON_ERROR='skip_file');`
            `ENCRYPTION = (TYPE = 'SNOWFLAKE_SSE')` -> location (It is the internal stage parameter in this case)
            `COPY_OPTIONS = (ON_ERROR='skip_file')` -> copyOptions
            `my_int_stage` -> stageName

            Ex.2: `CREATE STAGE mystage URL='s3://load/files/'
            STORAGE_INTEGRATION = my_storage_int
            ENCRYPTION=(TYPE='AZURE_CSE' MASTER_KEY = 'kPxX0jzYfIamtnJEUTHwq80Au6NbSgPH5r4BDDwOaO8=')
            DIRECTORY = ( ENABLE = true AUTO_REFRESH = true );`
            `URL='s3://load/files/'
            STORAGE_INTEGRATION = my_storage_int
            ENCRYPTION=(TYPE='AZURE_CSE' MASTER_KEY = 'kPxX0jzYfIamtnJEUTHwq80Au6NbSgPH5r4BDDwOaO8=')` -> location
            `DIRECTORY = ( ENABLE = true AUTO_REFRESH = true );` -> directoryParam

        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="CreateStage">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="xs:string" name="tagName" maxOccurs="unbounded"  minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of tag names
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="tagValue" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of tag values
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="location">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the source of the data for the stage
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="directoryParam">
                <xs:annotation>
                    <xs:documentation>
                        Specifies whether to add a directory table to the stage. When the value is TRUE, a directory
                        table is created with the stage.
                        Other options include:
                        1. Whether to automatically refresh the directory table metadata once, immediately after
                        the stage is created
                        2. Whether Snowflake should enable triggering automatic refreshes of the directory table
                        metadata when new or updated data files are available in the named external stage
                        3. The name of the notification integration used to automatically refresh the directory
                        table metadata using GCS Pub/Sub or Azure Event notifications.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="fileFormat">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the format of the file
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="copyOptions">
                <xs:annotation>
                    <xs:documentation>
                        Specifies one (or more) copy options for the stage
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="comments">
                <xs:annotation>
                    <xs:documentation>
                        Contain comments about the stage
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="xs:string" name="stageName">
            <xs:annotation>
                <xs:documentation>
                    Contain name of the stage
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="with">
            <xs:annotation>
                <xs:documentation>
                    Specifies if "with" is used in the "tag" part of the statement
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!-- Create View statement -->
    <xs:annotation>
        <xs:appinfo>Create View Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Creates a new view in the current/specified schema, based on a query of one or more existing tables.
            • columns - contains a list of names of the columns in the view
            • dataset - contains the view's data
            • query - Specifies the query used to create the view. Can be on one or more source tables or
            any other valid SELECT statement. This query serves as the text/definition for the view
            • replace - specifies if the view being created can be replaced with the view that is being created.
            Using OR REPLACE is the equivalent of using DROP VIEW on the existing view and then creating a
            new view with the same name. The drop and create actions occur in a single atomic operation
            • notExists - specifies action on whether we should check if a view exists or not

            Ex.1: `CREATE OR REPLACE SECURE VIEW myview AS SELECT col1, col2 FROM mytable;`
            `REPLACE` -> replace (will be set to TRUE)
            `myview` -> dataset
            `SELECT col1, col2 FROM mytable` -> query
            notExists will be set to FALSE

            Ex.2:`CREATE VIEW employee_hierarchy (title, employee_ID, manager_ID) as SELECT title,
            employee_ID, manager_ID FROM employees`
            `SELECT title,
            employee_ID, manager_ID FROM employees` -> query
            `title, employee_ID, manager_ID` -> columns
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="CreateView">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="xs:string" name="columns" maxOccurs="unbounded"  minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of names of the columns in the view
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="dataset">
                <xs:annotation>
                    <xs:documentation>
                        Contains view's data
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="query">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the query used to create the view. Can be on one or more source tables or
                        any other valid SELECT statement. This query serves as the text/definition for the view
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="xs:string" name="replace">
            <xs:annotation>
                <xs:documentation>
                    Specifies if the view being created can be replaced with the view that is being created
                    Using OR REPLACE is the equivalent of using DROP VIEW on the existing view and then creating
                    a new view with the same name. The drop and create actions occur in a single atomic operation.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="notExists">
            <xs:annotation>
                <xs:documentation>
                    Specifies action on whether we should check if a view exists or not
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!-- Insert statement -->
    <xs:annotation>
        <xs:appinfo>Insert Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Insert tag contains information about insert statement.
            Inserts one or more rows into a table.
            The values inserted into each column in the table can be explicitly-specified or the results of a query.
            • Conditions - contains a list of constraints which, if satisfied then the data is inserted
            • Into - contains a list of into expressions
            • Source - specifies the source of the data
            • Insert type - can be ALL or FIRST
            • Overwrite - specifies whether data can be overwritten
            • ELSE - specifies whether else part is used during conditional multi table inserts

            Ex.1: `INSERT INTO t1 (v) VALUES
            ('three'),
            ('four')`

            `t1 (v) VALUES
            ('three'),
            ('four')` -> into
            `t1` -> target in into
            `(v)` -> columnRef in into
            `('three'),
            ('four')` -> values in into

            Ex.2: `insert into tab select * from tab2`
            `tab` -> into
            `select * from tab2` -> source
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Insert">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of constraints which, if satisfied then the data is inserted
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
            <xs:element type="Into" name="into" maxOccurs="unbounded"  minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of into expressions
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="source">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the source of the data
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="xs:string" name="type">
            <xs:annotation>
                <xs:documentation>
                    Can be ALL or FIRST
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="overwrite">
            <xs:annotation>
                <xs:documentation>
                    Specifies whether data can be overwritten
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="else">
            <xs:annotation>
                <xs:documentation>
                    Specifies whether else part is used during conditional multi table inserts
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>

    <!--Merge-->
    <xs:annotation>
        <xs:appinfo>Merge Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Inserts, updates, and/or deletes values in a table based on values in a second table or
            a subquery. This can be useful if the second table is a change log that contains new
            rows (to be inserted), modified rows (to be updated), and/or marked rows (to be deleted)
            in the target table.
            • target - specifies the target dataset to which the source is being merged into
            • ctes - CTEs that are used in the USING clause of the Merge statement
            • source - is the primary dataset from where the data is being pulled from
            • conditions - contains constraints which specify the merge to happen in a certain way
            • actions - specifies actions to perform if data is matched or if it isn't matched

            Ex.1: `MERGE INTO target_table USING source_table
            ON target_table.id = source_table.id
            WHEN MATCHED THEN
            UPDATE SET target_table.description = source_table.description;`
            `source_table` -> source
            `target_table` -> target
            `ON target_table.id = source_table.id` -> conditions
            `WHEN MATCHED THEN
            UPDATE SET target_table.description = source_table.description;` -> actions
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Merge">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="DS" name="target">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the target dataset to which the source is being merged into
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="ctes" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        CTEs that are used in the USING clause of the Merge statement
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="source">
                <xs:annotation>
                    <xs:documentation>
                        Primary dataset from where the data is being pulled from
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Op" name="condition">
                <xs:annotation>
                    <xs:documentation>
                        Contains constraints which specify the merge to happen in a certain way
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:group ref="Expr" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Specifies actions to perform if data is matched or if it isn't matched
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--Delete-->
    <xs:annotation>
        <xs:appinfo>Delete Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Delete removes rows from a table.
            You can use a WHERE clause to specify which rows should be removed.
            If you need to use a subquery(s) or additional table(s) to identify the rows to be removed,
            specify the subquery(s) or table(s) in a USING clause.
            • target - specifies which dataset is to be deleted
            • in - contains a list of datasets which are used to refer in the filter part of the statement
            • filter - refines the search for the dataset that is to be deleted

            Ex.1: `DELETE FROM tab1 USING tab2 WHERE tab1.k = tab2.k`
            `tab1` -> target
            `tab2` -> ds in "in"
            `tab1.k = tab2.k` -> filter
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Delete">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="DS" name="ds">
                <xs:annotation>
                    <xs:documentation>
                        Specifies which dataset is to be deleted
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
    </xs:complexType>

    <!--Errors-->
    <xs:annotation>
        <xs:appinfo>Errors Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Acts as a wrapper for the Error tag in the statement
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Errors">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="Error" name="error">
                <xs:annotation>
                    <xs:documentation>
                        Acts as a wrapper for the error message of the statement
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
    </xs:complexType>

    <!--Error-->
    <xs:annotation>
        <xs:appinfo>Error Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Acts as a wrapper for the error message of the statement
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Error">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute type="id" name="pos"/>
                <xs:attribute type="xs:string" name="message">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the actual error message
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <!--Update-->
    <xs:annotation>
        <xs:appinfo>Update Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Update uses a dataset to update the target dataset
            • assign - contains a list of operations which are performed to the columns of the dataset
            • filter - is used to narrow down the rows to which the assign operations are performed
            Default: No value (all rows of the target table are updated)

            Ex.1: `UPDATE t1
            SET number_column = t1.number_column + t2.number_column, t1.text_column = 'ASDF'
            FROM t2
            WHERE t1.key_column = t2.t1_key and t1.number_column > 10;`
            `t1` -> target
            `t2` -> in
            `SET number_column = t1.number_column + t2.number_column, t1.text_column = 'ASDF'` -> assign
            `t1.key_column = t2.t1_key and t1.number_column > 10;` -> filter
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Update">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="DS" name="ds">
                <xs:annotation>
                    <xs:documentation>
                        Dataset that needs to be updated
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="In" name="in">
                <xs:annotation>
                    <xs:documentation>
                        The input for the dataset that needs to be updated
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Op" name="assign" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of operations which are performed to the columns of the dataset
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Filter" name="filter" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Refines the selection of rows to which the operations are performed
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>

    <!--Dataset-->
    <xs:annotation>
        <xs:appinfo>Dataset Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            DS - Dataset - Acts as a wrapper and contains all the data of a full or partial query.
            Contains select, from, joins, where, groupBy, having, qualify, sorting,
            and paging details.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="DS">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="Out" name="out" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Is the select tag which contains a list of attributes and expressions.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="In" name="in" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Is the FROM tag which contains all the inputs for the query.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Filter" name="filter" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Filter contains information regarding the where, having, and qualify clauses.
                        Filter contains Expr (usually Op) which can be used to represent the above clauses.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Agg" name="agg" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        It is the group by clause which contains a list of attributes or the WINDOW clause
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Edge" name="edge" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        The LATERAL VIEW clause is used in conjunction with generator functions such as EXPLODE,
                        which will generate a virtual table containing one or more rows.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Sort" name="sort" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Order By - Comprised of the attribute or constant with which the
                        output must be sorted in either direction(ascending or descending).
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Page" name="page" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains information about paging. Used to only display a limited number of results.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="MatchRecognize" name="matchrecognize" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        MATCH_RECOGNIZE accepts a set of rows (from a table, view, subquery, or other source) as input,
                        and returns all matches for a given row pattern within this set
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="TableSample" name="tablesample" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Table Sample or Sample is used to return a subset of rows sampled randomly
                        from the specified table
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="SetOps" name="setOp" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains information the type and the Dataset(DS) with which the set operation should occur.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>

            <!-- These are for table function DS -->
            <xs:element type="TableFuncArgs" name="args">
                <xs:annotation>
                    <xs:documentation>
                        Contains the name of an expression and the Option that is applied to it in an UDTF.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="TableFuncPartition" name="partition">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of expressions which are used for partitioning
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="ds">
                <xs:annotation>
                    <xs:documentation>
                        Contains a dataset which can be used in a table function
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="DsType" name="type">
            <xs:annotation>
                <xs:documentation>
                    Contains details about the type of dataset. Can be CTE, RECURSIVE CTE, TABLE, VIEW, ROOT, ANONYMOUS or a REFERENCE.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="DsSubType" name="subType">
            <xs:annotation>
                <xs:documentation>
                    Contains details about the subtype of dataset. Can be PSEUDO, RECURSIVE, INLINE, PHYSICAL, FUNCTION.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="name">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the dataset which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refds">
            <xs:annotation>
                <xs:documentation>dw
                    Contains the name of the dataset which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refsch">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the schema which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refdb">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the database which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="fullref">
            <xs:annotation>
                <xs:documentation>
                    Contains the full location of the current dataset.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refTo">
            <xs:annotation>
                <xs:documentation>
                    Contains a list of columns (Attr) which refer to this dataset.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="action">
            <xs:annotation>
                <xs:documentation>
                    Info on the type of statement the Ds is used
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="dboref" type="xlink:hrefType" xlink:href="#DBO/@oid">
            <xs:annotation>
                <xs:documentation>
                    Reference to the parent DBO's identifier
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="DsType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="cte"/>
            <xs:enumeration value="view"/>
            <xs:enumeration value="recursive"/>
            <xs:enumeration value="table"/>
            <xs:enumeration value="reference"/>
            <xs:enumeration value="root"/>
            <xs:enumeration value="anonymous"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="DsSubType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="pseudo"/>
            <xs:enumeration value="recursive"/>
            <xs:enumeration value="inline"/>
            <xs:enumeration value="physical"/>
            <xs:enumeration value="function"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Into-->
    <xs:annotation>
        <xs:appinfo>into Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Contains information to be inserted in an insert statement
            • Column ref - contains a list of columns to which values need to be inserted
            • Target - specifies the dataset to which the data needs to be inserted

            Ex.1: `INSERT INTO t1 (v) VALUES
            ('three'),
            ('four')`

            `t1 (v) VALUES
            ('three'),
            ('four')` -> into
            `t1` -> target in into
            `(v)` -> columnRef in into
            `('three'),
            ('four')` -> values in into
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Into">
        <xs:choice maxOccurs="unbounded">
            <!-- includes both columnRef and values that need to be inserted -->
            <xs:group ref="Expr" id="columnRefAndValues" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of COLUMNS to which VALUES need to be inserted
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
            <xs:element type="DS" name="target">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the dataset to which the data needs to be inserted
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
    </xs:complexType>

    <!--Column Definition-->
    <xs:annotation>
        <xs:appinfo>Column Definition Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            ColumnDefinition contains the name of the column, data type, precision, and scale.
            • pos - Specifies the start position and the length of the object in the query

            Ex.1: `CREATE TABLE mytable (date timestamp_ntz, id number, content variant)`
            date timestamp_ntz, id number, content variant -> Are the 3 columnDef in the statement
            `date` -> column
            timestamp_ntz -> type
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="ColumnDef">
        <xs:attribute type="xs:string" name="name">
            <xs:annotation>
                <xs:documentation>
                    Specifies the name of the column
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="type">
            <xs:annotation>
                <xs:documentation>
                    Specifies the data type of the column
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:integer" name="precision">
            <xs:annotation>
                <xs:documentation>
                    Specifies the precision of the data
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:integer" name="scale">
            <xs:annotation>
                <xs:documentation>
                    Specifies the scale of the data
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--Cluster By-->
    <xs:annotation>
        <xs:appinfo>Cluster By Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Cluster By contains a list of columns.

            Ex.1: `CREATE TABLE mytable (date timestamp_ntz, id number, content variant) CLUSTER BY (date, id);`
            date timestamp_ntz, id number, content variant -> Are the 3 columnDef in the statement
            date, id are also the clusterBy expressions
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="ClusterBy">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element type="Attr" name="attr">
                <xs:annotation>
                    <xs:documentation>
                        Contains the column through which clustering will occur
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
    </xs:complexType>

    <!--AntiPattern-->
    <xs:annotation>
        <xs:appinfo>AntiPattern Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            AntiPattern contains a list of ids representing the start
            and end positions of where the antipattern has been detected.
            It also contains the type of antipattern which has been detected.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="AntiPattern">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="id" name="pos">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the start position and the length of the antipattern in the query
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="xs:string" name="type">
            <xs:annotation>
                <xs:documentation>
                    Specifies the antipattern code (Ex. AP_01, AP_02 ..)
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:simpleType name="AntiPatternTypes">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Select Star"/>
            <xs:enumeration value="NULL Usage"/>
            <xs:enumeration value="String Concatenation"/>
            <xs:enumeration value="Group By Usage"/>
            <xs:enumeration value="Having Usage"/>
            <xs:enumeration value="Order By Rand"/>
            <xs:enumeration value="Pattern Matching Usage"/>
            <xs:enumeration value="Overloaded Joins"/>
            <xs:enumeration value="Distinct Usage"/>
            <xs:enumeration value="Having Clause"/>
            <xs:enumeration value="Overloaded Sub-Queries"/>
            <xs:enumeration value="OR Usage"/>
            <xs:enumeration value="Union Usage"/>
            <xs:enumeration value="Join without Equality"/>
            <xs:enumeration value="Natural Join"/>
            <xs:enumeration value="Implicit Column Usage"/>
            <xs:enumeration value="Implicit Cross Join"/>
            <xs:enumeration value="Self Join Usage"/>
            <xs:enumeration value="Scalar Query in Select"/>
            <xs:enumeration value="Non Ansi Join"/>
            <xs:enumeration value="Anonymous Sub-Query"/>
            <xs:enumeration value="Anonymous Column"/>
            <xs:enumeration value="ORDER BY / GROUP BY ordinal numbers"/>
            <xs:enumeration value="Function in WHERE Clause"/>
            <xs:enumeration value="Unused CTE"/>
            <xs:enumeration value="NULL and Not Equal operator"/>
            <xs:enumeration value="Searching For NULL"/>
            <xs:enumeration value="Count Distinct"/>
            <xs:enumeration value="Union For Multiple Filter Values"/>
            <xs:enumeration value="Filtering attributes from the non preserved side of an outer join"/>
            <xs:enumeration value="Count in the Outer Join"/>
            <xs:enumeration value="Inner Join After Outer Join"/>
            <xs:enumeration value="Where instead of Having"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Select (Out)-->
    <xs:annotation>
        <xs:appinfo>Select Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Out - Output - Is the select tag which contains a list of attributes and expressions.

            Ex.1: `select 1, 2, 3`
            `1, 2, 3` -> are the Out Expr
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Out">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        The output can be any expression. Ex - Attr, Func, Op etc
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="xs:string" name="quantifier">
            <xs:annotation>
                <xs:documentation>
                    Specifies the quantifier for the select. Can be ALL or DISTINCT
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:boolean" name="derived">
            <xs:annotation>
                <xs:documentation>
                    Specifies if the columns mentioned in Out are not explicitly mentioned,
                    but are rather derived through the dataset's known columns
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="type"/>
    </xs:complexType>

    <!--From (In)-->
    <xs:annotation>
        <xs:appinfo>From Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            In - Input - Is the FROM tag which contains all the inputs for the query.
            (Joins, dataset, operations on dataset)

            Ex.1: `select * from tab`
            `tab` -> is the dataset present in In
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="In">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Can be any data source. Ex - Tables, Joins, Set Operations
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
    </xs:complexType>

    <!--Order by-->
    <xs:annotation>
        <xs:appinfo>Order By Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Sort - Order By - Comprised of the attribute or constant with which the
            output must be sorted in either direction(ascending or descending).
            (Default - ascending)

            Ex: `select * from tab order by col1, col2 desc`
            `col1, col2 desc` -> are the Sort Expr
            desc is the direction for col2
            col1 will have asc as the default direction
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Sort">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr">
                <xs:annotation>
                    <xs:documentation>
                        Attribute or constant with which the
                        output must be sorted in either direction
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
    </xs:complexType>
    <xs:simpleType name="Direction">
        <xs:restriction base="xs:string">
            <xs:enumeration value="asc"/>
            <xs:enumeration value="desc"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Position-->
    <xs:annotation>
        <xs:appinfo>Position Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Searches for the n-th(default is first) occurrence of the first argument in the second argument

            Ex: `select position('an', 'banana', 3);`
            searches for the third instance of `an` in `banana`
            `an` -> subString
            `banana` -> str
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Position">
        <xs:choice>
            <xs:element type="ExprWrapper" name="subString">
                <xs:annotation>
                    <xs:documentation>
                        The first argument which needs to be found
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="ExprWrapper" name="string">
                <xs:annotation>
                    <xs:documentation>
                        The second argument in which the first argument needs to be searched
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>

    <!--SubString-->
    <xs:annotation>
        <xs:appinfo>SubString Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Creates a substring from the source string

            Ex: `select substr('banana', 1, 3);`
            creates a substring of banana from a to n: anan
            `banana` -> string
            `1` -> position
            `3` -> length
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="SubString">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="ExprHolder" name="string">
                <xs:annotation>
                    <xs:documentation>
                        The source string
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="ExprHolder"  name="position">
                <xs:annotation>
                    <xs:documentation>
                        The starting position for the substring
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="ExprHolder" minOccurs="0" name="length">
                <xs:annotation>
                    <xs:documentation>
                        The length of the substring from the starting position
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>

    <!--Partition tag-->
    <xs:annotation>
        <xs:appinfo>Partition Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Partition the dataset with a column when using a window function.

            Ex- `select branch_id, 100 * RATIO_TO_REPORT(net_profit) OVER (PARTITION BY branch_id order by branch_id
            ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
            from sales as s1 `
            `RATIO_TO_REPORT` -> name
            `net_profit` -> Expr in the Wfunc
            `branch_id` -> partition
            `branch_id` -> sort
            `ROWS` -> type in frame
            `UNBOUNDED` -> lowerLimit in Frame
            `PRECEDING` -> lowerPosition in Frame
            `CURRENT_ROW` -> upperPosition in Frame
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Partition">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr">
                <xs:annotation>
                    <xs:documentation>
                        Contains the column that are used for partitioning the dataset
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>

    </xs:complexType>

    <!--Frame (Between)-->
    <xs:annotation>
        <xs:appinfo>Frame (Between in Window func) Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Between - Used in logical operations and in window functions.
            Sets upper and lower limits with positional values in window functions.
            Performs range operations in Logical Operations.

            Ex- `select branch_id, 100 * RATIO_TO_REPORT(net_profit) OVER (PARTITION BY branch_id order by branch_id
            ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
            from sales as s1 `
            `RATIO_TO_REPORT` -> name
            `net_profit` -> Expr in the Wfunc
            `branch_id` -> partition
            `branch_id` -> sort
            `ROWS` -> type in frame
            `UNBOUNDED` -> lowerLimit in Frame
            `PRECEDING` -> lowerPosition in Frame
            `CURRENT_ROW` -> upperPosition in Frame
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Frame">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr">
                <xs:annotation>
                    <xs:documentation>
                        The expression (Const or Attr or Op) which is used in the Frame.
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="BetweenType" name="type">
            <xs:annotation>
                <xs:documentation>
                    Can be ROWS or RANGE BETWEEN
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="hi_val">
            <xs:annotation>
                <xs:documentation>
                    Specifies the upper limit value (can be constants or CURRENT ROW)
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="low_val">
            <xs:annotation>
                <xs:documentation>
                    Specifies the lower limit value (can be constants or UNBOUNDED)
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="low_rel">
            <xs:annotation>
                <xs:documentation>
                    Specifies the lower position. Can be (FOLLOWING, PRECEDING, or CURRENT_ROW)
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="hi_rel">
            <xs:annotation>
                <xs:documentation>
                    Specifies the upper position. Can be (FOLLOWING, PRECEDING, or CURRENT_ROW)
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="BetweenType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="ROWS"/>
            <xs:enumeration value="RANGE"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- Base Aggreagtion -->
    <xs:complexType name="Agg">
        <xs:group ref="Expr" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>
                    Contains Attr or other expressions which needs to be aggregated.
                </xs:documentation>
            </xs:annotation>
        </xs:group>
    </xs:complexType>

    <!-- Group By-->
    <xs:annotation>
        <xs:appinfo>Group By Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Agg - Is the Group by clause which contains a list of attributes
            and a having clause.
            Ex: `SELECT product_ID, SUM(retail_price * quantity) AS gross_revenue
            FROM sales
            GROUP BY product_ID having product_id = 10;`
            `GROUP BY product_ID having product_id = 10;` -> part of Agg
            `product_ID` -> Expr in Agg
            `having product_id = 10` -> Filter in Agg
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="aggreg">
        <xs:complexContent>
            <xs:restriction base="Agg">
                <xs:group ref="Expr" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation>
                            Contains Attr or other expressions which needs to be aggregated.
                        </xs:documentation>
                    </xs:annotation>
                </xs:group>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <!--Qualify-->
    <xs:annotation>
        <xs:appinfo>Qualify Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            VAgg - Is the WINDOW clause which contains a list of vertical filters.
            Ex- `SELECT i, p, o
            FROM qt
            QUALIFY ROW_NUMBER() OVER (PARTITION BY p ORDER BY o) = 1 ;`
            `ROW_NUMBER() OVER (PARTITION BY p ORDER BY o) = 1` -> Will be the Vfilter in Qualify
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="aggwnd">
        <xs:complexContent>
            <xs:restriction base="Agg">
                <xs:group ref="Expr" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation>
                            Contains Attr or other expressions which needs to be aggregated.
                        </xs:documentation>
                    </xs:annotation>
                </xs:group>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <!--Filter (having, where, qualify) -->
    <xs:annotation>
        <xs:appinfo>Filter Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Filter contains information regarding the where, having, and qualify clauses.
            Filter contains Expr (usually Op) which can be used to represent the above clauses.

            Ex.- `select * from tab where a = 10`
            `where a = 10` -> will be in the Filter in the form of an Op
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Filter">
        <xs:group ref="Expr" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>
                    The constraint (usually an Op) which is specified in the where, having, or qualify clause
                </xs:documentation>
            </xs:annotation>
        </xs:group>
    </xs:complexType>

    <!-- Qualify -->
    <xs:complexType name="filtvert">
        <xs:complexContent>
            <xs:restriction base="Filter">
                <xs:group ref="Expr">
                    <xs:annotation>
                        <xs:documentation>
                            A unit consisting of operations between other operators, functions,
                            attributes, Case/when, constants, datasets, joins, and windows.
                        </xs:documentation>
                    </xs:annotation>
                </xs:group>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <!-- Where -->
    <xs:complexType name="filtreg">
        <xs:complexContent>
            <xs:restriction base="Filter">
                <xs:group ref="Expr">
                    <xs:annotation>
                        <xs:documentation>
                            A unit consisting of operations between other operators, functions,
                            attributes, Case/when, constants, datasets, joins, and windows.
                        </xs:documentation>
                    </xs:annotation>
                </xs:group>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <!-- Having -->
    <xs:complexType name="filtagg">
        <xs:complexContent>
            <xs:restriction base="Filter">
                <xs:group ref="Expr">
                    <xs:annotation>
                        <xs:documentation>
                            A unit consisting of operations between other operators, functions,
                            attributes, Case/when, constants, datasets, joins, and windows.
                        </xs:documentation>
                    </xs:annotation>
                </xs:group>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <!--Join Body-->
    <xs:annotation>
        <xs:appinfo>Join Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Join - Contains the data to be joined, the type of join,
            and the condition on which it should do so.

            Ex. - `select * from tab1 inner join tab2 on tab1.id = tab2.id`
            `inner` -> type
            `join tab2 on tab1.id = tab2.id` -> will be represented in Join
            `tab1.id = tab2.id` -> is the join condition
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Join">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Contains the data sources which are used in join
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="JoinType" name="type">
            <xs:annotation>
                <xs:documentation>
                    Specifies the type of the join
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="JoinSubType" name="subType">
            <xs:annotation>
                <xs:documentation>
                    Specifies the subtype of the join
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="definedAs">
            <xs:annotation>
                <xs:documentation>
                    Indicate if the join is explicitly defined and if it is NATURAL
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="JoinType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="outer"/>
            <xs:enumeration value="inner"/>
            <xs:enumeration value="cross"/>
            <xs:enumeration value="nonansi">
                <xs:annotation>
                    <xs:documentation>
                        Non-Ansi is a custom join type wherein FlowHigh detects a non
                        ansi join and rewrites the message as if a join has actually occurred.
                        Ex - "select * from tab1, tab2 where tab1.id = tab2.id"
                        This forms a non-ansi join between tab1 and tab2. This can be rewritten as
                        "select * from tab1 join tab2 on tab1.id = tab2.id"
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="JoinSubType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="left"/>
            <xs:enumeration value="right"/>
            <xs:enumeration value="full"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Paging (Limit)-->
    <xs:annotation>
        <xs:appinfo>Paging Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Contains information about paging. Used to only display a limited number of results.

            Ex. `select * from tab limit 5`
            `limit` -> type
            `5` -> is the Expr (value) which is used in Limit
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Page">
        <xs:sequence>
            <xs:element type="xs:int" name="value">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the paging limit expression
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute type="PageType" name="type">
            <xs:annotation>
                <xs:documentation>
                    Specifies the type of the paging (LIMIT, FETCH, TOP)
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="PageType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="limit"/>
            <xs:enumeration value="top"/>
            <xs:enumeration value="fetch"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Pivot and Unpivot-->
    <xs:annotation>
        <xs:appinfo>Rotate (Pivot/Unpivot) Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Rotate - There are two types of Rotate
            1. Pivot: Rotates a table by turning the unique values from one column in the input
            expression into multiple columns and aggregating results where required on any remaining column values
            OR
            2. Unpivot: Rotates a table by transforming columns into rows.

            • for - contains the column from the source table or subquery that contains the data from
            which column names will be generated.
            • aggregate - Specifies the aggregation function that is used
            • pivotColumn - specifies the column from the source table or subquery that will be aggregated.
            • valueColumn - The name to assign to the generated column that will be populated with the
            values from the columns in the column list in the case of UNPIVOT.
            OR
            The column from the source table or subquery that contains the
            values from which column names will be generated in the case of PIVOT
            • nameColumn - The name to assign to the generated column that will be populated with the
            name from the columns in the column list in the case of Unpivot.
            • columnAlias - contains the name of the columns (this is a part of the For list)
            • rotate type specifies the whether the operation is pivot or unpivot

            Ex.1 - `SELECT *
            FROM monthly_sales
            PIVOT(SUM(amount) FOR MONTH IN ('JAN', 'FEB', 'MAR', 'APR'))
            AS p (JAN, FEB, MAR, APR)
            ORDER BY EMPID;`
            `PIVOT` -> type
            `SUM` -> aggregate
            `monthly_sales` -> pivotColumn
            `MONTH` -> valueColumn
            `'JAN', 'FEB', 'MAR', 'APR'` -> for
            `AS p (JAN, FEB, MAR, APR)` -> alias in for

            Ex.2 - `SELECT * FROM monthly_sales
            UNPIVOT(sales FOR month IN (jan, feb, mar, april))
            ORDER BY empid;`
            `UNPIVOT` -> type
            `sales` -> valueColumn
            `MONTH` -> nameColumn
            `'JAN', 'FEB', 'MAR', 'APR'` -> for
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Rotate">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="For" name="for">
                <xs:annotation>
                    <xs:documentation>
                        Contains the column from the source table or subquery that contains the data from
                        which column names will be generated.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="aggregate">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the aggregation function that is used
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="ExprWrapper" name="pivotColumn">
                <xs:annotation>
                    <xs:documentation>
                        The column from the source table or subquery that will be aggregated.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="xs:string" name="valueColumn">
                <xs:annotation>
                    <xs:documentation>
                        The column from the source table or subquery that contains the
                        values from which column names will be generated in the case of Pivot
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="RotateType" name="type" default="pivot">
            <xs:annotation>
                <xs:documentation>
                    Specifies the type of Rotate. Can be Pivot or Unpivot
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="nameColumn">
            <xs:annotation>
                <xs:documentation>
                    The name to assign to the generated column that will be populated
                    with the names of the columns in the column list in the case of Unpivot.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="valueColumn">
            <xs:annotation>
                <xs:documentation>
                    The name to assign to the generated column that will be populated with the
                    values from the columns in the column list in the case of Unpivot.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="For">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr"/>
            <xs:element type="xs:string" name="columnAlias">
                <xs:annotation>
                    <xs:documentation>
                        Column_alias - contains the name of the columns
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
    </xs:complexType>
    <xs:simpleType name="RotateType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="pivot"/>
            <xs:enumeration value="unpivot"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Lateral View-->
    <xs:annotation>
        <xs:appinfo>Edge (Lateral View) Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Edge - The LATERAL VIEW clause is used in conjunction with generator functions such as EXPLODE,
            which will generate a virtual table containing one or more rows.
            LATERAL VIEW will apply the rows to each original output row.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Edge">
        <xs:choice>
            <xs:group ref="Expr" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Expressions to which the generator function is applied to
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
            <xs:element type="xs:string" name="columnAlias" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Lists the column aliases of generator function, which may be used in output rows.
                        If there are multiple aliases then the output will have multiple columns.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="xs:string" name="generatorFunc">
            <xs:annotation>
                <xs:documentation>
                    Specifies a generator function (EXPLODE, INLINE, etc.)
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="type">
            <xs:annotation>
                <xs:documentation>
                    Can either be null or OUTER.
                    If OUTER is specified, returns null if an input array/map is empty or null.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--MatchRecognize-->
    <xs:annotation>
        <xs:appinfo>Match Recognize Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            MATCH_RECOGNIZE accepts a set of rows (from a table, view, subquery, or other source) as input,
            and returns all matches for a given row pattern within this set
            • orderBy - This is the order in which the individual rows of each partition are passed
            to the MATCH_RECOGNIZE operator
            • partitionBy - is used to specify an expression that groups rows that are related to each other
            • measures - are optional additional columns that are added to the output of the MATCH_RECOGNIZE operator
            • rowCondition - specifies what should occur for the row action to take place
            • rowAction - specifies what should happen when the rowCondition is met
            • pattern - stores the pattern that is used to match a valid sequence of rows
            • define - is used to specify symbols for MATCH_RECOGNIZE operator

            Ex - `SELECT * FROM stock_price_history
            MATCH_RECOGNIZE(
            PARTITION BY company
            ORDER BY price_date
            MEASURES
            MATCH_NUMBER() AS match_number,
            FIRST(price_date) AS start_date,
            LAST(price_date) AS end_date,
            COUNT(*) AS rows_in_sequence,
            COUNT(row_with_price_decrease.*) AS num_decreases,
            COUNT(row_with_price_increase.*) AS num_increases
            ONE ROW PER MATCH
            AFTER MATCH SKIP TO LAST row_with_price_increase
            PATTERN(row_before_decrease row_with_price_decrease+ row_with_price_increase+)
            DEFINE
            row_with_price_decrease AS price > LAG(price),
            row_with_price_increase AS price > LAG(price)
            )
            ORDER BY company, match_number;`

            `company` -> partitionBy
            `price_date` -> orderBy
            `MATCH_NUMBER() AS match_number,
            FIRST(price_date) AS start_date,
            LAST(price_date) AS end_date,
            COUNT(*) AS rows_in_sequence,
            COUNT(row_with_price_decrease.*) AS num_decreases,
            COUNT(row_with_price_increase.*) AS num_increases`-> measure
            `ONE ROW PER MATCH` -> rowCondition
            `AFTER MATCH SKIP TO LAST row_with_price_increase` -> rowAction
            `row_with_price_increase+` -> pattern
            `row_with_price_decrease AS price > LAG(price),
            row_with_price_increase AS price > LAG(price)` -> define
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="MatchRecognize">
        <xs:attribute type="xs:string" name="orderBy">
            <xs:annotation>
                <xs:documentation>
                    This is the order in which the individual rows of each partition are passed
                    to the MATCH_RECOGNIZE operator
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="partitionBy">
            <xs:annotation>
                <xs:documentation>
                    Specifies an expression that groups rows that are related to each other
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="measure">
            <xs:annotation>
                <xs:documentation>
                    Optional additional columns that are added to the output of the MATCH_RECOGNIZE operator
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="rowCondition">
            <xs:annotation>
                <xs:documentation>
                    Specifies what should occur for the row action to take place
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="rowAction">
            <xs:annotation>
                <xs:documentation>
                    Specifies what should happen when the rowCondition is met
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="pattern">
            <xs:annotation>
                <xs:documentation>
                    Stores the pattern that is used to match a valid sequence of rows
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="define">
            <xs:annotation>
                <xs:documentation>
                    Specify symbols for MATCH_RECOGNIZE operator
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--StructRef Body-->
    <xs:annotation>
        <xs:appinfo>StructRef Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Struct ref - Structured References: Contains the column to which the semi structured data is referring to
            • Column ref contains the name of the column
            • Structure ref contains the full reference to the semi structured data (JSON, Avro etc)
            pos - Specifies the start position and the length of the object in the query

            EX. - SELECT src:dealership
            FROM car_sales
            ORDER BY 1;
            `src` -> columnRef
            `dealership` -> structureRef
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="StructRef">
        <xs:attribute type="xs:string" name="refdb">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the referenced database
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refsch">
            <xs:annotation>
                <xs:documentation>
                    Contains the schema name of the source attribute which has been
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refds">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the referenced dataset
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refatt">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of reference to the source attribute.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refpath">
            <xs:annotation>
                <xs:documentation>
                    Contains the path of the data being referenced
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="fullref">
            <xs:annotation>
                <xs:documentation>
                    Contains the full reference of this element
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>

    <!--Case Body-->
    <xs:annotation>
        <xs:appinfo>Case Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Case clause - Contains information regarding the CASE ... WHEN clause.
            It includes attribute/expression, when clause, then clause, and else clause
            pos - Specifies the start position and the length of the object in the query

            Ex - `SELECT
            CASE
            WHEN column1=1 THEN 'one'
            WHEN column1=2 THEN 'two'
            ELSE 'other'
            END AS result
            FROM (values(1),(2),(3)) v;`
            `WHEN column1=1 THEN 'one'
            WHEN column1=2 THEN 'two'` -> When part of Case
            `column1=1` and `column1=2` -> condition part of When
            `THEN 'one'` and `THEN 'two'` -> Then part of When
            `ELSE 'other'` -> Else part of Case
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Case">
        <xs:choice maxOccurs="unbounded">
            <xs:choice minOccurs="0">
                <xs:group ref="Expr" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            A general expression that can be used after the CASE keyword
                        </xs:documentation>
                    </xs:annotation>
                </xs:group>
            </xs:choice>
            <xs:element type="When" name="when" maxOccurs="unbounded" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains information about the conditions that are checked for
                        the then clause(present in When) to take effect.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Else" name="else" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Contains information about what should occur
                        if none of the WHEN clause conditions are satisfied.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="Direction" name="direction"/>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>
    <!--Case then-->
    <xs:annotation>
        <xs:appinfo>Case Then Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Contains information about what to do after the WHEN condition is satisfied.
            Ex - `SELECT
            CASE
            WHEN column1=1 THEN 'one'
            WHEN column1=2 THEN 'two'
            ELSE 'other'
            END AS result
            FROM (values(1),(2),(3)) v;`
            `WHEN column1=1 THEN 'one'
            WHEN column1=2 THEN 'two'` -> When part of Case
            `column1=1` and `column1=2` -> condition part of When
            `THEN 'one'` and `THEN 'two'` -> Then part of When
            `ELSE 'other'` -> Else part of Case
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Then">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        The expression that is returned if the WHEN condition is true.
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--Case When-->
    <xs:annotation>
        <xs:appinfo>Case When Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Contains information about the conditions that are checked for
            the then clause to take effect.
            Ex - `SELECT
            CASE
            WHEN column1=1 THEN 'one'
            WHEN column1=2 THEN 'two'
            ELSE 'other'
            END AS result
            FROM (values(1),(2),(3)) v;`
            `WHEN column1=1 THEN 'one'
            WHEN column1=2 THEN 'two'` -> When part of Case
            `column1=1` and `column1=2` -> condition part of When
            `THEN 'one'` and `THEN 'two'` -> Then part of When
            `ELSE 'other'` -> Else part of Case
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="When">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element type="Then" name="then" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Contains information about what to do after the WHEN condition is satisfied.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:group ref="Expr" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        The condition that is checked for the current WHEN clause.
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>

    <!--Case Else-->
    <xs:annotation>
        <xs:appinfo>Case Else Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Contains information about what should occur
            if none of the WHEN clause conditions are satisfied.
            Ex - `SELECT
            CASE
            WHEN column1=1 THEN 'one'
            WHEN column1=2 THEN 'two'
            ELSE 'other'
            END AS result
            FROM (values(1),(2),(3)) v;`
            `WHEN column1=1 THEN 'one'
            WHEN column1=2 THEN 'two'` -> When part of Case
            `column1=1` and `column1=2` -> condition part of When
            `THEN 'one'` and `THEN 'two'` -> Then part of When
            `ELSE 'other'` -> Else part of Case
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Else">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        The expression that is returned when none of the WHEN conditions are true.
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
    </xs:complexType>

    <!--Set Operations-->
    <xs:annotation>
        <xs:appinfo>Set Ops Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Contains information the type and the Dataset(DS) with which the set operation should occur.

            Ex. `select * from tab1 union tab2`
            `union` -> type
            `tab2` -> DS in SetOp
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="SetOps">
        <xs:sequence>
            <xs:element type="DS" name="ds"/>
        </xs:sequence>
        <xs:attribute type="SetOpsType" name="type">
            <xs:annotation>
                <xs:documentation>
                    The type of set operation that should occur.
                    Can be any of INTERSECT, MINUS, UNION, UNION ALL, or EXCEPT.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="SetOpsType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="UNION"/>
            <xs:enumeration value="UNION ALL"/>
            <xs:enumeration value="INTERSECT"/>
            <xs:enumeration value="EXCEPT"/>
            <xs:enumeration value="MINUS"/>
            <xs:enumeration value="SETMINUS"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Cast-->
    <xs:annotation>
        <xs:appinfo>Cast Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Cast - Converts a value of one data type into another data type.
            Contains names of the data and the type to which it needs to be converted to.
            pos - Specifies the start position and the length of the object in the query

            Ex- SELECT CAST('1.2345' AS DECIMAL(15,2));
            `'1.2345'` -> is the Expr in Cast to be converted
            `DECIMAL(15,2)` -> Specifies the dataType
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Cast">
        <xs:choice>
            <xs:group ref="Expr">
                <xs:annotation>
                    <xs:documentation>
                        Contains the data that needs to be converted.
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="xs:string" name="dataType" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specifies the data type of the data that it needs to be converted to.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--Querying Stage-->
    <xs:annotation>
        <xs:appinfo>Querying Stage Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Query data files located in an internal (i.e. Snowflake) stage or named external
            (Amazon S3, Google Cloud Storage, or Microsoft Azure) stage.
            This can be useful for inspecting/viewing the contents of the staged files,
            particularly before loading or after unloading data.

            Contains details of staged data files
            • location - specifies where the data is being used from
            • fileFormat - specifies the format of the file
            • pattern - is used to further filter the files in the staged location
            pos - Specifies the start position and the length of the object in the query

            Ex - `SELECT t.$1, t.$2 FROM @mystage1 (file_format => 'myformat', pattern=>'.*data.*[.]csv.gz') t;`
            `@mystage1 (file_format => 'myformat', pattern=>'.*data.*[.]csv.gz') t` -> is the QueryingStage
            `@mystage1` -> location
            `'myformat'` -> fileFormat
            `'.*data.*[.]csv.gz'` -> pattern
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="QueryingStage">
        <xs:attribute type="xs:string" name="location">
            <xs:annotation>
                <xs:documentation>
                    Specifies where the data is being used from
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="fileFormat">
            <xs:annotation>
                <xs:documentation>
                    Specifies the format of the file
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="pattern">
            <xs:annotation>
                <xs:documentation>
                    Further filters the files in the staged location using regex
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>

    <!--Table Sample-->
    <xs:annotation>
        <xs:appinfo>Table Sample Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Table Sample or Sample is used to return a subset of rows sampled randomly from the specified table
            • sampleMethod - Specifies the type of sampling methodology. Can be either BERNOULLI, ROW, SYSTEM, or BLOCK
            • sampleType - is either SAMPLE or TABLESAMPLE
            • probability - specifies the percentage probability to use for selecting the sample
            • num - specifies the number of rows to sample from the table
            • seed - is used to specify a seed value to make the sampling deterministic
            • seedType - can be either REPEATABLE or SEED
            pos - Specifies the start position and the length of the object in the query

            Ex.1 : `SELECT * FROM testtable TABLESAMPLE BERNOULLI (20.3);`
            `TABLESAMPLE` -> sampleType
            `BERNOULLI` -> sampleMethod
            20.3 -> probability

            Ex.2: `SELECT * FROM testtable TABLESAMPLE (100) seed (82);`
            100 -> num
            seed -> seedType
            82 -> seed (the value of the seed)
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="TableSample">
        <xs:attribute type="xs:string" name="sampleMethod">
            <xs:annotation>
                <xs:documentation>
                    Specifies the type of sampling methodology. Can be either BERNOULLI, ROW, SYSTEM, or BLOCK
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="sampleType">
            <xs:annotation>
                <xs:documentation>
                    Is either SAMPLE or TABLESAMPLE
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="probability">
            <xs:annotation>
                <xs:documentation>
                    Specifies the percentage probability to use for selecting the sample
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="num">
            <xs:annotation>
                <xs:documentation>
                    Specifies the number of rows to sample from the table
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="seed">
            <xs:annotation>
                <xs:documentation>
                    Specifies a seed value to make the sampling deterministic
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="seedType">
            <xs:annotation>
                <xs:documentation>
                    Can be either REPEATABLE or SEED
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--Base Function type-->
    <xs:annotation>
        <xs:appinfo>Function Abbreviation Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Func - Function: Performs a task based on the name of the function and accepts a number of arguments.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Function">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr">
                <xs:annotation>
                    <xs:documentation>
                        The expression arguments for the function
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
            <xs:sequence>
                <xs:element type="Sort" name="withinGroup" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies order by part of the function in the case of "listagg" or similar
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element type="Partition" name="partition" minOccurs="0"/>
                <xs:element type="Sort" name="sort" minOccurs="0"/>
                <xs:element type="Frame" name="frame" minOccurs="0"/>
            </xs:sequence>
        </xs:choice>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="xs:string" name="name" use="required">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the function.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="subType"/>
        <xs:attribute type="xs:string" name="quantifier"/>
        <xs:attribute type="Direction" name="direction"/>
    </xs:complexType>

    <xs:annotation>
        <xs:appinfo>Aggregate Function Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Functions that take multiple rows/values as input and return a single value.
            • withinGroup - specifies order by part of the function in the case of "listagg" or similar
            • name - Contains the name of the function.
            • quantifier - Specifies Distinct/All qualifier
            pos - Specifies the start position and the length of the object in the query

            Ex.1 - `select sum(col1) from tab1`
            `sum` -> name
            `col1` -> Expr arguments for the function
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="fagg">
        <xs:complexContent>
            <xs:restriction base="Function">
                <xs:choice maxOccurs="unbounded">
                    <xs:group ref="Expr">
                        <xs:annotation>
                            <xs:documentation>
                                The expression arguments for the function
                            </xs:documentation>
                        </xs:annotation>
                    </xs:group>
                    <xs:sequence>
                        <xs:element type="Sort" name="withinGroup" minOccurs="0">
                            <xs:annotation>
                                <xs:documentation>
                                    Specifies order by part of the function in the case of "listagg" or similar
                                </xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:choice>
                <xs:attribute type="xs:string" name="alias"/>
                <xs:attribute type="xs:string" name="name" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of the function.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="id" name="pos" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the start position and the length of the object in the query
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="subType"/>
                <xs:attribute type="xs:string" name="quantifier"/>
                <xs:attribute type="Direction" name="direction"/>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <xs:annotation>
        <xs:appinfo>Scalar Function Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Functions that take a single row/value as input and return a single value
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="fscalar">
        <xs:complexContent>
            <xs:restriction base="Function">
                <xs:choice maxOccurs="unbounded">
                    <xs:group ref="Expr">
                        <xs:annotation>
                            <xs:documentation>
                                The expression arguments for the function
                            </xs:documentation>
                        </xs:annotation>
                    </xs:group>
                </xs:choice>
                <xs:attribute type="xs:string" name="alias"/>
                <xs:attribute type="xs:string" name="name" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of the function.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="id" name="pos" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the start position and the length of the object in the query
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="subType"/>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <xs:annotation>
        <xs:appinfo>Scalar Function Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Functions that perform control operations or return system-level information
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="fsystem">
        <xs:complexContent>
            <xs:restriction base="Function">
                <xs:choice maxOccurs="unbounded">
                    <xs:group ref="Expr">
                        <xs:annotation>
                            <xs:documentation>
                                The expression arguments for the function
                            </xs:documentation>
                        </xs:annotation>
                    </xs:group>
                </xs:choice>
                <xs:attribute type="xs:string" name="alias"/>
                <xs:attribute type="xs:string" name="name" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of the function.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="id" name="pos" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the start position and the length of the object in the query
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="subType"/>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <!--Window -->
    <xs:annotation>
        <xs:appinfo>Window function Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Subset of aggregate functions that can operate on a subset of rows
            Contains function, partition, sorting, and frame information.
            type -> Denotes the type of window function.

            Ex- `select branch_id, 100 * RATIO_TO_REPORT(net_profit) OVER (PARTITION BY branch_id order by branch_id
            ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
            from sales as s1 `
            `general` -> type of Wfunc
            `RATIO_TO_REPORT` -> name
            `net_profit` -> Expr in the Wfunc
            `branch_id` -> partition
            `branch_id` -> sort
            `ROWS` -> type in frame
            `UNBOUNDED` -> lowerLimit in Frame
            `PRECEDING` -> lowerPosition in Frame
            `CURRENT` -> upperPosition in Frame
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="fwnd">
        <xs:complexContent>
            <xs:restriction base="Function">
                <xs:choice maxOccurs="unbounded">
                    <xs:group ref="Expr">
                        <xs:annotation>
                            <xs:documentation>
                                The expression arguments for the function
                            </xs:documentation>
                        </xs:annotation>
                    </xs:group>
                    <xs:sequence>
                        <xs:element type="Partition" name="partition" minOccurs="0"/>
                        <xs:element type="Sort" name="sort" minOccurs="0"/>
                        <xs:element type="Frame" name="frame" minOccurs="0"/>
                    </xs:sequence>
                </xs:choice>
                <xs:attribute type="xs:string" name="alias"/>
                <xs:attribute type="xs:string" name="name" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of the function.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="id" name="pos" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the start position and the length of the object in the query
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="subType"/>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>

    <!--Table Function-->
    <xs:annotation>
        <xs:appinfo>Table Function Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Table function -  table function returns a set of rows for each input row.
            The returned set can contain zero, one, or more rows
            • partition - contains a list of expressions which are used for partitioning
            • sort - contains the order by clause
            • frame - contains the between statement
            • subQuery - contains a subquery dataset
            • options - contains the options being applied to the operation in the function
            • name - contains the name of the operation in the function
            • type - can be either TABLE or LATERAL
            • funcName - is the name of the function used in the table function
            • pos - Specifies the start position and the length of the object in the query

            Ex.1: `select fav.color as favorite_2017, f.*
            from fashion f JOIN table(favorite_colors(2017)) fav
            where fav.color = f.fashion_color;`

            `table` -> type
            favorite_colors -> funcName
            2017 -> options
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="TableFunc">
        <xs:choice maxOccurs="unbounded" minOccurs="0">
            <xs:element type="TableFuncArgs" name="args">
                <xs:annotation>
                    <xs:documentation>
                        Contains the name of an expression and the Option that is applied to it in an UDTF.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="TableFuncPartition" name="partition">
                <xs:annotation>
                    <xs:documentation>
                        Contains a list of expressions which are used for partitioning
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Sort" name="sort">
                <xs:annotation>
                    <xs:documentation>
                        Contains the ORDER BY clause
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="Frame" name="frame">
                <xs:annotation>
                    <xs:documentation>
                        Contains the BETWEEN statement
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element type="DS" name="subQuery">
                <xs:annotation>
                    <xs:documentation>
                        Contains a dataset which can be used in a table function
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:choice>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="xs:string" name="type">
            <xs:annotation>
                <xs:documentation>
                    Can be either LATERAL or TABLE
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="name" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specifies the name of the function used in the table function
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="TableFuncArgs" mixed="true">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="Options" name="options"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="name"/>
    </xs:complexType>
    <xs:complexType name="Options" mixed="true">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="name"/>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start and end position of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="type">
            <xs:annotation>
                <xs:documentation>
                    Specifies the data type of the data that it needs to be converted to.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refatt">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of reference to the source attribute which has been aliased.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refds">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the dataset which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refdb">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the database which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refsch">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the schema which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="fullref">
            <xs:annotation>
                <xs:documentation>
                    Contains the full reference of the asterisk attribute
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="dataType">
            <xs:annotation>
                <xs:documentation>
                    Specifies the data type of the data that it needs to be converted to.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="TableFuncPartition">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--InlineTable-->
    <xs:annotation>
        <xs:appinfo>InlineTable Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Inline table - An inline table is a temporary table created using a VALUES clause.
            Contains a list of expressions that are separated by a comma in the query
            Ex - `SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (3, 'three'));`
            -> VALUES (1, 'one'), (2, 'two'), (3, 'three') is the inline table
            pos - Specifies the start position and the length of the object in the query
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="InlineTable">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr">
                <xs:annotation>
                    <xs:documentation>
                        Contains the comma separated expressions
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--MultiValue-->
    <xs:annotation>
        <xs:appinfo>MultiValue Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            A wrapper tag for comma separated expressions in brackets
            Ex- `select * from tab where a in ('1', '2', '3')`
            ('1', '2', '3') is the multivalue expression
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="MultiValue">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr">
                <xs:annotation>
                    <xs:documentation>
                        Contains the list of comma separated expressions
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
    </xs:complexType>

    <!--Operators-->
    <xs:annotation>
        <xs:appinfo>Operators Abbreviation Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Op - Operators: Any form of arithmetic/logical operations are represented by Op.
            Operations between other operators, functions,
            attributes, Case/when, constants, datasets, joins, windows, etc. are included.
            • OpType - Comprises all operations possible in SQL(Arithmetic, Logical, etc).

            Ex - select 1+2
            `1+2` -> Is the Op
            `1`, `2` -> Are the Expr in the Op
            `+` -> type
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Op">
        <xs:choice maxOccurs="unbounded" minOccurs="0">
            <xs:group ref="Expr">
                <xs:annotation>
                    <xs:documentation>
                        Contains the list of expression on which the operation has been applied
                    </xs:documentation>
                </xs:annotation>
            </xs:group>
        </xs:choice>
        <xs:attribute type="OpType" name="type"/>
        <xs:attribute type="xs:string" name="value"/>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="xs:string" name="direction"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="OpType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="IS NULL"/>
            <xs:enumeration value="IS NOT NULL"/>
            <xs:enumeration value="CONCAT"/>
            <xs:enumeration value="MINUS"/>
            <xs:enumeration value="DIV_LIT"/>
            <xs:enumeration value="DIV"/>
            <xs:enumeration value="EQ"/>
            <xs:enumeration value="NEQ"/>
            <xs:enumeration value="AND"/>
            <xs:enumeration value="OR"/>
            <xs:enumeration value="LIKE"/>
            <xs:enumeration value="LIKE_ALL"/>
            <xs:enumeration value="LIKE_SOME"/>
            <xs:enumeration value="LIKE_ANY"/>
            <xs:enumeration value="RLIKE"/>
            <xs:enumeration value="REGEX"/>
            <xs:enumeration value="NOT_LIKE"/>
            <xs:enumeration value="IS"/>
            <xs:enumeration value="IS_DISTINCT"/>
            <xs:enumeration value="IS_NOT_DISTINCT"/>
            <xs:enumeration value="BOOL TRUE"/>
            <xs:enumeration value="BOOL FALSE"/>
            <xs:enumeration value="IN"/>
            <xs:enumeration value="ANY"/>
            <xs:enumeration value="PERCENT"/>
            <xs:enumeration value="LT"/>
            <xs:enumeration value="GT"/>
            <xs:enumeration value="GTE"/>
            <xs:enumeration value="LTE"/>
            <xs:enumeration value="IS_NOT"/>
            <xs:enumeration value="PARENTHESIS"/>
            <xs:enumeration value="NOT_EXISTS"/>
            <xs:enumeration value="BETWEEN"/>
            <xs:enumeration value="NEQJ"/>
            <xs:enumeration value="EXISTS"/>
            <xs:enumeration value="INTERSECT"/>
            <xs:enumeration value="EXCEPT"/>
            <xs:enumeration value="SETMINUS"/>
            <xs:enumeration value="UNION_ALL"/>
            <xs:enumeration value="UNION_DISTINCT"/>
            <xs:enumeration value="REGEXP"/>
            <xs:enumeration value="ASSIGN"/>
            <xs:enumeration value="MATCH"/>
            <xs:enumeration value="NOT_MATCH"/>
            <xs:enumeration value="COLLATE"/>
            <xs:enumeration value="NOT LIKE"/>
            <xs:enumeration value="NOT_LIKE_ALL"/>
            <xs:enumeration value="NOT_LIKE_ANY"/>
            <xs:enumeration value="NOT_LIKE_SOME"/>
            <xs:enumeration value="NOT_IN"/>
            <xs:enumeration value="NOT_RLIKE_ALL"/>
            <xs:enumeration value="NOT_RLIKE_ANY"/>
            <xs:enumeration value="NOT_RLIKE_SOME"/>
            <xs:enumeration value="NOT_REGEXP_SOME"/>
            <xs:enumeration value="NOT_REGEXP_ALL"/>
            <xs:enumeration value="NOT_REGEXP_ANY"/>
            <xs:enumeration value="NOT_REGEXP"/>
            <xs:enumeration value="NOT_RLIKE"/>
            <xs:enumeration value="RLIKE_ANY"/>
            <xs:enumeration value="RLIKE_ALL"/>
            <xs:enumeration value="RLIKE_SOME"/>
            <xs:enumeration value="REGEXP_SOME"/>
            <xs:enumeration value="REGEXP_ALL"/>
            <xs:enumeration value="REGEXP_ANY"/>
            <xs:enumeration value="EQ_ALL"/>
            <xs:enumeration value="EQ_AANY"/>
            <xs:enumeration value="NEQ_ALL"/>
            <xs:enumeration value="NEQ_ANY"/>
            <xs:enumeration value="NEQJ_ALL"/>
            <xs:enumeration value="NEQJ_ANY"/>
            <xs:enumeration value="LT_ALL"/>
            <xs:enumeration value="LT_ANY"/>
            <xs:enumeration value="LTE_ALL"/>
            <xs:enumeration value="LTE_ANY"/>
            <xs:enumeration value="GTE_ANY"/>
            <xs:enumeration value="GTE_ALL"/>
            <xs:enumeration value="GT_ALL"/>
            <xs:enumeration value="GT_ANY"/>
            <xs:enumeration value="NSEQ_ANY"/>
            <xs:enumeration value="NSEQ_ALL"/>
            <xs:enumeration value="NSEQ"/>
            <xs:enumeration value="CASE"/>
            <xs:enumeration value="AMPERSAND"/>
            <xs:enumeration value="ANY"/>
            <xs:enumeration value="SOME"/>
            <xs:enumeration value="ALL"/>
            <xs:enumeration value="DEFAULT"/>
            <xs:enumeration value="NOT EXISTS"/>
            <xs:enumeration value="PLUS"/>
            <xs:enumeration value="MULTI"/>
            <xs:enumeration value="IS NOT DISTINCT FROM"/>
            <xs:enumeration value="IS DISTINCT FROM"/>
            <xs:enumeration value="NOT IN"/>
            <xs:enumeration value="NOT"/>
            <xs:enumeration value="IS NOT"/>
            <xs:enumeration value="MOD"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Expression-->
    <xs:annotation>
        <xs:appinfo>Expression Abbreviation Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Expr - Expression: Can be comprised of attr, another expression, function, window function,
            operation, constant, case, asterisk, current, pivot/unpivot, multi-value, inline table, merge, position,
            querying stage, structured reference, table function, table sample, lateral view, window frame, insert, join,
            match recoginize, update, or dataset.
        </xs:documentation>
    </xs:annotation>
    <xs:group name="Expr">
        <xs:choice>
            <xs:element type="Function" name="func" minOccurs="0"/>
            <xs:element type="Cast" name="cast" minOccurs="0"/>
            <xs:element type="Op" name="op" minOccurs="0"/>
            <xs:element type="Const" name="const" minOccurs="0"/>
            <xs:element type="Case" name="case"/>
            <xs:element type="Attr" name="attr" minOccurs="0"/>
            <xs:element type="Asterisk" name="asterisk" minOccurs="0"/>
            <xs:element type="Current" name="current" minOccurs="0"/>
            <xs:element type="Rotate" name="rotate" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="InlineTable" name="inlineTable" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Merge" name="merge" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="MultiValue" name="multiValue" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Position" name="position" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="QueryingStage" name="queryingStage" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="StructRef" name="structRef" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="TableFunc" name="tableFunc" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="TableSample" name="tableSample" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Edge" name="edge" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Insert" name="insert" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Join" name="join" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="MatchRecognize" name="matchRecognize" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="Update" name="update" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="DS" name="ds" maxOccurs="unbounded" minOccurs="0"/>
            <xs:element type="SubString" name="subString" maxOccurs="unbounded" minOccurs="0"/>
        </xs:choice>
    </xs:group>

    <!--Asterisk-->
    <xs:annotation>
        <xs:appinfo>Asterisk Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Asterisk - Contains a list of Attr which are present in the relevant
            tables, datasets, tables, databases, and schema.
            • refatt - Contains the name of reference to the source attribute which has been aliased.
            • refvar - Contains the name of variable being referenced.
            • refds - Contains the name of the dataset which has been referenced.
            • refdb - Contains the name of the database which has been referenced.
            • refsch - Contains the name of the schema which has been referenced.
            • refoutidx - Numeric value which is used to refer to the Attr based on its position in select clause.
            • refoutidx - Numeric value which is used to refer to the Attr based on its position in select clause.
            • value - Holds constant values for the attribute.
            • alias -  The display name of the attribute
            pos - Specifies the start position and the length of the object in the query

            Ex: `select * from tab where id = 10`
            Then the Attr * will contain col.id as an Attr within it
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Asterisk">
        <xs:choice maxOccurs="unbounded" minOccurs="0">
            <xs:element type="Attr" name="attr"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="refatt">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of reference to the source attribute which has been aliased.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refvar">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of variable being referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refds">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the dataset which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refdb">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the database which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refsch">
            <xs:annotation>
                <xs:documentation>
                    Contains the name of the schema which has been referenced.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="fullref">
            <xs:annotation>
                <xs:documentation>
                    Contains the full reference of the asterisk attribute
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="refoutidx">
            <xs:annotation>
                <xs:documentation>
                    Numeric value which is used to refer to the Attr based on its position in select clause.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="Direction" name="direction">
            <xs:annotation>
                <xs:documentation>
                    Specifies the sorting order for an Attr
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="value">
            <xs:annotation>
                <xs:documentation>
                    A constant numeric/string value of an Attr.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="id" name="pos">
            <xs:annotation>
                <xs:documentation>
                    Specifies the start position and the length of the object in the query
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <!--Attributes-->
    <xs:annotation>
        <xs:appinfo>Attribute Abbreviation Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Attr - Attributes: The smallest unit in the query. Can contain reference to other
            attributes(in the case of alias), tables, datasets, tables, databases, and schema.
            • refatt - Contains the name of reference to the source attribute which has been aliased.
            • refvar - Contains the name of variable being referenced.
            • refds - Contains the name of the dataset which has been referenced.
            • refdb - Contains the name of the database which has been referenced.
            • refsch - Contains the name of the schema which has been referenced.
            • fullref - Contains the complete location of the attr which has been referenced.
            • refoutidx - Numeric value which is used to refer to the Attr based on its position in select clause.
            • value - Holds constant values for the attribute.
            • alias -  The display name of the attribute
            pos - Specifies the start position and the length of the object in the query

            Ex- select a, b, 1, sum(10) from tab
            `a`, `b` - are the Attr
            `sum(10)` -> will be Func
            `1` -> Const
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Attr">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute type="xs:string" name="refatt">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of reference to the source attribute which has been aliased.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="refvar">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of variable being referenced.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="refds">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of the dataset which has been referenced.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="refdb">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of the database which has been referenced.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="refsch">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the name of the schema which has been referenced.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="fullref">
                    <xs:annotation>
                        <xs:documentation>
                            Contains the full reference of the asterisk attribute
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="refoutidx">
                    <xs:annotation>
                        <xs:documentation>
                            Numeric value which is used to refer to the Attr based on its position in select clause.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="Direction" name="direction">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the sorting order for an Attr
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="value">
                    <xs:annotation>
                        <xs:documentation>
                            A constant numeric/string value of an Attr.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="alias"/>
                <xs:attribute type="id" name="pos"/>
                <xs:attributeGroup ref="href"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:attributeGroup name="href">
        <xs:attribute name="dboref" type="xlink:hrefType" xlink:href="#DBO/@oid">
            <xs:annotation>
                <xs:documentation>
                    Reference to the parent DBO's identifier
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="attref" type="xlink:hrefType" xlink:href="#Expr/@pos">
            <xs:annotation>
                <xs:documentation>
                    Origin oid of the parent expression being referenced
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:attributeGroup>

    <!--Constants-->
    <xs:annotation>
        <xs:appinfo>Constant Abbreviation Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Const - Constants: Comprised of a constant numeric/string value.
            • pos - Specifies the start position and the length of the object in the query

            Ex- select a, b, 1, sum(10) from tab
            `a`, `b` - are the Attr
            `sum(10)` -> will be Func
            `1` -> Const
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Const">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute type="xs:string" name="alias"/>
                <xs:attribute type="id" name="pos">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the start position and the length of the object in the query
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <!--Current-->
    <xs:annotation>
        <xs:appinfo>Current Documentation</xs:appinfo>
        <xs:documentation xml:lang="en">
            Current: A system command, which can either be current_timestamp, or current_date.
            • type - current_timestamp, current_date
            • pos - Specifies the start position and the length of the object in the query

            Ex: `Select current_date`
            current_date -> type
        </xs:documentation>
    </xs:annotation>
    <xs:complexType name="Current">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute type="xs:string" name="type">
                    <xs:annotation>
                        <xs:documentation>
                            Can be either CURRENT_TIMESTAMP or CURRENT_DATE
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute type="xs:string" name="alias"/>
                <xs:attribute type="id" name="pos">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the start position and the length of the object in the query
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="ExprWrapper">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr"/>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="ExprHolder" mixed="true">
        <xs:choice maxOccurs="unbounded">
            <xs:group ref="Expr"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="alias"/>
        <xs:attribute type="Direction" name="direction"/>
        <xs:attribute type="xs:string" name="name"/>
        <xs:attribute type="id" name="pos"/>
        <xs:attribute type="xs:string" name="dataType"/>
        <xs:attribute type="xs:string" name="type"/>
        <xs:attribute type="xs:string" name="value"/>
        <xs:attribute type="xs:string" name="refatt"/>
        <xs:attribute type="xs:string" name="refvar"/>
        <xs:attribute type="xs:string" name="refds"/>
        <xs:attribute type="xs:string" name="refdb"/>
        <xs:attribute type="xs:string" name="refsch"/>
        <xs:attribute type="xs:string" name="fullref"/>
        <xs:attribute type="xs:string" name="refoutidx"/>
        <xs:attribute type="xs:string" name="refpath"/>
        <xs:attribute type="xs:string" name="generatorFunc"/>
        <xs:attribute type="xs:string" name="refTo"/>
        <xs:attribute type="xs:string" name="action"/>
    </xs:complexType>

    <xs:simpleType name="id">
        <xs:restriction base="xs:string">
            <xs:pattern value="[A-Za-z0-9_\-]+"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>