influxdata / influxdata/datafusion-udf-wasm

Allow DataFusion type casts for Python inputs

Open
#167 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
20
Forks
3
Avg merge
6h 20m
Merged PRs (30d)
24

Description

# What
Allow DataFusion to automatically insert type casts for Python inputs.

# Why
Currently we emit [`TypeSignature::Exact`](https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.TypeSignature.html#variant.Exact) which requires users to pass exactly the types we need. That's a bit annoying for integers though, since we treat Python's `int` as unsigned and users would have to explicitly cast the inputs for unsigned data. We should probably emit [`TypeSignature::Coercible`](https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.TypeSignature.html#variant.Coercible) instead.

# How
This is likely gonna interact with #161. Also we need to check if the variants of [`TypeSignatureClass`](https://docs.rs/datafusion/latest/datafusion/logical_expr/enum.TypeSignatureClass.html) are sufficient or if we need to implement a WIT bridge for [`LogicalType`](https://docs.rs/datafusion/latest/datafusion/common/types/trait.LogicalType.html) as well.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the current use of TypeSignature::Exact and the related TypeSignatureClass handling, then read issue #161 for interaction details. Check whether the existing TypeSignatureClass variants can represent Python-input coercion or whether a WIT bridge for LogicalType is needed. Done means DataFusion can automatically coerce the relevant Python inputs without requiring explicit casts.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.