org.apache.ignite.cache.query.annotations

## Annotation Type QuerySqlField

-     @Documented
       @Retention(value=RUNTIME)
       @Target(value=FIELD)
      public @interface QuerySqlField

  Annotates fields for SQL queries. All fields that will be involved in SQL clauses must have this annotation. For more information about cache queries see `CacheQuery` documentation.
  See Also:
    `CacheQuery`

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `boolean` | `descending` Specifies whether index should be in descending order or not.
    `String[]` | `groups` Array of index groups this field belongs to.
    `boolean` | `index` Specifies whether cache should maintain an index for this field or not.
    `int` | `inlineSize` Index inline size in bytes.
    `String` | `name` Property name.
    `boolean` | `notNull` Specifies whether the specified field can be `null`.
    `QuerySqlField.Group[]` | `orderedGroups` Array of ordered index groups this field belongs to.
    `int` | `precision` Specifies field precision for variable length types - decimal, string and byte array.
    `int` | `scale` Specifies scale for a decimal field.

- - ### Element Detail

    - #### index

          public abstract boolean index

      Specifies whether cache should maintain an index for this field or not. Just like with databases, field indexing may require additional overhead during updates, but makes select operations faster.

      When indexing SPI and indexed field is of type `org.locationtech.jts.geom.Geometry` (or any subclass of this class) then Ignite will consider this index as spatial providing performance boost for spatial queries.

      Returns:
        `True` if index must be created for this field in database.
      Default:
        false

  - - #### descending

          public abstract boolean descending

      Specifies whether index should be in descending order or not. This property only makes sense if `index()` property is set to `true`.
      Returns:
        `True` if field index should be in descending order.
      Default:
        false

  - - #### notNull

          public abstract boolean notNull

      Specifies whether the specified field can be `null`.
      Returns:
        `True` if the field is not allowed to accept `null` values.
      Default:
        false

  - - #### precision

          public abstract int precision

      Specifies field precision for variable length types - decimal, string and byte array.
      Returns:
        field precision for variable length types - decimal, string and byte array.
      Default:
        -1

  - - #### scale

          public abstract int scale

      Specifies scale for a decimal field.
      Returns:
        scale for a decimal field.
      Default:
        -1

  - - #### groups

          public abstract String[] groups

      Array of index groups this field belongs to. Groups are used for compound indexes, whenever index should be created on more than one field. All fields within the same group will belong to the same index.

      Group indexes are needed because SQL engine can utilize only one index per table occurrence in a query. For example if we have two separate indexes on fields `a` and `b` of type `X` then query `select * from X where a = ? and b = ?` will use for filtering either index on field `a` or `b` but not both. For more effective query execution here it is preferable to have a single group index on both fields.

      For more complex scenarios please refer to `QuerySqlField.Group` documentation.

      Returns:
        Array of group names.
      Default:
        {}

  - - #### orderedGroups

          public abstract QuerySqlField.Group[] orderedGroups

      Array of ordered index groups this field belongs to. For more information please refer to QuerySqlField.Group documentation.
      Returns:
        Array of ordered group indexes.
      See Also:
        `groups()`
      Default:
        {}

  - - #### name

          public abstract String name

      Property name. If not provided then field name will be used.
      Returns:
        Name of property.
      Default:
        ""

  - - #### inlineSize

          public abstract int inlineSize

      Index inline size in bytes. When enabled part of indexed value will be placed directly to index pages, thus minimizing data page accesses, thus incraesing query performance.

      Allowed values:

      - `-1` (default) - determine inline size automatically (see below)
      - `0` - index inline is disabled (not recommended)
      - positive value - fixed index inline
      When set to `-1`, Ignite will try to detect inline size automatically. It will be no more than `CacheConfiguration.getSqlIndexMaxInlineSize()`. Index inline will be enabled for all fixed-length types, but will not be enabled for `String`.

      When index group is used, inline size must be defined in `QueryGroupIndex.inlineSize()`. Any value except of `-1` defined on a specific column will lead to exception.

      Returns:
        Index inline size in bytes.
      Default:
        -1

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022