LocalFileSystem connector


LocalFileSystem connector

Parent document: Connectors

BitSail LocalFileSystem connector supports reading file from local file system.

The main function points are as follows:

  • Support batch read from single file(csv/json content type) at once.

Maven dependency

<dependency>
    <groupId>com.bytedance.bitsail</groupId>
    <artifactId>connector-localfilesystem</artifactId>
    <version>${revision}</version>
    <scope>provided</scope>
</dependency>

Supported data types

  • Basic data types supported:
    • Integer type:
      • tinyint
      • smallint
      • int
      • bigint
    • Float type:
      • float
      • double
      • decimal
    • Time type:
      • timestamp
      • date
    • String type:
      • string
      • varchar
      • char
    • Bool type:
      • boolean

Parameters

The following mentioned parameters should be added to job.reader block when using, for example:

{
  "job": {
    "reader": {
      "class": "com.bytedance.bitsail.connector.localfilesystem.source.LocalFileSystemSource",
      "file_path": "src/test/resources/data/csv/test.csv",
      "content_type": "csv",
      "columns": [
        {
          "name": "id",
          "type": "long"
        },
        {
          "name": "date",
          "type": "date"
        },
        {
          "name": "localdatetime_value",
          "type": "timestamp"
        },
        {
          "name": "last_name",
          "type": "string"
        },
        {
          "name": "bool_value",
          "type": "boolean"
        }
      ]
    }
  }
}

Necessary parameters

Param nameRequiredOptional valueDescription
classyesLocalFileSystem reader's class name, com.bytedance.bitsail.connector.localfilesystem.source.LocalFileSystemSource
file_pathyesThe storage path of local file to read
content_typeyescsv / jsonThe content type of local file to deserialize
columnsyesThe name and type of columns to read

Optional parameters(all, csv and json mean applicable content type)

Param nameRequiredOptional valueDescription
skip_first_line allnotrue / falsewhether to skip first line
convert_error_column_as_null allnotrue / falsewhether to treat error column as null when parsing
csv_delimiter csvnoindicate delimiter between two fields
csv_escape csvnoindicate arbitrary escape character
csv_quote csvnoindicate arbitrary quote character
csv_with_null_string csvnoindicate string literal treat as "null" object
csv_multi_delimiter_replace_char csvnoindicate multiple delimiter replacer
case_insensitive jsonnotrue / falsewhether to be insensitive to upper or lower case

Configuration examples: LocalFileSystem connector example