Skip to content

Substrait integration doesn't recognize typed functions #10412

@Blizzara

Description

@Blizzara

Describe the bug

Since substrait-io/substrait#537, the standard has declared that functions must be named with compound names consisting of both the function and its types. For example, for the function "not", the full name would now be "not:bool". However trying to use "not:bool" in Substrait input for DataFusion results in
This feature is not implemented: Unsupported function name: \"not:bool\" as "not:bool" doesn't match into the list used by

if let Ok(op) = name_to_op(name) {

To Reproduce

Using e.g. isthmus from Substrait-java, one can produce a simple substrait:

substrait-java % ./isthmus-cli/build/graal/isthmus "select not d from t" -c "create table t (d boolean)"  --outputformat=BINARY | base64 
ChsIARIXL2Z1bmN0aW9uc19ib29sZWFuLnlhbWwSDhoMCAEaCG5vdDpib29sGkcSRQo7OjkKBRIDCgEBEhoKGAoCCgASDQoBRBIICgQKAhABGAI6AwoBVBoUGhIaBAoCEAEiChoIEgYKAhIAIgASBkVYUFIkMA==

(Drop the outputformat=BINARY | base64 to see the plan as text)

Then using DataFusion to execute that plan:

#[tokio::test]
async fn test_not() -> datafusion::common::Result<()> {
    let protobuf = general_purpose::STANDARD.decode("ChsIARIXL2Z1bmN0aW9uc19ib29sZWFuLnlhbWwSDhoMCAEaCG5vdDpib29sGkcSRQo7OjkKBRIDCgEBEhoKGAoCCgASDQoBRBIICgQKAhABGAI6AwoBVBoUGhIaBAoCEAEiChoIEgYKAhIAIgASBkVYUFIkMA==").unwrap();
    let ctx = SessionContext::new();
    ctx.register_csv("T", "tests/testdata/data.csv", CsvReadOptions::new())
        .await?;
    let plan = deserialize_bytes(protobuf).await?;
    let _ = from_substrait_plan(&ctx, plan.as_ref()).await?;
    Ok(())
}

Fails with Error: NotImplemented("Unsupported function name: \"not:bool\"")

Expected behavior

not:bool should be found and the plan be created correctly

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomerssubstraitChanges to the substrait crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions