Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature][Connector-V2] Support Druid Source & Sink #2937

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions docs/en/connector-v2/sink/Druid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Druid

> Druid sink connector

## Description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Write data to Apache Druid.


## Options

| name | type | required | default value |
| ----------------------- | -------- | -------- | ------------- |
| coordinator_url | `String` | yes | - |
| datasource | `String` | yes | - |
| columns | `List<String>` | yes| __time |
| timestamp_column | `String` | no | timestamp |
| timestamp_format | `String` | no | auto |
| timestamp_missing_value | `String` | no | - |

### coordinator_url [`String`]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


The URL of Coordinator service in Apache Druid.

### datasource [`String`]

The DataSource name in Apache Druid.

### columns [`List<String>`]

These columns that you want to write of Druid.

### timestamp_column [`String`]

The timestamp column name in Apache Druid, the default value is `timestamp`.

### timestamp_format [`String`]

The timestamp format in Apache Druid, the default value is `auto`, it could be:

- `iso`
- ISO8601 with 'T' separator, like "2000-01-01T01:02:03.456"

- `posix`
- seconds since epoch

- `millis`
- milliseconds since epoch

- `micro`
- microseconds since epoch

- `nano`
- nanoseconds since epoch

- `auto`
- automatically detects ISO (either 'T' or space separator) or millis format

- any [Joda DateTimeFormat](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html) string

### timestamp_missing_value [`String`]

The timestamp missing value in Apache Druid, which is used for input records that have a null or missing timestamp. The value of `timestamp_missing_value` should be in ISO 8601 format, for example `"2022-02-02T02:02:02.222"`.

## Example

### Simple

```hocon
DruidSink {
coordinator_url = "http://localhost:8081/"
datasource = "wikipedia"
columns = ["flags","page"]
}
```

### Specified timestamp column and format

```hocon
DruidSink {
coordinator_url = "http://localhost:8081/"
datasource = "wikipedia"
timestamp_column = "timestamp"
timestamp_format = "auto"
columns = ["flags","page"]
}
```

### Specified timestamp column, format and missing value

```hocon
DruidSink {
coordinator_url = "http://localhost:8081/"
datasource = "wikipedia"
timestamp_column = "timestamp"
timestamp_format = "auto"
timestamp_missing_value = "2022-02-02T02:02:02.222"
columns = ["flags","page"]
}
```

54 changes: 54 additions & 0 deletions docs/en/connector-v2/source/Druid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Druid

> Druid source connector

## Description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the Sink document.


Read data from Apache Druid.

## Options

| name | type | required | default value |
| ---------- | -------------- | -------- | ------------- |
| url | `String` | yes | - |
| datasource | `String` | yes | - |
| start_date | `String` | no | - |
| end_date | `String` | no | - |
| columns | `List<String>` | no | `*` |

### url [`String`]

The URL of JDBC of Apache Druid.

### datasource [`String`]

The DataSource name in Apache Druid.

### start_date [`String`]

The start date of DataSource, for example, `'2016-06-27'`, `'2016-06-27 00:00:00'`, etc.

### end_date [`String`]

The end date of DataSource, for example, `'2016-06-28'`, `'2016-06-28 00:00:00'`, etc.

### columns [`List<String>`]

These columns that you want to write of DataSource.

### common options [string]

Source Plugin common parameters, refer to [Source Plugin](common-options.mdx) for details


## Example

```hocon
DruidSource {
url = "jdbc:avatica:remote:url=http://localhost:8082/druid/v2/sql/avatica/"
datasource = "wikipedia"
start_date = "2016-06-27 00:00:00"
end_date = "2016-06-28 00:00:00"
columns = ["flags","page"]
}
```
2 changes: 2 additions & 0 deletions plugin-mapping.properties
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ seatunnel.sink.Sentry = connector-sentry
seatunnel.source.MongoDB = connector-mongodb
seatunnel.sink.MongoDB = connector-mongodb
seatunnel.source.Iceberg = connector-iceberg
seatunnel.source.Druid=connector-druid
seatunnel.sink.Druid=connector-druid
43 changes: 43 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@
<snappy-java.version>1.1.8.3</snappy-java.version>
<checker.qual.version>3.10.0</checker.qual.version>
<awaitility.version>4.2.0</awaitility.version>
<httpclient.version>4.5.13</httpclient.version>
<fastjson.version>1.2.83</fastjson.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please manager the jars which used by connector in connector pom.xml like other connector.

<avatica-core.version>1.17.0</avatica-core.version>
<druid-core.version>0.23.0</druid-core.version>
<joda-tim.version>2.10.14</joda-tim.version>
<druid.version>0.22.1</druid.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -350,6 +356,43 @@
<version>${awaitility.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest use jackson replace fastjson.

<version>${fastjson.version}</version>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-tim.version}</version>
</dependency>

<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-indexing-service</artifactId>
<version>${druid.version}</version>
</dependency>

<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-core</artifactId>
<version>${druid-core.version}</version>
</dependency>

<dependency>
<groupId>org.apache.calcite.avatica</groupId>
<artifactId>avatica-core</artifactId>
<version>${avatica-core.version}</version>
</dependency>

</dependencies>

</dependencyManagement>
Expand Down
55 changes: 55 additions & 0 deletions seatunnel-connectors-v2/connector-druid/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>seatunnel-connectors-v2</artifactId>
<groupId>org.apache.seatunnel</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>connector-druid</artifactId>

<properties>
<jackson-datatype-joda.version>2.6.7</jackson-datatype-joda.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.seatunnel</groupId>
<artifactId>connector-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson-datatype-joda.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-indexing-service</artifactId>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
<artifactId>druid-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.calcite.avatica</groupId>
<artifactId>avatica-core</artifactId>
</dependency>
</dependencies>

</project>
Loading