> For the complete documentation index, see [llms.txt](https://docs.selfuel.digital/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.selfuel.digital/data-integration-with-nexus/nexus-elements/connectors/source/ossjindofile.md).

# OssJindoFile

> OssJindo file source connector

### Key features[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#key-features) <a href="#key-features" id="key-features"></a>

* [x] &#x20;[batch](https://seatunnel.apache.org/docs/2.3.7/concept/connector-v2-features)
* [ ] &#x20;[stream](https://seatunnel.apache.org/docs/2.3.7/concept/connector-v2-features)
* [x] &#x20;exactly-once

Read all the data in a split in a pollNext call. What splits are read will be saved in snapshot.

* [ ] &#x20;column projection
* [x] &#x20;parallelism
* [ ] &#x20;support user-defined split
* [x] &#x20;file format type
  * [x] &#x20;text
  * [x] &#x20;csv
  * [x] &#x20;parquet
  * [x] &#x20;orc
  * [x] &#x20;json
  * [x] &#x20;excel
  * [x] &#x20;xml
  * [x] &#x20;binary

### Description[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#description) <a href="#description" id="description"></a>

Read data from aliyun oss file system using jindo api.

We made some trade-offs in order to support more file types, so we used the HDFS protocol for internal access to OSS and this connector need some hadoop dependencies. It only supports hadoop version **2.9.X+**.

### Options[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#options) <a href="#options" id="options"></a>

| name                         | type    | required | default value       |
| ---------------------------- | ------- | -------- | ------------------- |
| path                         | string  | yes      | -                   |
| file\_format\_type           | string  | yes      | -                   |
| bucket                       | string  | yes      | -                   |
| access\_key                  | string  | yes      | -                   |
| access\_secret               | string  | yes      | -                   |
| endpoint                     | string  | yes      | -                   |
| read\_columns                | list    | no       | -                   |
| delimiter/field\_delimiter   | string  | no       | \001                |
| parse\_partition\_from\_path | boolean | no       | true                |
| date\_format                 | string  | no       | yyyy-MM-dd          |
| datetime\_format             | string  | no       | yyyy-MM-dd HH:mm:ss |
| time\_format                 | string  | no       | HH:mm:ss            |
| skip\_header\_row\_number    | long    | no       | 0                   |
| schema                       | config  | no       | -                   |
| sheet\_name                  | string  | no       | -                   |
| xml\_row\_tag                | string  | no       | -                   |
| xml\_use\_attr\_format       | boolean | no       | -                   |
| file\_filter\_pattern        | string  | no       | -                   |
| compress\_codec              | string  | no       | none                |
| encoding                     | string  | no       | UTF-8               |
| common-options               |         | no       | -                   |

#### path \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#path-string) <a href="#path-string" id="path-string"></a>

The source file path.

#### file\_format\_type \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#file_format_type-string) <a href="#file_format_type-string" id="file_format_type-string"></a>

File type, supported as the following file types:

`text` `csv` `parquet` `orc` `json` `excel` `xml` `binary`

If you assign file type to `json`, you should also assign schema option to tell connector how to parse data to the row you want.

For example:

upstream data is the following:

```

{"code":  200, "data":  "get success", "success":  true}

```

You can also save multiple pieces of data in one file and split them by newline:

```

{"code":  200, "data":  "get success", "success":  true}
{"code":  300, "data":  "get failed", "success":  false}

```

you should assign schema as the following:

```

schema {
    fields {
        code = int
        data = string
        success = boolean
    }
}

```

connector will generate data as the following:

| code | data        | success |
| ---- | ----------- | ------- |
| 200  | get success | true    |

If you assign file type to `parquet` `orc`, schema option not required, connector can find the schema of upstream data automatically.

If you assign file type to `text` `csv`, you can choose to specify the schema information or not.

For example, upstream data is the following:

```

tyrantlucifer#26#male

```

If you do not assign data schema connector will treat the upstream data as the following:

| content               |
| --------------------- |
| tyrantlucifer#26#male |

If you assign data schema, you should also assign the option `field_delimiter` too except CSV file type

you should assign schema and delimiter as the following:

```

field_delimiter = "#"
schema {
    fields {
        name = string
        age = int
        gender = string 
    }
}

```

connector will generate data as the following:

| name          | age | gender |
| ------------- | --- | ------ |
| tyrantlucifer | 26  | male   |

If you assign file type to `binary`, Nexus can synchronize files in any format, such as compressed packages, pictures, etc. In short, any files can be synchronized to the target place. Under this requirement, you need to ensure that the source and sink use `binary` format for file synchronization at the same time. You can find the specific usage in the example below.

#### bucket \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#bucket-string) <a href="#bucket-string" id="bucket-string"></a>

The bucket address of oss file system, for example: `oss://tyrantlucifer-image-bed`

#### access\_key \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#access_key-string) <a href="#access_key-string" id="access_key-string"></a>

The access key of oss file system.

#### access\_secret \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#access_secret-string) <a href="#access_secret-string" id="access_secret-string"></a>

The access secret of oss file system.

#### endpoint \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#endpoint-string) <a href="#endpoint-string" id="endpoint-string"></a>

The endpoint of oss file system.

#### read\_columns \[list][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#read_columns-list) <a href="#read_columns-list" id="read_columns-list"></a>

The read column list of the data source, user can use it to implement field projection.

#### delimiter/field\_delimiter \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#delimiterfield_delimiter-string) <a href="#delimiterfield_delimiter-string" id="delimiterfield_delimiter-string"></a>

**delimiter** parameter will deprecate after version 2.3.5, please use **field\_delimiter** instead.

Only need to be configured when file\_format is text.

Field delimiter, used to tell connector how to slice and dice fields.

default `\001`, the same as hive's default delimiter

#### parse\_partition\_from\_path \[boolean][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#parse_partition_from_path-boolean) <a href="#parse_partition_from_path-boolean" id="parse_partition_from_path-boolean"></a>

Control whether parse the partition keys and values from file path

For example if you read a file from path `oss://hadoop-cluster/tmp/nexus/parquet/name=tyrantlucifer/age=26`

Every record data from file will be added these two fields:

| name          | age |
| ------------- | --- |
| tyrantlucifer | 26  |

Tips: **Do not define partition fields in schema option**

#### date\_format \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#date_format-string) <a href="#date_format-string" id="date_format-string"></a>

Date type format, used to tell connector how to convert string to date, supported as the following formats:

`yyyy-MM-dd` `yyyy.MM.dd` `yyyy/MM/dd`

default `yyyy-MM-dd`

#### datetime\_format \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#datetime_format-string) <a href="#datetime_format-string" id="datetime_format-string"></a>

Datetime type format, used to tell connector how to convert string to datetime, supported as the following formats:

`yyyy-MM-dd HH:mm:ss` `yyyy.MM.dd HH:mm:ss` `yyyy/MM/dd HH:mm:ss` `yyyyMMddHHmmss`

default `yyyy-MM-dd HH:mm:ss`

#### time\_format \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#time_format-string) <a href="#time_format-string" id="time_format-string"></a>

Time type format, used to tell connector how to convert string to time, supported as the following formats:

`HH:mm:ss` `HH:mm:ss.SSS`

default `HH:mm:ss`

#### skip\_header\_row\_number \[long][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#skip_header_row_number-long) <a href="#skip_header_row_number-long" id="skip_header_row_number-long"></a>

Skip the first few lines, but only for the txt and csv.

For example, set like following:

`skip_header_row_number = 2`

then Nexus will skip the first 2 lines from source files

#### schema \[config][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#schema-config) <a href="#schema-config" id="schema-config"></a>

Only need to be configured when the file\_format\_type are text, json, excel, xml or csv ( Or other format we can't read the schema from metadata).

**fields \[Config]**[**​**](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#fields-config)

The schema of upstream data.

#### sheet\_name \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#sheet_name-string) <a href="#sheet_name-string" id="sheet_name-string"></a>

Only need to be configured when file\_format is excel.

Reader the sheet of the workbook.

#### file\_filter\_pattern \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#file_filter_pattern-string) <a href="#file_filter_pattern-string" id="file_filter_pattern-string"></a>

Filter pattern, which used for filtering files.

#### compress\_codec \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#compress_codec-string) <a href="#compress_codec-string" id="compress_codec-string"></a>

The compress codec of files and the details that supported as the following shown:

* txt: `lzo` `none`
* json: `lzo` `none`
* csv: `lzo` `none`
* orc/parquet:\
  automatically recognizes the compression type, no additional settings required.

#### encoding \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#encoding-string) <a href="#encoding-string" id="encoding-string"></a>

Only used when file\_format\_type is json,text,csv,xml. The encoding of the file to read. This param will be parsed by `Charset.forName(encoding)`.

#### common options[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#common-options) <a href="#common-options" id="common-options"></a>

Source plugin common parameters, please refer to [Source Common Options](/data-integration-with-nexus/nexus-elements/connectors/source/source-common-options.md) for details.

### Example[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#example) <a href="#example" id="example"></a>

```

OssJindoFile {
    path = "/nexus/orc"
    bucket = "oss://tyrantlucifer-image-bed"
    access_key = "xxxxxxxxxxxxxxxxx"
    access_secret = "xxxxxxxxxxxxxxxxxxxxxx"
    endpoint = "oss-cn-beijing.aliyuncs.com"
    file_format_type = "orc"
  }

```

```

OssJindoFile {
    path = "/nexus/json"
    bucket = "oss://tyrantlucifer-image-bed"
    access_key = "xxxxxxxxxxxxxxxxx"
    access_secret = "xxxxxxxxxxxxxxxxxxxxxx"
    endpoint = "oss-cn-beijing.aliyuncs.com"
    file_format_type = "json"
    schema {
      fields {
        id = int 
        name = string
      }
    }
  }

```

#### Transfer Binary File[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/OssJindoFile#transfer-binary-file) <a href="#transfer-binary-file" id="transfer-binary-file"></a>

```

env {
  parallelism = 1
  job.mode = "BATCH"
}

source {
  OssJindoFile {
    bucket = "oss://tyrantlucifer-image-bed"
    access_key = "xxxxxxxxxxxxxxxxx"
    access_secret = "xxxxxxxxxxxxxxxxxxxxxx"
    endpoint = "oss-cn-beijing.aliyuncs.com"
    path = "/nexus/read/binary/"
    file_format_type = "binary"
  }
}
sink {
  // you can transfer local file to s3/hdfs/oss etc.
  OssJindoFile {
    bucket = "oss://tyrantlucifer-image-bed"
    access_key = "xxxxxxxxxxxxxxxxx"
    access_secret = "xxxxxxxxxxxxxxxxxxxxxx"
    endpoint = "oss-cn-beijing.aliyuncs.com"
    path = "/nexus/read/binary2/"
    file_format_type = "binary"
  }
}
```
