You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/28 06:50:49 UTC

[GitHub] [arrow-datafusion] Ted-Jiang commented on a diff in pull request #2177: User Defined Table Function (udtf) support

Ted-Jiang commented on code in PR #2177:
URL: https://github.com/apache/arrow-datafusion/pull/2177#discussion_r860542317


##########
datafusion/expr/src/function.rs:
##########
@@ -39,6 +40,10 @@ use std::sync::Arc;
 pub type ScalarFunctionImplementation =
     Arc<dyn Fn(&[ColumnarValue]) -> Result<ColumnarValue> + Send + Sync>;
 
+/// Table function. Second tuple
+pub type TableFunctionImplementation =
+    Arc<dyn Fn(&[ColumnarValue], usize) -> Result<(ArrayRef, Vec<usize>)> + Send + Sync>;

Review Comment:
   as  ArrayRef is one of ColumnarValue
   ``` Rust
   pub enum ColumnarValue {
       /// Array of values
       Array(ArrayRef),
       /// A single value
       Scalar(ScalarValue),
   }
   ```
   I think `TableFunctionImplementation ` is same as `ScalarFunctionImplementation `.
   And it only generate table N*1 , if we use as https://github.com/apache/arrow-datafusion/pull/2177#issuecomment-1100368801
   ```rust
   Arc<dyn Fn(&[ColumnarValue], usize) -> Result<(Vec< ColumnarValue >, Vec<usize>)> + Send + Sync>;
   ```
   We could generate N*M table
   If im wrong plz correct me? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org