10 Using the Parquet Event Handler
Learn how to use the Parquet Event Handler to load files generated by the File Writer Handler into HDFS.
10.1 Overview
The Parquet Event Handler enables you to generate data files in Parquet format. Parquet files can be written to either the local file system or directly to HDFS. Parquet is a columnar data format that can substantially improve data retrieval times and improve the performance of Big Data analytics, see https://parquet.apache.org/.
Parent topic: Using the Parquet Event Handler
10.2 Detailing the Functionality
- Configuring the Parquet Event Handler to Write to HDFS
- About the Upstream Data Format
- Using Templated Strings
Parent topic: Using the Parquet Event Handler
10.2.1 Configuring the Parquet Event Handler to Write to HDFS
The Apache Parquet framework supports writing directly to HDFS. The Parquet Event Handler can write Parquet files directly to HDFS. These additional configuration steps are required:
The Parquet Event Handler dependencies and considerations are the same as the HDFS Handler, see HDFS Additional Considerations.
Set the writeToHDFS
property to true
:
gg.eventhandler.parquet.writeToHDFS=true
Ensure that gg.classpath
includes the HDFS client libraries.
Ensure that the directory containing the HDFS core-site.xml
file is in gg.classpath
. This is so the core-site.xml
file can be read at runtime and the connectivity information to HDFS can be resolved. For example:
gg.classpath=/{HDFS_install_directory}/etc/hadoop
If Kerberos authentication is enabled on the HDFS cluster, you have to configure the Kerberos principal and the location of the keytab
file so that the password can be resolved at runtime:
gg.eventHandler.name.kerberosPrincipal=principal
gg.eventHandler.name.kerberosKeytabFile=path_to_the_keytab_file
Parent topic: Detailing the Functionality
10.2.2 About the Upstream Data Format
The Parquet Event Handler can only convert Avro Object Container File (OCF) generated by the File Writer Handler. The Parquet Event Handler cannot convert other formats to Parquet data files. The format of the File Writer Handler must be avro_row_ocf
or avro_op_ocf
, see Using the File Writer Handler.
Parent topic: Detailing the Functionality
10.2.3 Using Templated Strings
Templated strings can contain a combination of string constants and keywords that are dynamically resolved at runtime. The Parquet Event Handler makes extensive use of templated strings to generate the HDFS directory names, data file names, and HDFS bucket names. This gives you the flexibility to select where to write data files and the names of those data files.
Supported Templated Strings
Keyword | Description |
---|---|
${fullyQualifiedTableName} |
The fully qualified source table name delimited by a period ( |
${catalogName} |
The individual source catalog name. For example, |
${schemaName} |
The individual source schema name. For example, |
${tableName} |
The individual source table name. For example, |
${groupName} |
The name of the Replicat process (with the thread number appended if you’re using coordinated apply). |
${emptyString} |
Evaluates to an empty string. For example, |
${operationCount} |
The total count of operations in the data file. It must be used either on rename or by the event handlers or it will be zero ( |
${insertCount} |
The total count of insert operations in the data file. It must be used either on rename or by the event handlers or it will be zero ( |
${updateCount} |
The total count of update operations in the data file. It must be used either on rename or by the event handlers or it will be zero ( |
${deleteCount} |
The total count of delete operations in the data file. It must be used either on rename or by the event handlers or it will be zero ( |
${truncateCount} |
The total count of truncate operations in the data file. It must be used either on rename or by the event handlers or it will be zero ( |
${currentTimestamp} |
The current timestamp. The default output format for the date time is
This format uses the syntax defined in the Java |
${toUpperCase[]} |
Converts the contents inside the square brackets to uppercase. For example, |
${toLowerCase[]} |
Converts the contents inside the square brackets to lowercase. For example, |
Configuration of template strings can use a mix of keywords and static strings to assemble path and data file names at runtime.
Parent topic: Detailing the Functionality
10.3 Configuring the Parquet Event Handler
You configure the Parquet Event Handler operation using the properties file. These properties are located in the Java Adapter properties file (not in the Replicat properties file).
The Parquet Event Handler works only in conjunction with the File Writer Handler.
To enable the selection of the Parquet Event Handler, you must first configure the
handler type by specifying gg.eventhandler.name.type=parquet
and the other Parquet Event properties as follows:
Table 10-1 Parquet Event Handler Configuration Properties
Properties | Required/ Optional | Legal Values | Default | Explanation |
---|---|---|---|---|
|
Required |
|
None |
Selects the Parquet Event Handler for use. |
|
Optional |
|
|
Set to |
|
Required |
A string with resolvable keywords and constants used to dynamically generate the path to write generated Parquet files. |
None |
Use keywords interlaced with constants to dynamically generate a unique path names at runtime. Typically, path names follow the format, |
|
Optional |
A string with resolvable keywords and constants used to dynamically generate the Parquet file name at runtime |
None |
Sets the Parquet file name. If not set, the upstream file name is used. |
|
Optional |
|
|
Sets the compression codec of the generated Parquet file. |
|
Optional |
|
|
Indicates what the Parquet Event Handler should do at the finalize action. |
|
Optional |
|
The Parquet default. |
Set to |
|
Optional |
|
The Parquet default. |
Set to |
|
Optional |
Integer |
The Parquet default. |
Sets the Parquet dictionary page size. |
|
Optional |
Integer |
The Parquet default. |
Sets the Parquet padding size. |
|
Optional |
Integer |
The Parquet default. |
Sets the Parquet page size. |
|
Optional |
Integer |
The Parquet default. |
Sets the Parquet row group size. |
|
Optional |
The Kerberos principal name. |
None |
Set to the Kerberos principal when writing directly to HDFS and Kerberos authentication is enabled. |
|
Optional |
The path to the Keberos |
The Parquet default. |
Set to the path to the Kerberos |
|
Optional |
A unique string identifier cross referencing a child event handler. |
No event handler configured. |
The event handler that is invoked on the file roll event. Event handlers can do file roll event actions like loading files to S3, converting to Parquet or ORC format, or loading files to HDFS. |
gg.eventhandler.name.writerVersion |
Optional | v1|v2 |
The Parquet library default
which is up through Parquet version 1.11.0 is
v1 .
|
Allows the ability to set the Parquet writer version. |
Parent topic: Using the Parquet Event Handler