Filesystem connector

The Filesystem connector reads files from a directory and writes files to a directory. The files are partitioned in directories, and each file has the format that you set in the table.

Object storage on Anywhere Cloud

On Anywhere Cloud, use the connector with object storage. The engine includes the filesystem plugins for Amazon S3, Google Cloud Storage, and Azure Blob Storage, and you use a path with the scheme of the storage, such as s3://.

A path with the file:// scheme refers to the filesystem of a pod of the engine. The files are lost when the pod restarts. Use such a path only to try out a table. A path with the hdfs:// scheme works only if the job can reach a Cloudera Base on premises cluster. For more information, see Using Cloudera Base Connector in the Anywhere Cloud documentation.

The following example writes JSON files to a bucket:

CREATE TABLE orders_archive (
  order_id STRING,
  price DECIMAL(10, 2),
  order_time TIMESTAMP(3)
) WITH (
  'connector' = 'filesystem',
  'path' = 's3://<bucket>/orders/',
  'format' = 'json'
);

Mandatory properties

Table 1. Mandatory properties of the Filesystem connector
PropertyDescription
connectorfilesystem
pathThe path of the root directory of the table. There is no default value.
formatThe format of the files. The templates exist for Avro, CSV, JSON, ORC, and Parquet.

Optional properties

Table 2. Optional properties of the Filesystem connector
PropertyDescription
sink.rolling-policy.file-sizeThe size at which a sink closes a file. The default is 128 MB.
sink.rolling-policy.rollover-intervalThe time after which a sink closes a file. The default is 30 minutes.
sink.rolling-policy.check-intervalHow often the sink checks the rollover time. The default is 1 minute.
auto-compactionWhether the sink combines small files after a checkpoint. The default is false.
sink.partition-commit.triggerWhen a partition is complete. The default is process-time.
sink.partition-commit.delayHow long the sink waits before it commits a partition. The default is 0 seconds.
sink.partition-commit.success-file.nameThe name of the file that marks a committed partition. The default is _SUCCESS.
sink.shuffle-by-partition.enableWhether the sink groups rows by partition, to write fewer files. The default is false.

For the full list of options, see FileSystem SQL connector in the Apache Flink documentation.