Trino ADB connector configuration

This article describes configuration parameters of the Trino connector for ADB.

ADB catalog parameters

The following configuration parameters can be set when you create a Trino catalog for working with an ADB cluster. These properties can be specified using ADCM or within the WITH clause, for example:

CREATE CATALOG test_adb_catalog USING adb
WITH (
  "connection-url" = 'jdbc:postgresql://<adb_master>:5432/trino',
  ...
  "configuration_param1" = "value"
  "configuration_param2" = "value"
);
Configuration parameter Description Default value

adb.fetch-size

The maximum number of rows to fetch. If not set, the value is calculated using the formula:

 — 

adb.array-mapping

The type of array mapping for the array data type. Possible values: DISABLED, AS_ARRAY

DISABLED

adb.enable-string-pushdown-with-collate

Enables string pushdown with collate

false

adb.include-system-tables

Indicates whether to include system tables

false

adb.max-scan-parallelism

The maximum level of parallelism for scanning tables

1

adb.connector.write-buffer-size

The maximum amount of memory allocated per sink for write queries

64MB

adb.connector.read-buffer-size

The maximum amount of memory allocated per record cursor for read queries

64MB

adb.connector.gpfdist.retry-timeout

The value of the ADB gpfdist_retry_timeout property. If not set, the ADB default value is used

 — 

adb.connector.gp-parallel-cursor.enabled

Enables gp-parallel-cursor for unloading data

false

ADB table properties

The following ADB table properties can be set using the WITH clause of the CREATE TABLE/CREATE TABLE AS commands. The properties described below are NULL by default. This means that if a property is not set when creating a table via the connector, the ADB cluster default values will be used.

Table property Description

distributed

Specifies a way to distribute table records, which does not depend on specific columns. Valid values are randomly and replicated. For the hash distribution type, use the distributed_by property

distributed_by

Specifies the hash distribution of table entries. The value must be an array of column names, for example ARRAY['col1', 'col2']

appendoptimized

If set to true, the connector creates an append-optimized table. Setting false creates a heap table

blocksize

Sets the block size for append-optimized tables in bytes

orientation

Sets the orientation for append-optimized tables. Valid values are column and row

checksum

Setting true enables CRC checksum for append-optimized tables

compresstype

Specifies the data compression algorithm. Valid values are zlib, zstd, rle_type, and none. The actual support for specific algorithms depends on the ADB version

compresslevel

Sets the compression level. Valid values vary for each compression algorithm:

  • zlib: 1 — 9;

  • zstd: 1 — 19;

  • rle_type: 1 — 4.

fillfactor

Sets a fill factor for heap tables. Valid values: from 10 to 100

An example of setting ADB table properties is below.

CREATE TABLE nations (
  n_nationkey integer,
  n_name char(25),
  n_regionkey integer,
  n_comment varchar(152)
)
WITH (
  distributed_by = ARRAY['nationkey', 'regionkey'], (1)
  appendoptimized = true, (2)
  orientation = 'columnar', (3)
  compresstype = 'zstd' (4)
)
1 Specifies the hash distribution by several columns.
2 Sets the append-optimized table type.
3 Sets the orientation to be columnar.
4 Specifies the compression using the ZSTD algorithm.

Data types mapping

When exchanging data between ADB and the Trino connector, the data types are mapped according to the following rules.

ADB to Trino types mapping

 

ADB type Trino type

BIT

BOOLEAN

BOOLEAN

BOOLEAN

SMALLINT

SMALLINT

INTEGER

INTEGER

BIGINT

BIGINT

REAL

REAL

DOUBLE

DOUBLE

NUMERIC(p, s)

DECIMAL(p, s)

DECIMAL(p, s) is an alias of NUMERIC(p, s)

CHAR(n)

CHAR(n)

VARCHAR(n)

VARCHAR(n)

ENUM

VARCHAR

BYTEA

VARBINARY

DATE

DATE

TIME(n)

TIME(n)

TIMESTAMP(n)

TIMESTAMP(n)

TIMESTAMPTZ(n)

TIMESTAMP(n) WITH TIME ZONE

MONEY

VARCHAR

UUID

UUID

JSON

JSON

JSONB

JSON

HSTORE

MAP(VARCHAR, VARCHAR)

ARRAY

DISABLED, ARRAY

For more information, see ARRAY type processing

Trino to ADB types mapping

 

ADB type Trino type

BOOLEAN

BOOLEAN

SMALLINT

SMALLINT

TINYINT

SMALLINT

INTEGER

INTEGER

BIGINT

BIGINT

REAL

REAL

DOUBLE

DOUBLE

DECIMAL(p, s)

NUMERIC(p, s)

DECIMAL(p, s) is an alias of NUMERIC(p, s)

CHAR(n)

CHAR(n)

VARCHAR(n)

VARCHAR(n)

VARBINARY

BYTEA

DATE

DATE

TIME(n)

TIME(n)

TIMESTAMP(n)

TIMESTAMP(n)

TIMESTAMP(n) WITH TIME ZONE

TIMESTAMPTZ(n)

UUID

UUID

JSON

JSONB

ARRAY

ARRAY

For more information, see ARRAY type processing

Type mapping configuration

The following configuration parameters can be used to change the type casting logic.

Configuration parameter Description Default value

unsupported-type-handling

Defines how to process columns of unsupported types. The possible values:

  • IGNORE — the column is ignored.

  • CONVERT_TO_VARCHAR — convert the column value to VARCHAR of unlimited length. The corresponding session parameter is unsupported_type_handling.

IGNORE

jdbc-types-mapped-to-varchar

Defines a list of source data types to be forcibly cast to VARCHAR of unlimited length (even if the specified type is supported by the connector). For example, jdbc-types-mapped-to-varchar=VARBINARY,UUID,

 — 

DECIMAL type processing

By default, the connector throws an error for columns of the DECIMAL type without an explicit precision or scale definition. If the decimal-mapping connector configuration parameter (or the decimal_mapping session parameter) is set to allow_overflow, then columns of the DECIMAL type without explicit precision/scale will be converted to the connector DECIMAL(38,0) data type. Using the decimal-default-scale connector configuration parameter (or the decimal_default_scale session parameter), you can specify a custom scale value. The precision value is always 38.

If a DECIMAL value does not fit into the specified precision and scale without rounding, the connector throws an error. You can change this behavior by enabling automatic rounding using the decimal-rounding-mode connector parameter (or the decimal_rounding_mode session parameter). The supported rounding values are UNNECESSARY (default), UP, DOWN, CEILING, FLOOR, HALF_UP, HALF_DOWN, and HALF_EVEN. These values correspond to the rounding behavior rules as of Java 17.

ARRAY type processing

The ADB ARRAY data type does not support fixed-dimensional arrays, while the Trino connector for ADB only supports one-dimensional arrays. You can instruct the connector how to handle the ARRAY types using the adb.array-mapping connector configuration parameter (the array_mapping session parameter). The supported values are:

  • DISABLED (default) — throws an error when processing columns of the ARRAY type.

  • AS_ARRAY — the connector treats ADB arrays as the ARRAY data type. This value is suitable for ADB arrays, which are actually one-dimensional. For a multi-dimensional array, an exception will be thrown.

Found a mistake? Seleсt text and press Ctrl+Enter to report it