Skip to content

feat: Integrate Trino as a data source using sfu-db/connector-x#405

Open
vcknorket wants to merge 10 commits intoroapi:mainfrom
knorket:feat-trino-connector
Open

feat: Integrate Trino as a data source using sfu-db/connector-x#405
vcknorket wants to merge 10 commits intoroapi:mainfrom
knorket:feat-trino-connector

Conversation

@vcknorket
Copy link
Copy Markdown

This commit introduces support for Trino as a data source by updating the connector-x dependency and integrating its Trino capabilities.

Key changes include:

  1. Dependency Update:

    • Switched connectorx in columnq/Cargo.toml from the forked
      roapi/connector-x to the official sfu-db/connector-x
      (version 0.4.4-alpha.1).
    • Updated connectorx features to ["fptr", "src_trino", "dst_arrow"].
  2. Core Logic for Trino:

    • Added a Trino variant to the DatabaseLoader enum in
      columnq/src/table/database.rs.
    • Updated conditional compilation flags in columnq/src/table/database.rs
      to include database-trino.
    • In columnq/src/table/mod.rs:
      • Added Trino to the Extension enum and updated its From
        and TryFrom implementations.
      • Added a trino { table: Option<String> } variant to the
        TableLoadOption enum.
      • Updated TableLoadOption::extension() method.
      • Updated TableSource::parse_option() to recognize "trino" URIs.
      • Updated the main load() function to handle Trino.
    • Modified table name extraction in columnq/src/table/database.rs
      to support TableLoadOption::trino.
  3. Cargo Feature Flag:

    • Added database-trino = ["connectorx/src_trino"] to the
      [features] section in columnq/Cargo.toml.
    • Included database-trino in the database feature group.
  4. Testing:

    • Added a new test file columnq/tests/table_trino_test.rs.
    • This includes a basic compile-time and structural test for the
      Trino integration, conditional on the database-trino feature.
    • A comment in the test notes that full integration testing requires
      a live Trino instance and appropriate environment setup.

This integration allows you to specify Trino as a data source via URI or configuration, leveraging the capabilities of the underlying sfu-db/connector-x library.

This commit introduces support for Trino as a data source by updating
the connector-x dependency and integrating its Trino capabilities.

Key changes include:

1.  **Dependency Update:**
    *   Switched `connectorx` in `columnq/Cargo.toml` from the forked
        `roapi/connector-x` to the official `sfu-db/connector-x`
        (version `0.4.4-alpha.1`).
    *   Updated `connectorx` features to `["fptr", "src_trino", "dst_arrow"]`.

2.  **Core Logic for Trino:**
    *   Added a `Trino` variant to the `DatabaseLoader` enum in
        `columnq/src/table/database.rs`.
    *   Updated conditional compilation flags in `columnq/src/table/database.rs`
        to include `database-trino`.
    *   In `columnq/src/table/mod.rs`:
        *   Added `Trino` to the `Extension` enum and updated its `From`
            and `TryFrom` implementations.
        *   Added a `trino { table: Option<String> }` variant to the
            `TableLoadOption` enum.
        *   Updated `TableLoadOption::extension()` method.
        *   Updated `TableSource::parse_option()` to recognize "trino" URIs.
        *   Updated the main `load()` function to handle Trino.
    *   Modified table name extraction in `columnq/src/table/database.rs`
        to support `TableLoadOption::trino`.

3.  **Cargo Feature Flag:**
    *   Added `database-trino = ["connectorx/src_trino"]` to the
        `[features]` section in `columnq/Cargo.toml`.
    *   Included `database-trino` in the `database` feature group.

4.  **Testing:**
    *   Added a new test file `columnq/tests/table_trino_test.rs`.
    *   This includes a basic compile-time and structural test for the
        Trino integration, conditional on the `database-trino` feature.
    *   A comment in the test notes that full integration testing requires
        a live Trino instance and appropriate environment setup.

This integration allows you to specify Trino as a data source via
URI or configuration, leveraging the capabilities of the underlying
`sfu-db/connector-x` library.
Comment thread columnq/tests/table_trino_test.rs Outdated
// but avoid pulling in too much if it complicates things without a live server.

#[tokio::test]
async fn test_trino_loader_construction() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this test doesn't seem to do anything? I am okay with merging without a test if it's too much work to setup trio in the CI.

@houqp
Copy link
Copy Markdown
Member

houqp commented Jun 15, 2025

thanks for the contribution, but looks like the build is broken.

Copy link
Copy Markdown
Author

@vcknorket vcknorket left a comment

Choose a reason for hiding this comment

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

removed test

rusqlite version
rusqlite version update
Update get_arrow call to match connectorx API"
Enable Arrow 54 use 55
Revert the changes made
Update arrow version to be specific
@vcknorket
Copy link
Copy Markdown
Author

Seems like having issue with arrow version. sfu-db/connector does not use 55 yet but they they it will work but seems like the version is causing issues @houqp @tobyhede can you help here?

@houqp
Copy link
Copy Markdown
Member

houqp commented Jun 27, 2025

@vcknorket you will need to send an upstream PR to connector to bump their version of arrow to 55 first.

@vcknorket
Copy link
Copy Markdown
Author

vcknorket commented Jun 27, 2025 via email

@houqp
Copy link
Copy Markdown
Member

houqp commented Jun 29, 2025

@vcknorket you should be able to upgrade, I have don't that a few times in the past. Could you link me to the discussion?

@alefhsousa
Copy link
Copy Markdown

Hey @vcknorket do you continue working on it?

I'm using roapi for some scenarios here and now. Trino supports it, which is essential for us. If you aren't working on it, I'll clone this branch, add test scenarios, and validate it before merging this new feature into the product

@vcknorket
Copy link
Copy Markdown
Author

Will be great if you can help with this..and make the needed changes

@alefhsousa
Copy link
Copy Markdown

Nice, thank you for the faster reply haha

I'll work on it and return if there's news, thanks, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants