Skip to content

Adding dialect to the common connector ? #23

Description

@pashandor789

Hey there! We're in @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.

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions