Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to call udf without schema validation #15155

Open
uhlarmarek opened this issue Mar 19, 2024 · 0 comments · May be fixed by #20202
Open

option to call udf without schema validation #15155

uhlarmarek opened this issue Mar 19, 2024 · 0 comments · May be fixed by #20202
Labels
enhancement New feature or an improvement of an existing feature

Comments

@uhlarmarek
Copy link

uhlarmarek commented Mar 19, 2024

Description

Im trying to use SqlContext with custom function registry. Registration of function to registry looks like this:

registry.register(
            "isnull",
            UserDefinedFunction::new(
                "isnull",
                vec![
                    Field::new("id", DataType::Int32),
                    Field::new("value", DataType::Int64),
                ],
                SpecialEq::new(Arc::new(IsNullReturnType::new())),
                IsNull::new(),
            ),
        );

Now it is not possible to use custom function for a series other than "id".
This works:

context
      .execute("SELECT isnull(id, 0) FROM Agents")
      .unwrap()
      .collect()
      .unwrap();

This will throw error:

context
      .execute("SELECT isnull(name, 0) FROM Agents")
      .unwrap()
      .collect()
      .unwrap();

The reason is that a logical expression is created by calling call method on UserDefinedFunction struct. This method validates args against input fields from UDF registration.

It would be very useful to have possibility to call UDF without schema validation using some flag in FunctionOptions struct.

@uhlarmarek uhlarmarek added the enhancement New feature or an improvement of an existing feature label Mar 19, 2024
@uhlarmarek uhlarmarek changed the title expose method to call udf without schema validation option to call udf without schema validation Mar 19, 2024
@Shoeboxam Shoeboxam linked a pull request Dec 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant