Hi all,

We are designing a Trino–IoTDB(TableModel) connector based on the Trino 435 
SPI, with code compatibility for newer Trino versions.

The connector will support both querying IoTDB data and writing data to IoTDB. 
Filter, projection, limit, TopN, and compatible aggregation operations will be 
pushed down when semantics are equivalent. Unsupported push-down functions 
remain in the Trino execution plan, other common functions will be translated 
and executed by IoTDB; IoTDB-specific functions can be executed through the 
iotdb.system.query table function.

## Query


For queries, IoTDB values are converted to Trino types.


| **IoTDB Type** | **Trino Type** |
|---|---|
| `BOOLEAN` | `BOOLEAN` |
| `INT32` | `INTEGER` |
| `INT64` | `BIGINT` |
| `FLOAT` | `REAL` |
| `DOUBLE` | `DOUBLE` |
| `STRING` / `TEXT` | `VARCHAR` |
| `BLOB` | `VARBINARY` |
| `DATE` | `DATE` |
| `TIMESTAMP` | `TIMESTAMP(3/6/9)` |
| `OBJECT` (Enterprise Edition only) | `VARCHAR` |


The connector preserves Trino-visible types and null semantics. Timestamp 
precision is mapped according to the IoTDB configuration:


- `TIMESTAMP(3)`: millisecond precision
- `TIMESTAMP(6)`: microsecond precision
- `TIMESTAMP(9)`: nanosecond precision


## Write


For writes, Trino values are converted to IoTDB types.


| **Trino Type** | **IoTDB Type** |
|---|---|
| `BOOLEAN` | `BOOLEAN` |
| `TINYINT` / `SMALLINT` / `INTEGER` | `INT32` |
| `BIGINT` | `INT64` |
| `REAL` | `FLOAT` |
| `DOUBLE` | `DOUBLE` |
| `CHAR` / `VARCHAR` | `STRING` |
| `VARBINARY` | `BLOB` |
| `DATE` | `DATE` |
| `TIMESTAMP(p)` | `TIMESTAMP` |
Timestamp precision is also mapped according to the IoTDB configuration.


Best regards,  
Weihao Li

Reply via email to