Skip to content

LogicalPlan Casts can't express a cast to an extension type #18060

@paleolimbot

Description

@paleolimbot

Is your feature request related to a problem or challenge?

The current Expr::Cast can't represent a cast to an extension type because it uses DataType as the target:

/// Cast expression
#[derive(Clone, PartialEq, Eq, PartialOrd, Hash, Debug)]
pub struct Cast {
/// The expression being cast
pub expr: Box<Expr>,
/// The `DataType` the expression will yield
pub data_type: DataType,
}

I noticed this in #17986 because a FieldRef is a way to support extension types like UUID in SQL but this information will get dropped when constructing the logical plan.

(I'd personally love this so that we can support casting to GEOMETRY/GEOGRAPHY in SedonaDB)

Describe the solution you'd like

Update the internal representation of the Cast to use a FieldRef or add an Option<FieldMetadata> to it so that it can express the operation of casting to an arbitrary type.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions