duckdb / duckdb/database-connector

Adding dialect to the common connector ?

Open
#23 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5
Forks
3
Avg merge
38m
Merged PRs (30d)
7

Description

Hey there! We're in [@serenedb ](https://github.com/serenedb/serenedb) making now a clickhouse-connector and i find this repository very useful for the feature.

I've found that this code is used fully by duckdb-postgres and partially by duckdb-mysql. Also i've found that some postgres specific code is written here, for instance it always add COLLATE "C" to filter for postgres-duckdb compatible.

```cpp
string FilterPushdown::TransformConstantFilter(const query::QueryWriter::Config &constant_config,
const string &column_name, ExpressionType comparison_type,
const Value &constant, column_t column_id) {
string constant_string;
if (IsVirtualColumn(column_id)) {
return "FALSE";
} else {
constant_string = query::QueryWriter::WriteConstant(constant_config, constant);
}
auto operator_string = TransformComparison(comparison_type);
string comparison = StringUtil::Format("%s %s %s", column_name, operator_string, constant_string);
if (constant.type().id() == LogicalTypeId::VARCHAR) {
comparison += " COLLATE \"C\""; // <-- unconditional: every string filter, every engine
}
return comparison;
}
```

Are you gonna rewrite other connectors to reuse this code and have you considered adding maybe dialect enum here?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with FilterPushdown::TransformConstantFilter and trace how the shared code is used by duckdb-postgres and duckdb-mysql. Compare the connector-specific assumptions, including the unconditional COLLATE "C" behavior, with the proposed ClickHouse use case. Done means documenting or implementing an agreed dialect approach and confirming which connectors can reuse it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.