-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add InfluxDB Connector #24220
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
Open
k3rnL
wants to merge
3
commits into
trinodb:master
Choose a base branch
from
k3rnL:k3rnl/influxdb-connector
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add InfluxDB Connector #24220
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| # InfluxDB connector | ||
|
|
||
| The InfluxDB Connector allows access to [InfluxDB](https://www.influxdata.com/) data from Trino. | ||
| This document describes how to setup the InfluxDB Connector to run SQL queries against InfluxDB. | ||
|
|
||
| ## Requirements | ||
|
|
||
| To connect to InfluxDB, you need: | ||
|
|
||
| * InfluxDB v1.8.0 or higher.(v2.x not currently supported) | ||
| * Network access from the Trino coordinator and workers to InfluxDB. | ||
| Port 8086 is the default port. | ||
|
|
||
| ## Configuration | ||
|
|
||
| To configure the InfluxDB connector, create a catalog properties file | ||
| `etc/catalog/example.properties` with the following contents, | ||
| replacing the properties as appropriate: | ||
|
|
||
| ```properties | ||
| connector.name=influxdb | ||
| influx.endpoint=http://localhost:8086 | ||
| influx.username=username | ||
| influx.password=password | ||
| ``` | ||
|
|
||
| ### Configuration properties | ||
|
|
||
| The following configuration properties are available: | ||
|
|
||
| | Property name | Description | Default | | ||
| |---------------|-------------|---------| | ||
| | `influx.endpoint` | Endpoint of the InfluxDB server to connect to. This property is required. | | | ||
| | `influx.username` | User name to use to connect to InfluxDB. | | | ||
| | `influx.password` | Password to use to connect to InfluxDB. | | | ||
| | `influx.connect-timeout` | The socket connect timeout to InfluxDB server. | `10s` | | ||
| | `influx.write-timeout` | The socket write timeout to InfluxDB server. | `10s` | | ||
| | `influx.read-timeout` | The socket read timeout to InfluxDB server. | `60s` | | ||
|
|
||
| (influxdb-type-mapping)= | ||
|
|
||
| ## Type mapping | ||
|
|
||
| Because Trino and InfluxDB each support types that the other does not, this | ||
| connector [maps some types](type-mapping-overview) when reading data. | ||
|
|
||
| ### InfluxDB type to Trino type mapping | ||
|
|
||
| The connector maps InfluxDB types to the corresponding Trino types | ||
| according to the following table: | ||
|
|
||
| | InfluxDB type | Trino type | Notes | | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use |
||
| |---------------|------------|-------| | ||
| | `TIMESTAMP` | `TIMESTAMP` | `Timestamp` key `time` is unix nanosecond timestamp in influxdb. see [data types](https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_reference/#data-types). | | ||
| | `BOOLEAN` | `BOOLEAN` | | | ||
| | `FLOAT` | `DOUBLE` | `FLOAT` is 64-bit floating-point numbers in influxdb. see [data types](https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_reference/#data-types). | | ||
| | `INTEGER` | `BIGINT` | `INTEGER` is 64-bit integers in influxdb. see [data types](https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_reference/#data-types). | | ||
| | `STRING` | `VARCHAR` | | | ||
|
|
||
| No other types are supported. | ||
|
|
||
| ## SQL support | ||
|
|
||
| The connector provides [globally available](sql-globally-available) and | ||
| [read operation](sql-read-operations) statements to access data and | ||
| metadata in the InfluxDB catalog. | ||
|
|
||
| Creation and deletion of schemas are supported. | ||
| As InfluxDB does not support creation of empty tables, creation of tables is not supported but deletion of tables is supported. | ||
|
|
||
| (influxdb-pushdown)= | ||
|
|
||
| ### Pushdown support | ||
|
|
||
| The connector supports pushdown for a number of operations: | ||
|
|
||
| * [limit-pushdown](limit-pushdown) | ||
| * [projection-pushdown](projection-pushdown) | ||
| * [predicate-pushdown](predicate-pushdown) | ||
|
|
||
| But there are some special limitations for predicate-pushdown: | ||
|
|
||
| To understand easily, think a measurement "student" in influxdb | ||
|
|
||
| ```text | ||
| SHOW TAG KEYS: | ||
| tagKey | ||
| ------ | ||
| grade | ||
| class | ||
|
|
||
| SHOW FIELD KEYS: | ||
| fieldKey fieldType | ||
| -------- --------- | ||
| name string | ||
| age integer | ||
| score float | ||
| ``` | ||
|
|
||
| Predicate pushdown of keys of `STRING`, `BOOLEAN`, `INTEGER` and `FLOAT` types are supported: | ||
|
|
||
| For `TIMESTAMP` key, supports equality predicates `=`, range predicates, such as `>`, `<`. | ||
|
|
||
| For keys of `STRING` or `BOOLEAN` type (both tag set and field keys in InfluxDB), supports equality predicates `=` only. | ||
|
|
||
| For keys of `INTEGER` or `FLOAT` type (field keys in InfluxDB), supports | ||
| equality predicates `=`, inequality predicates `!=`, and range predicates, such as `>`, `<`, or `BETWEEN`. | ||
|
|
||
| ```{note} | ||
| Decimal integer literals `int_lit = ("1"…"9"){digit}` pushdown works, hexadecimal and octal literals are not currently supported. | ||
| Floating-point literals `float_lit = int_lit"."int_lit` pushdown works, exponents are not currently supported. | ||
| ``` | ||
|
|
||
| ```sql | ||
| -- Not pushed down | ||
| SELECT * FROM student WHERE name > 'CLOUD'; | ||
| SELECT * FROM student WHERE score <> 1.0E2; | ||
| -- Pushed down | ||
| SELECT * FROM student WHERE name = 'CLOUD'; | ||
| SELECT * FROM student WHERE name != 'CLOUD'; | ||
| SELECT * FROM student WHERE age > 12 and age < 14; | ||
| SELECT * FROM student WHERE score > 80.0 and score != 100; | ||
| SELECT * FROM student WHERE time >= timestamp '2020-01-01 00:00:00' and time <= timestamp '2020-01-01 23:59:59'; | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,251 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-root</artifactId> | ||
| <version>477-SNAPSHOT</version> | ||
| <relativePath>../../pom.xml</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>trino-influxdb</artifactId> | ||
| <packaging>trino-plugin</packaging> | ||
| <description>Trino - InfluxDB Connector</description> | ||
|
|
||
| <properties> | ||
| <air.compiler.fail-warnings>true</air.compiler.fail-warnings> | ||
| <air.main.basedir>${project.parent.basedir}</air.main.basedir> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.google.guava</groupId> | ||
| <artifactId>guava</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.google.inject</groupId> | ||
| <artifactId>guice</artifactId> | ||
| <classifier>classes</classifier> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.squareup.okhttp3</groupId> | ||
| <artifactId>logging-interceptor</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.squareup.okhttp3</groupId> | ||
| <artifactId>okhttp-jvm</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>bootstrap</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>configuration</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>json</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>log</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>units</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-plugin-toolkit</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>jakarta.annotation</groupId> | ||
| <artifactId>jakarta.annotation-api</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>jakarta.validation</groupId> | ||
| <artifactId>jakarta.validation-api</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.influxdb</groupId> | ||
| <artifactId>influxdb-java</artifactId> | ||
| <version>2.23</version> | ||
| <exclusions> | ||
| <exclusion> | ||
| <groupId>com.squareup.okhttp3</groupId> | ||
| <artifactId>logging-interceptor</artifactId> | ||
| </exclusion> | ||
| <exclusion> | ||
| <groupId>com.squareup.okhttp3</groupId> | ||
| <artifactId>okhttp</artifactId> | ||
| </exclusion> | ||
| </exclusions> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-annotations</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>slice</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.opentelemetry</groupId> | ||
| <artifactId>opentelemetry-api</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.opentelemetry</groupId> | ||
| <artifactId>opentelemetry-context</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-spi</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.openjdk.jol</groupId> | ||
| <artifactId>jol-core</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-databind</artifactId> | ||
| <scope>runtime</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>node</artifactId> | ||
| <scope>runtime</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>configuration-testing</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>http-server</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>junit-extensions</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>testing</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-client</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-main</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-main</artifactId> | ||
| <type>test-jar</type> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-spi</artifactId> | ||
| <type>test-jar</type> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-testing</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-testing-services</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino</groupId> | ||
| <artifactId>trino-tpch</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.trino.tpch</groupId> | ||
| <artifactId>tpch</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.assertj</groupId> | ||
| <artifactId>assertj-core</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-api</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter-engine</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.testcontainers</groupId> | ||
| <artifactId>influxdb</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.testcontainers</groupId> | ||
| <artifactId>testcontainers</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| </dependencies> | ||
| </project> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap at 80 characters. Same for other places.