org.apache.ignite.internal.visor.query

## Class VisorQueryUtils

- java.lang.Object
- - org.apache.ignite.internal.visor.query.VisorQueryUtils

    public class VisorQueryUtils
    extends Object

Contains utility methods for Visor query tasks and jobs.

### Field Summary

Fields
`static Integer` `RMV_DELAY` How long to store future with query in node local map: 5 minutes.
`static List<VisorQueryField>` `SCAN_COL_NAMES` Columns for SCAN queries.

### Constructor Summary

Constructors
Constructor and Description
`VisorQueryUtils()`

### Method Summary

All Methods Static Methods Concrete Methods
`static String` `binaryToString(BinaryObject obj)` Convert Binary object to string.
`static Object` `convertValue(Object original)` Convert object that can be passed to client.
`static List<Object[]>` `fetchQueryRows(Iterator itr, String qryId, int pageSize)` Fetch rows from query cursor.
`static List<Object[]>` `fetchScanQueryRows(Iterator itr, int pageSize)` Fetch rows from SCAN query future.
`static List<Object[]>` `fetchSqlQueryRows(Iterator itr, int pageSize)` Collects rows from sql query future, first time creates meta and column names arrays.
`static VisorQueryHolder` `getQueryHolder(IgniteEx ignite, String qryId)` Get holder for query or throw exception if not found.
`static void` `removeQueryHolder(IgniteEx ignite, String qryId)` Remove query holder from local storage for query with specified ID and cancel query if it is in progress.
`static void` `scheduleQueryHolderRemoval(IgniteEx ignite, String qryId)` Schedule clearing of query context by timeout.
`static void` `scheduleQueryStart(IgniteEx ignite, VisorQueryHolder holder, VisorQueryTaskArg arg, GridQueryCancel cancel)` Schedule start of SQL query execution.
`static void` `scheduleScanStart(IgniteEx ignite, VisorQueryHolder holder, VisorScanQueryTaskArg arg)` Schedule start of SCAN query execution.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### RMV_DELAY

    public static final Integer RMV_DELAY

How long to store future with query in node local map: 5 minutes.

#### SCAN_COL_NAMES

    public static final List<VisorQueryField> SCAN_COL_NAMES

Columns for SCAN queries.

### Constructor Detail

#### VisorQueryUtils

    public VisorQueryUtils()

### Method Detail

#### fetchScanQueryRows

    public static List<Object[]> fetchScanQueryRows(Iterator itr,
                                                    int pageSize)

Fetch rows from SCAN query future.

Parameters:
  `itr` - Result set iterator.
  `pageSize` - Number of rows to fetch.
Returns:
  Fetched rows.

#### binaryToString

    public static String binaryToString(BinaryObject obj)

Convert Binary object to string.

Parameters:
  `obj` - Binary object.
Returns:
  String representation of Binary object.

#### convertValue

    public static Object convertValue(Object original)

Convert object that can be passed to client.

Parameters:
  `original` - Source object.
Returns:
  Converted value.

#### fetchSqlQueryRows

    public static List<Object[]> fetchSqlQueryRows(Iterator itr,
                                                   int pageSize)

Collects rows from sql query future, first time creates meta and column names arrays.

Parameters:
  `itr` - Result set iterator.
  `pageSize` - Number of rows to fetch.
Returns:
  Fetched rows.

#### getQueryHolder

    public static VisorQueryHolder getQueryHolder(IgniteEx ignite,
                                                  String qryId)
                                           throws IgniteException

Get holder for query or throw exception if not found.

Parameters:
  `ignite` - IgniteEx instance.
  `qryId` - Query ID to get holder.
Returns:
  Query holder for specified query ID.
Throws:
  `IgniteException` - When holder is not found.

#### removeQueryHolder

    public static void removeQueryHolder(IgniteEx ignite,
                                         String qryId)

Remove query holder from local storage for query with specified ID and cancel query if it is in progress.

Parameters:
  `ignite` - IgniteEx instance.
  `qryId` - Query ID to get holder.

#### fetchQueryRows

    public static List<Object[]> fetchQueryRows(Iterator itr,
                                                String qryId,
                                                int pageSize)

Fetch rows from query cursor.

Parameters:
  `itr` - Result set iterator.
  `qryId` - Query ID.
  `pageSize` - Page size.

#### scheduleQueryStart

    public static void scheduleQueryStart(IgniteEx ignite,
                                          VisorQueryHolder holder,
                                          VisorQueryTaskArg arg,
                                          GridQueryCancel cancel)

Schedule start of SQL query execution.

Parameters:
  `ignite` - IgniteEx instance.
  `holder` - Query holder object.
  `arg` - Query task argument with query properties.
  `cancel` - Object to cancel query.

#### scheduleScanStart

    public static void scheduleScanStart(IgniteEx ignite,
                                         VisorQueryHolder holder,
                                         VisorScanQueryTaskArg arg)

Schedule start of SCAN query execution.

Parameters:
  `ignite` - IgniteEx instance.
  `holder` - Query holder object.
  `arg` - Query task argument with query properties.

#### scheduleQueryHolderRemoval

    public static void scheduleQueryHolderRemoval(IgniteEx ignite,
                                                  String qryId)

Schedule clearing of query context by timeout.

Parameters:
  `qryId` - Unique query result id.
  `ignite` - IgniteEx instance.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.14.0
Release Date | : September 29 2022