Repository navigation
docs(spark): document string functions with #[user_doc] - #105
Merged
Merged
Conversation
Document ascii, char, concat, concat_ws, elt, format_string, length, quote, space, soundex, like and ilike with #[user_doc] and implement documentation(), following the guidelines in CONTRIBUTING.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a sqllogictest case showing that space(2) fails to plan because the literal is BIGINT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #55
Rationale
#58 added
#[user_doc]support and documentedsha2andsubstringas examples. This PR applies the same approach to the rest of the general-purpose string functions, so they appear in generated function references.Changes
ascii,char,concat,concat_ws,elt,format_string(aliasprintf),length(aliaseschar_length,character_length,len),quote,space,soundex,likeandilikewith#[user_doc], and implementdocumentation()by returningself.doc().elt, and accepted input types.ascii,concatandconcat_wsmoved into the#[user_doc]text, so nothing is written twice.spaceonly accepts INT, and integer literals are BIGINT in DataFusion, so its docs say to cast and its examples use::INT.to_binary,try_to_binary,encode,base64,unbase64,make_valid_utf8,is_valid_utf8,luhn_check) go in their own PR.substringwas done in docs: document sha2 and substring with #[user_doc] #58, andregexp_extractis documented in its own PR (feat(spark): add Spark-compatible regexp_extract function #73).Testing
cargo fmt --all,cargo clippy --all-targets --all-features -- -D warnings,cargo test -p datafusion-sparkandcargo test -p datafusion-spark-sqllogictestpass..sltand unit tests for these functions, or is visible in the code (for example,likeandiliketake exactly two arguments, so Spark'sescapeargument isn't supported).User-facing changes
documentation()now returns docs for these 12 functions. Behavior does not change.Known gaps
The docs describe these differences from Spark, link them to their issues, and new sqllogictest cases cover the current behavior:
space(2)fails to plan because the literal is BIGINT; Spark types it as INT (Type numeric literals as Spark does in the sqllogictest files #97).🤖 Generated with Claude Code