ClickHouse / ClickHouse/adbc_clickhouse

Implement remaining `IngestMode`s (and `OptionStatement::Temporary`)

Open
#59 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
25
Forks
8
Avg merge
2d 37m
Merged PRs (30d)
4

Description

In #58 I added support for `IngestMode::Append` as the default, since it maps to a straightforward `INSERT INTO FORMAT ArrowStream` statement.

Support for [the other variants of `IngestMode`](https://docs.rs/adbc_core/latest/adbc_core/options/enum.IngestMode.html) is going to be a little more involved, because we need to synthesize a `CREATE TABLE` statement.

We could _theoretically_ create a table and start inserting into it in one atomic statement if we implement a [`CREATE TABLE AS table_function()`](https://clickhouse.com/docs/sql-reference/statements/create/table#from-a-table-function) statement with the [`input()`](https://clickhouse.com/docs/sql-reference/table-functions/input) table function.

The annoying part is that `input()` expects a list of column names _and_ types, so we'd have to convert Arrow types to ClickHouse types with the same rules as ClickHouse server. I'm also a little worried about this limitation:

> This function can be used only in `INSERT SELECT` query

So otherwise, we'd need to issue two statements: a `CREATE [IF NOT EXISTS] [OR REPLACE] TABLE` statement, and then the regular `INSERT INTO` statement.

# Addendum

Once we have `CREATE TABLE` statement synthesis, supporting [`OptionStatement::Temporary`](https://docs.rs/adbc_core/latest/adbc_core/options/enum.OptionStatement.html#variant.Temporary) is trivial, so I've lumped that in with this task.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.