Data Formats for Data Pipelines
Loading in Ocient® differs in subtle ways that depend on the data format of the source. Loading runs with a strict interpretation of source data to allow pipelines to achieve maximum performance. For text-based formats like JSON and DELIMITED, the Ocient System performs no preemptive casting on the data when using a source field selector.
For example, with the JSON string { "my_field": 1234 }, the selector $my_field returns the string "1234" not the integer 1234.
When you use transformation functions, keep in mind that the Ocient System treats all data in the JSON and DELIMITED formats as text data.
While the Ocient System sends data you select to a final target column, the system automatically casts the data in the final step to ensure that the data is compatible with the target column type. See Data Types for Data Pipelines for supported automatic conversion rules.
Format-specific differences also appear in the pipelines.
Load ASN.1 Data
You can load data in ASN.1 (Abstract Syntax Notation One) format from binary-encoded ASN.1 files using DER-encoded or BER-encoded files. ASN.1 provides a flexible, schema-driven format commonly used in telecommunications, security, and standardized protocols. This format allows you to extract structured records and map them to relational tables using SQL.
The Ocient System requires .ber and .der files to contain one or more concatenated DER-encoded or BER-encoded values with the specified record type. The system decodes each record independently and maps it into a record.
ASN.1 Type Mapping
The system automatically converts all decoded ASN.1 fields to their JSON-equivalent representations.
The ASN.1 schema must consistently use implicit or explicit tagging. You must specify clear tagging so the system can resolve field names during extraction.
To access fields, use dot notation for access: $sequence.fieldName. For arrays (such as SEQUENCE OF), use bracket notation: $sequenceOf[].fieldElement.
Default values and optional fields follow standard ASN.1 rules. If you omit a field, the system evaluates it as NULL.
ASN.1 Loading Example
Assume you have the personnel_records.asn file in the ASN.1 data format. The file contains the definition of a personnel record Example.PersonnelRecord. The ASN.1 file contains data for the personnel record, child, personnel name, employee number of the personnel, and the date.
Create a table to contain the personnel record. The table contains a subset of the data:
first_name— First nameinitial— Initial of the middle namefamily_name— Last nametitle— Job titlenumber— Employee numberdate_of_hire— Hire date
Create the data pipeline personnel_pipeline to load the personnel record into the personnel_records table using an Amazon® Web Services℠ (AWS℠) S3 bucket. Specify the bucket, endpoint, access key identifier, secret access key, and filter options to find the ASN.1 DER-encoded file personnel_records.der in the specified file path. Use the URL file path http://cos/filepath/asn1/personnel_records.asn and record type Example.PersonnelRecord. Access the name sequence using dot notation for the first name, middle initial, and last name fields. The pipeline definition transforms the hire date to the 'yyyyMMdd' format.
Load Avro Data
The Ocient System enables you to load data in the Apache® Avro™ format. You can use a file-based source only. Load an inline schema definition or use a schema configuration. Use a schema inference from files with embedded schemas.
Field selectors in Avro follow the same format as selectors in JSON and Apache® Parquet™ formats.
Inline Schema
Specify a JSON string in the Avro schema format in the INLINE option of the schema definition of the CREATE PIPELINE SQL statement.
Inline schemas assume that all records follow the defined schema exactly. These schemas do not support schema evolution.
Schema Inference from a File
The system can infer the schema from a file that has embedded schemas. The file is a named object container file. Use the INFER_FROM option in the CREATE PIPELINE SQL statement to specify sampling one file.
Schema Evolution
When you create a data pipeline, the pipeline has a fixed target schema (specified by the SELECT clause). Individual files might have different schemas. The target schema must be backward-transitive compatible with the other schemas.
If the other schemas change, the system automatically attempts to fit data into the target schema. In this case, the other schemas must be forward compatible with the target schema. The system ignores changes to any unused fields from the target schema.
Multiple schemas impact the performance of the data pipeline execution. For best performance, use a single schema for all data.
Avro Type Mapping
The Ocient System converts these Avro data types to Ocient SQL types. This table shows the respective conversions.
Avro Loading Examples
Create the users table with these columns:
id— Universally Unique IDentifier (UUID) of the userfirstname— First name of the userlastname— Last name of the userbirthyear— Year of birthgroups— List of groups where the user belongs
These examples use this table as the target table for the load.
Load Avro Data from Files
Assume you have user data in Avro format in multiple files in the /data/users directory. Create the users_pipeline data pipeline for the Avro files *.avro containing user data. The schema configuration instructs the system to infer from one file using the INFER_FROM option. Access the array of strings for the groups column.
Load Avro Data from an Inline Schema Definition
Assume you have user data in Avro format in multiple files in the /data/users directory. Create the users_pipeline data pipeline for the Avro files *.avro containing user data. The schema configuration instructs the system to use an inline schema definition with the INLINE option. Access the array of strings for the groups column.
Load Binary Data
The Ocient System loads the binary data format using a fixed record length to split a binary stream into chunks that represent records. Each record is available in the SELECT portion of a pipeline definition using a special binary extract syntax $"[5,8]". This operates similarly to a substring function, beginning at byte 5 and taking 8 bytes from that location. The starting index is a 1-based offset, consistent with other SQL arrays and offsets. You can use this syntax to select specific bytes within a record to parse together as a unit.
Binary Selector
Example
The Binary Selector takes 8 bytes starting at offset 11 on the fixed-width binary record. Consistent with SQL functions in the Ocient System, the first argument value 11 is the 1-based offset into the byte array.
The Binary Selector returns BINARY data, not VARCHAR.
Special BINARY transformation functions can operate on this BINARY data. However, if you cast data to the VARCHAR type by using CHAR(), then functions like INT operate on this data as VARCHAR data, not binary data.
When you load binary data into VARCHAR columns, the Ocient System automatically converts from binary to character data using the configured CHARSET_NAME before final loading.
The Ocient System supports special transformation functions that operate uniquely on binary data. With these functions, you can convert binary representations from mainframe systems such as packed decimals, zoned decimals, big and little endian integers (signed and unsigned), and floating point values. For more details, see Binary Data Transformation Functions.
For a complete list of supported options for DELIMITED and CSV data formats, see Binary Extract Options.
Binary Loading Example
If each record in your fixed-width binary schema includes these fields, you can use the SUBSTRING function and the transforms shown in this example.
Each record includes 62 bytes, so the record length RECORD_LENGTH is 62. The encoding of this file is CP500 instead of the default IBM1047 code page. The CREATE PIPELINE SQL statement specifies this encoding.
This SQL statement:
- Uses the
BINARY SELECTORto extract names and load them into the respective columns. The Ocient System automatically decodes the values usingcp500and loads them into aVARCHARcolumn. An explicit cast such asCHAR($"[1, 20]") as first_nameworks equivalently. - Indicates the extraction of four bytes that represent age from bytes 41-44. The statement instructs the casting of these bytes as an integer
INT. This function uses the default endianness (big) and treats the bytes as signed. Unsigned values can overflow target columns because integral types are all signed. - Extracts the 10 bytes for
total_spentusing theBINARY SELECTOR, and converts the values using thepackeddecimal option for theDECIMALcast. The casting requires specifying the number of decimal points in the source data. In this case, there are 2 decimal points, which match the number in the target column. - Extracts the 8 bytes that represent
user_idusing theBINARY SELECTORand casts these bytes to aBIGINTwhile interpreting the bytes as unsigned with the little endian representation.
Load Delimited and CSV Data
When you load data from delimited or CSV files, the Ocient System tokenizes the data during loading. The system detects records and fields in the input data during pipeline execution. You can reference fields and use them in combination with transformation functions before the system stores values in the column of a target table.
Referencing fields of the source data for the formats happens by using a field index. The index is a number that follows the dollar sign $. To maintain consistency with SQL array semantics, the field indexes start at 1.
Reference the first field of tokenized source records for the DELIMITED and CSV formats as $1.
For the BINARY format, $0 represents the entire record. In this case, you must specify $0 in combination with the SUBSTRING function to extract specific bytes from the source data.
For a complete list of supported options for DELIMITED and CSV data format, see Delimited and CSV Extract Options.
Delimited Loading Example
Use this example delimited data.
For this example row, this table shows the field references for each value in the row.
To load this data in a pipeline with the DELIMITED data format, this CREATE PIPELINE statement specifies the | character for the field delimiter. This statement loads data into AWS S3. The SELECT statement uses fields 1, 2, 3, 5, and 6 of the source data. The statement specifies that the system should not load field 4 to the target table. Field 6 is an array of data matching the default array settings for delimited data. You can indicate this with the array brackets like $6[] to load into a CHAR[] typed column.
The outer casting functions in this example are optional and shown for completeness. If they are omitted, the pipeline automatically casts the source fields to the target column type.
Load JSON Data
The data pipeline syntax enables the load of JSON data, including nested scalars, arrays, and points ST_POINT.
Strict Loading and Transformations
When you use transformation functions, remember that the Ocient System treats all data in JSON and DELIMITED format as text data, not the logical data type.
For example, if you specify the JSON string { "my_timestamp": 1709208000000 }, the selector $my_timestamp returns the string "1709208000000" and not the integer 1709208000000.
As a result, if you cast this data into a timestamp column, such as TIMESTAMP($my_timestamp) as created_at, the Ocient System returns an error. The conversion fails because the cast function assumes you are specifying TIMESTAMP(VARCHAR), which assumes a format like YYYY-MM-DD HH🇲🇲ss[.SSSSSSSSS].
To correct this issue, cast the value explicitly to make use of the TIMESTAMP(BIGINT) function that treats the argument as milliseconds after the epoch as in TIMESTAMP(BIGINT($my_timestamp)) as created_at.
Supported JSON Selectors
JSON selectors consist of $ followed by a dot-separated list of JSON keys. If a key refers to an array, it is followed by a set of brackets [] to correspond to its dimensionality. If the square brackets contain an index, like [1], then the selector refers to an array element.
The Ocient System treats JSON selectors as lowercase. To use case-sensitive selectors, you must enclose the selector in double quotation marks. For example, $"testSelector". With case-sensitive selectors having multiple JSON keys, each key needs double quotation marks. For example, $"testData"."Responses"."SuccessResponse".
For special characters (any identifier that starts with any character other than a letter or contains any character that is not a letter, number, or an underscore) or reserved SQL keywords (such as SELECT), you must enclose such selectors in double quotation marks. For example, if you have a JSON document { "test-field": 123 }, then the selector for the query should be $"test-field".
The Ocient System does not support identifiers with a backslash as the last character in the key name.
This table shows the selector and provides its description. The cells in the last column of the table show an example for each selector. First, the cell shows example data in JSON format. Then, the cell shows the use of the selector and its output after the arrow.
For more examples of using JSON selectors in data pipelines, see JSON Selectors Examples in Data Pipelines.
NULL and Empty Handling for JSON Scalars
The Ocient System handles all JSON NULL, empty, and missing values in the same way. The system loads these values as NULL. These values fail to load into non-nullable columns.
Provide an explicit default in the pipeline using IF_NULL or COALESCE or use the COLUMN_DEFAULT_IF_NULL option to accept the configured column default instead of attempting to load NULL values.
NULL and Empty Handling for JSON Arrays
The Ocient System handles NULL, empty, and missing values the same way for arrays as for scalars. The system converts a value that is NULL, empty, or missing to NULL and loads it as NULL.
Provide an explicit default in the pipeline or use the COLUMN_DEFAULT_IF_NULL option to accept the configured column default instead of attempting to load NULL.
NULL and Empty Handling for JSON Tuples
All the rules for handling NULL, empty, and missing elements that apply to scalars and arrays also apply to tuples. If any part of the selector is NULL, empty, or missing, data pipeline loading converts that value to NULL.
Additionally, because you can apply functions to tuple elements (and not array elements), you can use the NULL_IF function to convert a tuple element to NULL. For example, tuple<<char,varchar>>($a.name, NULL_IF($a.hometown, 'N/A') ) indicates to the pipeline that the string 'N/A' signifies NULL for the hometown element but not for the name element.
Load Parquet Data
The data pipeline functionality enables loading Parquet files with this configuration.
File Configuration
- Files should have row groups of less than 128 MB. Larger row groups can impact memory usage during loading, and row groups of 512 MB can cause loading failures on 1 TB or more data sets.
- Encoding fields in a Parquet file reduces the space of the file on disk but can impact memory usage during loading. Enable encoding on fields that you expect to have less than 256 unique values and for fields that contain short strings. You do not have to encode other fields.
Multiple Files
- You can load row groups of multiple Parquet files in parallel. For large data sets, load the data set as multiple files.
- Loading files with differing schemas is not supported.
Use selectors as you do when loading JSON data to specify data to load.
You must select a leaf element, an array, or a tuple with your selector. This is stricter than using JSON selectors, which can directly select array fields and JSON object fields.
Example: {"a": [1,2,3], "b": {"c": 1}}
You can extract with any of the selectors in JSON: $a, $a[], $b, $b.c
However, Parquet only allows for the selectors: $a[], $b.c
This example assumes this schema:
The selector must be $my_list[], which includes the array syntax.
For details, see Parquet Selectors Examples in Data Pipelines.
When you use the FORMAT PARQUET option with an AWS S3 source, the ENDPOINT option is required in the CREATE PIPELINE SQL statement.
Auto-casting in Parquet does not support the automatic conversion to VARCHAR columns. You must explicitly cast data to the CHAR data type when you convert Parquet data that is not string data to a VARCHAR column or VARCHAR function argument.
Schema Evolution
The Ocient System supports schema evolution when you load a set of Parquet files. Specifically, if the pipeline selects a set of Parquet files where an individual file might have more or fewer columns than another, the system attempts to merge those schemas together to support loading without requiring you to create the pipeline again.
For example, the test_table table has three columns.
You have two Parquet files with these schemas:
However, you must specify how to handle the schema evolution within the EXTRACT SQL statement. You can choose to sample the first file only for its schema or sample the entire data set to merge the schemas together. This DDL statement samples on one file.
The disadvantage is that sampling multiple files can potentially take a long time (scaling with the number of files in the data set) when you execute the CREATE PIPELINE and START PIPELINE SQL statements. If you know that all of the Parquet files have the same schema, use this syntax.
The Ocient System does not support the case where a column within the schema changes type. For example, if col_a is an INT type in one file and a VARCHAR type in another.
The default behavior of schema evolution infers the schema from one file. Use this syntax to infer from one file.
Parquet Type Mapping
Parquet data types are separated into primitive and logical types. The Ocient System converts these types to Ocient SQL types. See these tables for the respective conversions.
- The
INTERVALdata type is not supported.- The
UINT64data type can overflow theBIGINTconversion. - The
DURATIONdata type conversion toBIGINTpreserves the underlying units. For example, the number of microseconds stays as microseconds in theBIGINTdata type.
- The
Further, Parquet contains nested types that the Ocient System also converts to SQL types, as shown in this table.
Parquet Loading Example
Create a data pipeline that loads Parquet files using an AWS S3 bucket. Specify the bucket, endpoint, access key identifier, secret access key, and filter options to find all Parquet files in the specified file path. Use the parquet_base_table table to store the loaded data. Retrieve the integer, text, floating point, double, integer, JSON, and BSON fields.
Parquet File-Partitioned Data
With Parquet, you can load file-partitioned data from Parquet files using the file path structure. Use the filter set in the file path using the Apache® Hive™ naming standards.
Assume files with these file paths.
Load the data values in the Parquet file partitions using the METADATA function with the Hive partition syntax and the specified partition key dt from the file paths.
For details about this syntax, see Load Metadata and File-Based Partitioned Data in Data Pipelines.
Load XML Data
You can load data in XML format into the Ocient System. The system supports XML tags, basic elements, nested elements, and CDATA, but it does not support XML arrays and attributes.
Supported XML Selectors
Like JSON selectors, you can select XML data using the $ symbol followed by a list of dot-separated JSON keys.
The system treats JSON selectors as lowercase. To use case-sensitive selectors, you must enclose the selector in double quotation marks, such as $"testSelector". With case-sensitive selectors having multiple JSON keys, each key needs double quotation marks, such as $"testData"."Responses"."SuccessResponse".
The system does not support JSON array and tuple selectors.
XML Loading Example
Assume an XML file with this data.
Create a table to contain the IP address record:
name— Namecity— Name of the cityzip— Zip codepersonal_ip— IP address
Create a data pipeline xml_pipeline that loads the XML file test.xml using an AWS S3 bucket. Specify the bucket, endpoint, access key identifier, secret access key, and filter options to find the XML file in the specified path. Use the example_xml table to store the loaded data. Use JSON selectors to parse the file and data in each XML tag.
The system parses the CDATA section in the note tag as the literal string Personal IP <b>127.0.0.1</b>. Use the SUBSTRING function to extract the IP address and then transform it into an IPV4 type with the IPV4 function. For details, see the SUBSTRING and IPV4 functions.
Related Links
JSON Selectors Examples in Data Pipelines
Load Metadata and File-Based Partitioned Data in Data Pipelines

