apache / apache/datafusion

Improve consistency and documentation on error handling in in UDFs

オープン
#11,618 コメント 12 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Rust
スター
9.3k
フォーク
2.4k
平均マージ
3日 11時間
マージ済み PR(30日)
360

説明

### Is your feature request related to a problem or challenge?

When writing a new UDF, a developer needs to decide how to perform error management in functions that return `Result`, such as `return_type` and `invoke`. Looking at the existing codebase it is not obvious what are the error management best practices

# Errors in return type
- Regexp like uses an `plan_err` data types of args do not match the expected types https://github.com/apache/datafusion/blob/77311a5896272c7ed252d8cd53d48ec6ea7c0ccf/datafusion/functions/src/regex/regexplike.rs#L74 . Is this check redundant?

- Except expects two arguments but doesn't check the length, just the type https://github.com/apache/datafusion/blob/77311a5896272c7ed252d8cd53d48ec6ea7c0ccf/datafusion/functions-array/src/except.rs#L55.

# Errors in invoke

In the resize function, there is a check on argument lengths in invoke which is not present in the `return_type` function
https://github.com/apache/datafusion/blob/77311a5896272c7ed252d8cd53d48ec6ea7c0ccf/datafusion/functions-array/src/resize.rs#L27

The same function also returns `exec_err`, and `internal_datafusion_err`

### Describe the solution you'd like

As a developers of custom UDF I would like to know:
- what errors I need to check for and what are already checked by the planner (number of arguments?)
- what type of errors need to be raised in which conditions

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、datafusion/functions/src/regex/regexplike.rs と datafusion/functions-array/src/except.rs および resize.rs の return_type と invoke を比較し、引数のチェックと報告されるエラーのバリアントに注目してください。planner の検証がこれらの関数とどのように関係するかを確認してください。期待されるチェックとエラー型を文書化し、一貫性に関する変更をテストでカバーすれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
documentation
issue の種類
ドキュメント
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。