Skip to content

Ability to configure custom SQL parser dialects on session config #23109

Description

@Viicos

Is your feature request related to a problem or challenge?

With apache/datafusion-sqlparser-rs#2174, it is now possible to safely derive custom dialects from existing ones, without worrying about breaking hardcoded dialect_of! calls (apache/datafusion-sqlparser-rs#1430):

derive_dialect!(MyCustomDialect, PostgreSqlDialect,
    overrides = { 
        supports_from_first_select = true,
    },
    preserve_type_id = true,
);

Datafusion allows configuring the dialect in the SessionConfig, however only a fixed list of values is allowed.

Would it be possible to allow setting our own dialect instance in the config? Perhaps with a with_dialect() method on the SessionConfig?

There might be limitations I'm missing (e.g. the underlying SqlParserOptions might need to be serializable with atomic values, etc).

Describe the solution you'd like

No response

Describe alternatives you've considered

Extending the RelationPlanner: https://datafusion.apache.org/blog/2026/01/12/extending-sql/ (doesn't seem applicable).

Defining a custom SQL parser, but not clear how to configure DF to use it.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions