Skip to main content

Array Dims

Definition

The arrayDims method allows you to add the ARRAY_DIMS function to the query. The ARRAY_DIMS function is used to return a text representation of array's dimensions.

There are 2 ways to call this method:

1. Calling from a KColumn or a KTableColumn

The only one method available to use this functionality calling from a KColumn or a KTableColumn is:

  • arrayDims(): It does not receive any parameters. The KColumn or KTableColumn that invokes the method will be the one supplied to the ARRAY_DIMS function.

Example

Java code:

k
.select(
APP_USER.EMAIL.arrayAgg().arrayDims(),
APP_USER.CREATED_AT.cast(date())
)
.from(APP_USER)
.groupBy(APP_USER.CREATED_AT.cast(date()))
.multiple();

SQL generated:

SELECT
ARRAY_DIMS(ARRAY_AGG(au.email)),
CAST(au.created_at AS DATE)
FROM app_user au
GROUP BY CAST(au.created_at AS DATE)

Parameters:

  • None

2. Calling from the KFunction class

The only one method available to use this functionality calling from the KFunction class is:

  • arrayDims(KColumn kColumnArray): Receives a KColumn or a KTableColumn which will be supplied to the ARRAY_DIMS function.

To use this way, you need to import the static functions as follows:

import static com.myzlab.k.KFunction.*;

Example

Java code:

k
.select(
arrayDims(arrayAgg(APP_USER.EMAIL)),
APP_USER.CREATED_AT.cast(date())
)
.from(APP_USER)
.groupBy(APP_USER.CREATED_AT.cast(date()))
.multiple();

SQL generated:

SELECT
ARRAY_DIMS(ARRAY_AGG(au.email)),
CAST(au.created_at AS DATE)
FROM app_user au
GROUP BY CAST(au.created_at AS DATE)

Parameters:

  • None