-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RFC: Demonstrate what a function package might look like -- encoding expressions #8046
Closed
Closed
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
c67e620
Make fields of ScalarUDF non pub
alamb 01a9bce
Add datafusion-functions crate
alamb ee7a873
Extract registration functions into a trait
alamb 4b5acd1
Complete integration
alamb c441a0d
Conditional compilation
alamb d38a80a
Update lock
alamb 1841436
put back deleted part and add RAT
alamb 7c7065e
tomlfmt and doc
alamb 4370bdd
Merge remote-tracking branch 'apache/main' into alamb/extract_encodin…
alamb b5d4b4f
Implement new function registry interface
alamb 094a0e2
Merge remote-tracking branch 'apache/main' into alamb/extract_encodin…
alamb 02ccb3a
update commit
alamb be159d1
remove dead code
alamb 9871ca4
Update readme
alamb a9f4f92
Update
alamb fbf7d44
Add proto test
alamb a95917e
Implement expr_fn
alamb dabd5b8
simplify
alamb 46ea79f
make it compile
alamb 6c6a742
macro magic
alamb fe397c1
put macros in their own file
alamb a91e7d2
Merge remote-tracking branch 'apache/main' into alamb/extract_encodin…
alamb ea14fe9
cleanup
alamb 817382f
Merge remote-tracking branch 'apache/main' into alamb/extract_encodin…
alamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -737,8 +737,9 @@ scalar_expr!( | |
"converts the Unicode code point to a UTF8 character" | ||
); | ||
scalar_expr!(Digest, digest, input algorithm, "compute the binary hash of `input`, using the `algorithm`"); | ||
scalar_expr!(Encode, encode, input encoding, "encode the `input`, using the `encoding`. encoding can be base64 or hex"); | ||
scalar_expr!(Decode, decode, input encoding, "decode the`input`, using the `encoding`. encoding can be base64 or hex"); | ||
// TODO make a variant of Expr that can invoke a function by name | ||
alamb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//scalar_udf!(encode, datafusion_functions::encoding::encode_udf, input encoding, "encode the `input`, using the `encoding`. encoding can be base64 or hex"); | ||
//scalar_expr!(Decode, decode, input encoding, "decode the`input`, using the `encoding`. encoding can be base64 or hex"); | ||
scalar_expr!(InitCap, initcap, string, "converts the first letter of each word in `string` in uppercase and the remaining characters in lowercase"); | ||
scalar_expr!(Left, left, string n, "returns the first `n` characters in the `string`"); | ||
scalar_expr!(Lower, lower, string, "convert the string to lower case"); | ||
|
@@ -1070,8 +1071,8 @@ mod test { | |
test_scalar_expr!(CharacterLength, character_length, string); | ||
test_scalar_expr!(Chr, chr, string); | ||
test_scalar_expr!(Digest, digest, string, algorithm); | ||
test_scalar_expr!(Encode, encode, string, encoding); | ||
test_scalar_expr!(Decode, decode, string, encoding); | ||
//test_scalar_expr!(Encode, encode, string, encoding); | ||
//test_scalar_expr!(Decode, decode, string, encoding); | ||
test_scalar_expr!(Gcd, gcd, arg_1, arg_2); | ||
test_scalar_expr!(Lcm, lcm, arg_1, arg_2); | ||
test_scalar_expr!(InitCap, initcap, string); | ||
|
@@ -1171,30 +1172,4 @@ mod test { | |
unreachable!(); | ||
} | ||
} | ||
|
||
#[test] | ||
fn encode_function_definitions() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think these tests add a lot -- they simply encode the signature again. This is also covered by actually calling |
||
if let Expr::ScalarFunction(ScalarFunction { fun, args }) = | ||
encode(col("tableA.a"), lit("base64")) | ||
{ | ||
let name = BuiltinScalarFunction::Encode; | ||
assert_eq!(name, fun); | ||
assert_eq!(2, args.len()); | ||
} else { | ||
unreachable!(); | ||
} | ||
} | ||
|
||
#[test] | ||
fn decode_function_definitions() { | ||
if let Expr::ScalarFunction(ScalarFunction { fun, args }) = | ||
decode(col("tableA.a"), lit("hex")) | ||
{ | ||
let name = BuiltinScalarFunction::Decode; | ||
assert_eq!(name, fun); | ||
assert_eq!(2, args.len()); | ||
} else { | ||
unreachable!(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This metadata information about the functions is now moved into
functions/encoding.rs
module, along side its implementation