Skip to content

Add documentation on constraint enforcements #16309

Open
@davisp

Description

@davisp

Is your feature request related to a problem or challenge?

A lack documentation on table constraint enforcement makes it difficult for TableProvider authors to have a clear view on when or how TableConstraints might or might not be enforced.

Describe the solution you'd like

Currently there's no good documentation on how DataFusion handles (or rather, doesn't handle) table constraints like primary key, foreign key, or uniqueness. I think it'd be a good idea do have documentation on what DataFusion does or does not enforce (i.e., nullness is enforced, but not uniqueness) as well as hopefully adding common suggestions on how various storage engines have implemented constraints.

I think it'd also likely be useful to have other background like this comment that mention how constraints aren't considered in optimizations while something like distinct count is. The subtle point is that folks might assume that telling datafusion something is a primary key or unique doesn't necessarily mean the optimizer will trust that.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions