Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Add support for CONCAT_WS #500

Merged
merged 3 commits into from
Oct 24, 2018
Merged

Conversation

bake
Copy link
Contributor

@bake bake commented Oct 24, 2018

Add support for CONCAT_WS. Other than CONCAT, it returns null only if the separator is null. null fields are skipped.

Signed-off-by: bake <bake@192k.pw>
@erizocosmico erizocosmico requested a review from a team October 24, 2018 12:31
README.md Outdated
- Date and Timestamp functions: `YEAR(date)`, `MONTH(date)`, `DAY(date)`, `HOUR(date)`, `MINUTE(date)`, `SECOND(date)`, `DAYOFYEAR(date)`.
- `ARRAY_LENGTH(json)`: If the json representation is an array, this function returns its size.
- `SPLIT(str,sep)`: Receives a string and a separator and returns the parts of the string split by the separator as a JSON array of strings.
- `CONCAT(...)`: Concatenate any group of fields into a single string.
- `CONCAT_WS(sep, ...)`: Concatenate any group of fields into a single string separated by the first field.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth mentioning that null arguments are skipped and only returns null if sep is null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
"Returns null if the separator is null. Following null fields are skipped." - Would this be ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets copy paste from mysql docs:

... stands for Concatenate With Separator and is a special form of CONCAT(). The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I only just saw the comment. The descriptions now come from MySQLs docs.

@kuba--
Copy link
Contributor

kuba-- commented Oct 24, 2018

Please sign a PR.

Signed-off-by: bake <bake@192k.pw>
@bake bake force-pushed the concat-with-separator branch from 6e3f478 to 45230e1 Compare October 24, 2018 12:42
Copy link
Contributor

@erizocosmico erizocosmico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: bake <bake@192k.pw>
@ajnavarro ajnavarro merged commit 0e8025d into src-d:master Oct 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants