> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ocient.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Types for User-Defined Data Pipeline Functions

export const Unix = "Unix®";

export const Ocient = "Ocient®";

This description provides the {Ocient} packages that support the functionality for user-defined data pipeline functions.

## Classes

### `com.ocient.streaming.schema.OcientColumnType`

The class that enumerates all defined column types in the Ocient System.

| **Enum Value**       |
| -------------------- |
| `TYPE_NONE`          |
| `TYPE_INFERRED`      |
| `TYPE_DELETED`       |
| `TYPE_INT`           |
| `TYPE_BIGINT`        |
| `TYPE_FLOAT`         |
| `TYPE_DOUBLE`        |
| `TYPE_VARCHAR`       |
| `TYPE_IPV4`          |
| `TYPE_TIMESTAMP`     |
| `TYPE_DATE`          |
| `TYPE_BOOLEAN`       |
| `TYPE_BINARY`        |
| `TYPE_SMALLINT`      |
| `TYPE_BYTE`          |
| `TYPE_UUID`          |
| `TYPE_HASH`          |
| `TYPE_IP`            |
| `TYPE_ST_POINT`      |
| `TYPE_TIME`          |
| `TYPE_DECIMAL`       |
| `TYPE_ARRAY`         |
| `TYPE_TUPLE`         |
| `TYPE_ST_LINESTRING` |
| `TYPE_ST_POLYGON`    |

### `com.ocient.streaming.schema.OcientColumnTypeArguments`

The class that describes arguments of a column type. Not all column types require arguments.

| **Modifier And Type**                           | **Field and Description**                                                            |
| ----------------------------------------------- | ------------------------------------------------------------------------------------ |
| `public static final OcientColumnTypeArguments` | `NONE` — A default instance indicating no arguments are necessary for a column type. |

### `com.ocient.streaming.schema.OcientColumnTypeArguments.Decimal`

A subclass of `OcientColumnTypeArguments` that includes information for `TYPE_DECIMAL`.

| **Modifier And Type** | **Field and Description**                                                                                                                  |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `public int`          | `precision` — The number of digits in a number.                                                                                            |
| `public int`          | `scale` — The number of digits to the right of the decimal point in a number.                                                              |
| `public boolean`      | `fullFormat` — True if the serialized format includes one byte for precision and one byte for scale. You should always set this to `true`. |

| **Constructor**                                                                                                                                              |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `public Decimal(int precision, int scale, boolean fullFormat)` Constructs a newly allocated `OcientColumnTypeArguments` for `OcientColumnType.TYPE_DECIMAL`. |

### `com.ocient.streaming.schema.OcientColumnTypeArguments.Hash`

A subclass of `OcientColumnTypeArguments` that includes information for `TYPE_HASH`.

| **Modifier And Type** | **Field and Description**                         |
| --------------------- | ------------------------------------------------- |
| `public int`          | `length` — The number of bytes in the hash value. |

| **Constructor**                                                                                                        |
| ---------------------------------------------------------------------------------------------------------------------- |
| `public Hash(int length)` — Constructs a newly allocated `OcientColumnTypeArguments` for `OcientColumnType.TYPE_HASH`. |

### `com.ocient.streaming.schema.OcientColumnTypeArguments.Array`

A subclass of `OcientColumnTypeArguments` that includes information for `TYPE_ARRAY`.

| **Modifier And Type**              | **Field and Description**                                           |
| ---------------------------------- | ------------------------------------------------------------------- |
| `public OcientColumnType`          | `elementType` — The array element type.                             |
| `public OcientColumnTypeArguments` | `elementTypeArguments` — Type arguments for the array element type. |

| **Constructor**                                                                                                                                                                                                                                       |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public Array(OcientColumnType elementType)` — Constructs a newly allocated `OcientColumnTypeArguments`for an array of `elementType`. The `elementTypeArguments` field initializes to `OcientColumnTypeArguments.NONE`.                               |
| `public Array(OcientColumnType elementType, OcientColumnTypeArguments elementTypeArguments, int offsetSizeOverride)` — Constructs a newly allocated `OcientColumnTypeArguments`for an array of `elementType`. You should set `offsetOverride` to `0`. |

### `com.ocient.streaming.schema.OcientColumnTypeArguments.TopLevelTuple`

A subclass of tuple that includes information for top-level tuples.

| **Modifier And Type**        | **Field and Description**                             |
| ---------------------------- | ----------------------------------------------------- |
| `private List<OcientColumn>` | `elementOcientColumns` — List of tuple element types. |

| **Modifier And Type**                    | **Method and Description**                                                                         |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `public List<OcientColumnTypeArguments>` | `getTupleTypeArguments()` — Returns the list of tuple element type arguments.                      |
| `public List<OcientColumnType>`          | `getTupleTypes()` — Returns the list of tuple element types.                                       |
| `public List<OcientColumn>`              | `getElementOcientColumns()` — Returns the list of tuple element types paired with their arguments. |

| **Constructor**                                                                                                                                                 |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public TopLevelTuple(List<OcientColumn> elementOcientColumns)` — Constructs a newly allocated `OcientColumnTypeArguments` for a `OcientColumnType.TYPE_TUPLE`. |

### `com.ocient.streaming.schema.OcientColumn`

Represents an Ocient column with information parsed from metadata of the Ocient System.

| **Modifier And Type**              | **Method and Description**                                                                                                                                                                                                                        |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public String`                    | `name()` — The name of the column.                                                                                                                                                                                                                |
| `public OcientColumnType`          | `type()` — The data type of the column.                                                                                                                                                                                                           |
| `public OcientColumnTypeArguments` | `typeArguments()` — Some column types, for example `Decimal`, have arguments that are required to fully understand their format. A relevant subclass of `OcientColumnTypeArguments` returns, as appropriate, or `OcientColumnTypeArguments.NONE`. |
| `public boolean`                   | `required()` — Returns `true` if the user is required to provide this column. This is generally the case for non-defaulted, non-nullable columns.                                                                                                 |
| `public boolean`                   | `nullable()` — Returns true if this column is configured as nullable, false otherwise.                                                                                                                                                            |

### `com.ocient.streaming.data.types.gis.Coordinate`

Represents a two-dimensional cartesian coordinate.

| **Modifier And Type** | **Field and Description**            |
| --------------------- | ------------------------------------ |
| `public double`       | `x` — The x coordinate of the point. |
| `public double`       | `y` — The y coordinate of the point. |

| **Modifier And Type** | **Method and Description**                      |
| --------------------- | ----------------------------------------------- |
| `public double`       | `x()` — Returns the x coordinate of this point. |
| `public double`       | `y()` — Returns the y coordinate of this point. |

| **Constructor**                                                                    |
| ---------------------------------------------------------------------------------- |
| `public Coordinate(double x, double y)` — Constructs a newly allocated Coordinate. |

### `com.ocient.streaming.data.types.gis.STPoint`

Represents a two-dimensional cartesian coordinate.

| **Modifier And Type** | **Field and Description**                            |
| --------------------- | ---------------------------------------------------- |
| `public Coordinate`   | `coordinate` — The ordered, x and y coordinate pair. |

| **Modifier And Type**   | **Method and Description**                                                                                                                                                    |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public static STPoint` | `fromWKT(String text)` — Parses an `STPoint` from the WKT text.                                                                                                               |
| `public static STPoint` | `fromEWKT(String text)` — Parses an `STPoint` from the EWKT text.                                                                                                             |
| `public double`         | `getX()` — Returns the x coordinate of this point.                                                                                                                            |
| `public double`         | `getY()` — Returns the y coordinate of this point.                                                                                                                            |
| `public STLinestring`   | `toLinestring()` — Promotes the `STPoint` to an `STLinestring` container. Useful when representing a geometry collection consisting of `STLinestring` and `STPoint` elements. |
| `public STPolygon`      | `toPolygon()` — Promotes the `STPoint` to an `STPolygon` container. Useful when representing a geometry collection consisting of any geospatial element type.                 |

| **Constructor**                                                                   |
| --------------------------------------------------------------------------------- |
| `public STPoint(Coordinate coordinate)` — Constructs a newly allocated `STPoint`. |

### `com.ocient.streaming.data.types.gis.STLinestring`

Geometric type that is composed of a sequence of N points.

| **Modifier And Type** | **Field and Description**                                    |
| --------------------- | ------------------------------------------------------------ |
| `public STPoint[]`    | `points` — The ordered sequence of points in the linestring. |

| **Modifier And Type**        | **Method and Description**                                                                                                                                         |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `public static STLinestring` | `fromWKT(String text)` — Parses an `STLinestring` from the WKT text.                                                                                               |
| `public static STLinestring` | `fromEWKT(String text)` — Parses an `STLinestring` from the EWKT text.                                                                                             |
| `public STPoint[]`           | `points()` — Returns the points of this linestring.                                                                                                                |
| `public STLinestring`        | `toLinestring()` — Returns `this`.                                                                                                                                 |
| `public STPolygon`           | `toPolygon()` — Promotes the `STLinestring` to an `STPolygon` container. Useful when representing a geometry collection consisting of any geospatial element type. |

| **Constructor**                                                                        |
| -------------------------------------------------------------------------------------- |
| `public STLinestring(STPoint[] points)` — Constructs a newly allocated `STLinestring`. |

### `com.ocient.streaming.data.types.gis.STPolygon`

Geometric type composed of N closed linestrings.

| **Modifier And Type**   | **Field and Description**                            |
| ----------------------- | ---------------------------------------------------- |
| `public STLinestring`   | `exteriorRing` — The exterior ring of the polygon.   |
| `public STLinestring[]` | `interiorRings` — The interior rings of the polygon. |

| **Modifier And Type**        | **Method and Description**                                          |
| ---------------------------- | ------------------------------------------------------------------- |
| `public static STLinestring` | `fromWKT(String text)` — Parses an `STPolygon` from the WKT text.   |
| `public static STLinestring` | `fromEWKT(String text)` — Parses an `STPolygon` from the EWKT text. |
| `public STLinestring`        | `exteriorRing()` — Returns the exterior linestring.                 |
| `public STLinestring[]`      | `interiorRings()` — Returns the interior linestrings.               |
| `public STPolygon`           | `toPolygon()` — Returns `this`.                                     |

| **Constructor**                                                                                                         |
| ----------------------------------------------------------------------------------------------------------------------- |
| `public STPolygon(STLinestring exteriorRing, STLinestring[] interiorRings)` — Constructs a newly allocated `STPolygon`. |

### `com.ocient.streaming.data.types.Timestamp`

Timestamp represented as nanoseconds from the {Unix} epoch.

| **Modifier And Type** | **Method and Description**                                          |
| --------------------- | ------------------------------------------------------------------- |
| `public long`         | `value()` — Returns the number of nanoseconds after the Unix epoch. |

| **Constructor**                                                                     |
| ----------------------------------------------------------------------------------- |
| `public Timestamp(long nanosFromEpoch)` — Constructs a newly allocated `Timestamp`. |

### `com.ocient.streaming.data.types.Time`

Time that is represented as nanoseconds from midnight (`00:00:00`).

| **Modifier And Type** | **Method and Description**                                    |
| --------------------- | ------------------------------------------------------------- |
| `public long`         | `value()` — Returns the number of nanoseconds after midnight. |

| **Constructor**                                                              |
| ---------------------------------------------------------------------------- |
| `public Time(long nanosFromMidnight)` — Constructs a newly allocated `Time`. |

### `com.ocient.streaming.data.types.Decimal`

A class representing a decimal number with binary-coded decimal (BCD) storage, supporting specified precision and scale.

| **Modifier And Type** | **Field and Description**                                          |
| --------------------- | ------------------------------------------------------------------ |
| `public static long`  | `MAX_PRECISION` — The maximum supported precision in the database. |

| **Modifier And Type**   | **Method and Description**                                                                                                                                                                                                                                                                                                                                                                                                |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public static Decimal` | `fromString(String s, byte precision, byte scale)`<br />Creates a `Decimal` object from a string representation with the specified precision and scale.<ul><li>`s` — The string representation of the decimal (e.g., `"123.45"`, `"-0.1"`).</li><li>`precision` — The precision (total number of digits) of the decimal.</li><li>`scale` — The scale (number of digits after the decimal point) of the decimal.</li></ul> |
| `public static Decimal` | `fromBigDecimal(java.math.BigDecimal d, byte precision, byte scale)`<br />Creates a `Decimal` object from a `BigDecimal`, ensuring compatibility with the specified precision and scale.<ul><li>`d` — The `BigDecimal` to convert.</li><li>`precision` — The precision (total number of digits) of the decimal.</li><li>`scale` — The scale (number of digits after the decimal point) of the decimal.</li></ul>          |
| `public static Decimal` | `fromDouble(double d, byte precision, byte scale)`<br />Creates a `Decimal` object from a double value with the specified precision and scale.<ul><li>`d` — The double to convert.</li><li>`precision` — The precision (total number of digits) of the decimal.</li><li>`scale` — The scale (number of digits after the decimal point) of the decimal.</li></ul>                                                          |
| `public String`         | `toString()` — Returns the `Decimal` string representation of this `Decimal`.                                                                                                                                                                                                                                                                                                                                             |
| `public long`           | `asLong()` — Converts this `Decimal` object to a long, truncating any fractional part.                                                                                                                                                                                                                                                                                                                                    |
| `public double`         | `asDouble()` — Converts this `Decimal` object to a double, preserving the full value including the fractional part.                                                                                                                                                                                                                                                                                                       |
| `public byte[]`         | `bcd()` — Returns the BCD representation of this `Decimal` object.                                                                                                                                                                                                                                                                                                                                                        |
| `public byte[]`         | `getFullFormat()` — Returns the full format representation, including precision and scale bytes followed by the BCD data padded to `MAX_PRECISION`.                                                                                                                                                                                                                                                                       |
| `public int`            | `precision()` — Returns the precision of this `Decimal` object.                                                                                                                                                                                                                                                                                                                                                           |
| `public int`            | `scale()` — Returns the scale of this `Decimal` object.                                                                                                                                                                                                                                                                                                                                                                   |

### `com.ocient.streaming.data.types.OcientTuple`

A class representing a tuple with a defined schema of column types and associated values. Supports fixed-length and variable-length elements.

| **Modifier And Type**                    | **Method and Description**                                                                                                                                                                                                                                              |
| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public int`                             | `numValues()` — Returns the number of values currently stored in this tuple.                                                                                                                                                                                            |
| `public void`                            | `setValue(int index, Object value)`<br />Sets or updates the value at the specified index, ensuring type compatibility.<ul><li>`index` — The index of the value to set (0-based).</li><li>`value` — The value to set must match the column type at the index.</li></ul> |
| `public void`                            | `set(List<Object> values)`<br />Sets or resets all values in the tuple from the provided list.<ul><li>`values` — The list of values to set must match the schema size and types.</li></ul>                                                                              |
| `public String`                          | `toString()` — Returns a string representation of this tuple, including its schema and values (e.g., `"TUPLE<INT,DOUBLE>(1,2.0)"`).                                                                                                                                     |
| `public List<Object>`                    | `get()` — Returns the list of values in this tuple, in order.                                                                                                                                                                                                           |
| `public List<OcientColumnType>`          | `getTypes()` — Returns the list of column types defining the schema of this tuple, in order.                                                                                                                                                                            |
| `public List<OcientColumnTypeArguments>` | `getTypeArgs()` — Returns the list of type arguments corresponding to the column types of this tuple, in order.                                                                                                                                                         |

| **Constructor**                                                                                                                                                                                                                                                                                                                                             |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public OcientTuple(List<OcientColumnType> types, List<OcientColumnTypeArguments> typeArgs)`<br />Constructs an empty tuple with the specified schema of column types and type arguments.<ul><li>`types` — The list of column types defining the tuple schema.</li><li>`typeArgs` — The list of type arguments corresponding to each column type.</li></ul> |

## Related Links

[CREATE OR REPLACE PIPELINE FUNCTION](/data-pipelines#create-pipeline-function)
