-
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
base: master
Are you sure you want to change the base?
Add InfluxDB Connector #24220
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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'; | ||
| ``` | ||
| 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> | ||
|
k3rnL marked this conversation as resolved.
|
||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.google.guava</groupId> | ||
| <artifactId>guava</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
|
Comment on lines
+24
to
+26
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. Add an empty line among dependencies. Same for others. |
||
| <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> | ||
|
k3rnL marked this conversation as resolved.
|
||
| <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> | ||
|
|
||
|
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. nit: Remove redundant empty line. |
||
| </dependencies> | ||
| </project> | ||
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.