Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions datafusion-pg-functions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ full = [
# Mathematical Functions and Operators
math = ["dep:libm", "dep:rand"]
# String Functions and Operators
string = []
string = [
"dep:regex",
"dep:unicode-normalization",
"dep:icu_properties",
"dep:icu_casemap",
]
# Binary String Functions and Operators
binary = []
# Bit String Functions and Operators
Expand Down Expand Up @@ -89,7 +94,10 @@ row = []
datafusion = { workspace = true, features = ["nested_expressions"] }
libm = { version = "0.2", optional = true }
rand = { version = "0.10", optional = true }

regex = { version = "1", optional = true }
unicode-normalization = { version = "0.1", optional = true }
icu_properties = { version = "2.1", optional = true }
icu_casemap = { version = "2", optional = true }
[dev-dependencies]
async-trait = "0.1"
datafusion = { workspace = true, features = ["nested_expressions"] }
Expand All @@ -100,4 +108,4 @@ tokio = { workspace = true, features = ["macros", "rt", "fs"] }
[[test]]
name = "sqllogictest"
path = "tests/sqllogictest.rs"
required-features = ["math"]
required-features = ["math", "string"]
40 changes: 20 additions & 20 deletions datafusion-pg-functions/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ implementation strategy in DataFusion.
| [Subquery Expressions](#functions-subquery) | 0 | 0 | 0 | 0 | 0 | 0 | 0+0 | 0 |
| [Row and Array Comparisons](#functions-comparisons) | 0 | 0 | 0 | 0 | 0 | 0 | 0+0 | 0 |
| [Mathematical](#functions-math) | 55 | 33 | 18 | 0 | 0 | 4 | 0+0 | 0 |
| [String](#functions-string) | 61 | 42 | 2 | 0 | 17 | 0 | 0+4 | 0 |
| [String](#functions-string) | 61 | 42 | 16 | 0 | 3 | 0 | 0+4 | 0 |
| [Binary String](#functions-binarystring) | 30 | 20 | 0 | 0 | 10 | 0 | 0+4 | 0 |
| [Bit String](#functions-bitstring) | 9 | 6 | 0 | 0 | 0 | 0 | 0+3 | 3 |
| [Pattern Matching](#functions-matching) | 15 | 7 | 0 | 0 | 4 | 0 | 3+2 | 0 |
| [Pattern Matching](#functions-matching) | 15 | 7 | 2 | 0 | 2 | 0 | 3+2 | 0 |
| [Data Type Formatting](#functions-formatting) | 10 | 3 | 0 | 0 | 7 | 0 | 0+0 | 0 |
| [Date/Time](#functions-datetime) | 33 | 11 | 0 | 0 | 21 | 0 | 0+1 | 0 |
| [Enum Support](#functions-enum) | 3 | 0 | 0 | 0 | 0 | 0 | 0+0 | 3 |
Expand All @@ -85,7 +85,7 @@ implementation strategy in DataFusion.
| [System Administration](#functions-admin) | 105 | 0 | 2 | 0 | 5 | 0 | 0+0 | 98 |
| [Trigger](#functions-trigger) | 3 | 0 | 0 | 0 | 0 | 0 | 0+0 | 3 |
| [Event Trigger](#functions-event-triggers) | 5 | 0 | 0 | 0 | 0 | 0 | 0+0 | 5 |
| **TOTAL** | **768** | **198** | **40** | **4** | **85** | **65** | **21** | **371** |
| **TOTAL** | **768** | **198** | **54** | **4** | **71** | **65** | **21** | **371** |

---

Expand Down Expand Up @@ -210,7 +210,7 @@ implementation strategy in DataFusion.

## String Functions and Operators

*Section `functions-string` Β· Module: [`string`](src/string.rs)
*Section `functions-string` Β· Module: [`string`](src/string/)

| Function | Kind | Status | Pri | #overloads | Description | Notes |
|---|:---:|:---:|:---:|---:|---|---|
Expand All @@ -219,61 +219,61 @@ implementation strategy in DataFusion.
| `ascii` | fn | βœ… | β€” | 1 | convert first char to int4 | Native DataFusion |
| `bit_length` | fn | βœ… | β€” | 3 | length in bits | Native DataFusion |
| `btrim` | fn | βœ… | β€” | 3 | trim selected characters from both ends of string | Native DataFusion |
| `casefold` | fn | 🚧 | P2 | 1 | fold case | |
| `casefold` | fn | πŸ”§ | β€” | 1 | fold case | |
| `char_length` | fn | βœ… | β€” | 2 | character length | Native DataFusion |
| `character_length` | fn | βœ… | β€” | 2 | character length | Native DataFusion |
| `chr` | fn | βœ… | β€” | 1 | convert int4 to char | Native DataFusion |
| `concat` | fn | βœ… | β€” | 1 | concatenate values | Native DataFusion |
| `concat_ws` | fn | βœ… | β€” | 1 | concatenate values with separators | Native DataFusion |
| `format` | fn | 🚧 | P2 | 2 | format text message | PG `%s`/`%I`/`%L` format strings; high-value for psql/dbeaver. |
| `format` | fn | πŸ”§ | β€” | 2 | format text message | PG `%s`/`%I`/`%L` format strings; high-value for psql/dbeaver. |
| `initcap` | fn | βœ… | β€” | 1 | capitalize each word | Native DataFusion |
| `left` | fn | βœ… | β€” | 1 | extract the first n characters | Native DataFusion |
| `length` | fn | βœ… | β€” | 8 | length of string in specified encoding | Overloaded in PG (text/bytea/bit); DF covers text only. Native DataFusion |
| `lower` | fn | βœ… | β€” | 3 | lower bound of multirange | Native DataFusion |
| `lpad` | fn | βœ… | β€” | 2 | left-pad string to length | Native DataFusion |
| `ltrim` | fn | βœ… | β€” | 3 | trim selected characters from left end of string | Native DataFusion |
| `md5` | fn | βœ… | β€” | 2 | MD5 hash | Native DataFusion |
| `normalize` | fn | 🚧 | P2 | 1 | Unicode normalization | Unicode normalization. |
| `normalize` | fn | πŸ”§ | β€” | 1 | Unicode normalization | Unicode normalization. |
| `octet_length` | fn | βœ… | β€” | 4 | octet length | Native DataFusion |
| `overlay` | both | βœ… | β€” | 6 | substitute portion of bitstring | Native DataFusion |
| `parse_ident` | fn | πŸ”§ | β€” | 1 | parse qualified identifier to array of identifiers | In datafusion-pg-catalog |
| `pg_client_encoding` | fn | 🚧 | P2 | 1 | encoding name of current database | |
| `pg_client_encoding` | fn | πŸ”§ | β€” | 1 | encoding name of current database | |
| `position` | both | βœ… | β€” | 3 | position of sub-bitstring | Native DataFusion |
| `quote_ident` | fn | πŸ”§ | β€” | 1 | quote an identifier for usage in a querystring | In datafusion-pg-catalog |
| `quote_literal` | fn | 🚧 | P2 | 2 | quote a data value for usage in a querystring | |
| `quote_nullable` | fn | 🚧 | P2 | 2 | quote a possibly-null data value for usage in a querystring | |
| `quote_literal` | fn | πŸ”§ | β€” | 2 | quote a data value for usage in a querystring | |
| `quote_nullable` | fn | πŸ”§ | β€” | 2 | quote a possibly-null data value for usage in a querystring | |
| `regexp_count` | fn | βœ… | β€” | 3 | count regexp matches | Native DataFusion |
| `regexp_instr` | fn | βœ… | β€” | 6 | position of regexp match | Native DataFusion |
| `regexp_like` | fn | βœ… | β€” | 2 | test for regexp match | Native DataFusion |
| `regexp_match` | fn | βœ… | β€” | 2 | find first match for regexp | Native DataFusion |
| `regexp_matches` | fn | 🚧 | P2 | 2 | find match(es) for regexp | Postgres is set-returning; DataFusion returns an array. |
| `regexp_replace` | fn | βœ… | β€” | 5 | replace text using regexp | Native DataFusion |
| `regexp_split_to_array` | fn | 🚧 | P2 | 2 | split string by pattern | |
| `regexp_split_to_array` | fn | πŸ”§ | β€” | 2 | split string by pattern | |
| `regexp_split_to_table` | fn | 🚧 | P2 | 2 | split string by pattern | Set-returning. |
| `regexp_substr` | fn | 🚧 | P2 | 5 | extract substring that matches regexp | |
| `regexp_substr` | fn | πŸ”§ | β€” | 5 | extract substring that matches regexp | |
| `repeat` | fn | βœ… | β€” | 1 | replicate string n times | Native DataFusion |
| `replace` | fn | βœ… | β€” | 1 | replace all occurrences in string of old_substr with new_substr | Native DataFusion |
| `reverse` | fn | βœ… | β€” | 2 | reverse bytea | Native DataFusion |
| `right` | fn | βœ… | β€” | 1 | extract the last n characters | Native DataFusion |
| `rpad` | fn | βœ… | β€” | 2 | right-pad string to length | Native DataFusion |
| `rtrim` | fn | βœ… | β€” | 3 | trim selected characters from right end of string | Native DataFusion |
| `split_part` | fn | βœ… | β€” | 1 | split string by field_sep and return field_num | Native DataFusion |
| `sprintf` | fn | 🚧 | P2 | 0 | β€” | PG 18+. |
| `sprintf` | fn | πŸ”§ | β€” | 0 | β€” | PG 18+. |
| `starts_with` | fn | βœ… | β€” | 1 | β€” | Native DataFusion |
| `string_agg` | fn | βœ… | β€” | 2 | concatenate aggregate input into a string | Native DataFusion |
| `string_to_array` | fn | βœ… | β€” | 2 | split delimited text, with null string | Native DataFusion |
| `string_to_table` | fn | 🚧 | P2 | 2 | split delimited text, with null string | |
| `strpos` | fn | βœ… | β€” | 1 | position of substring | DataFusion is 0-based; Postgres is 1-based. Native DataFusion. Same naming and offset semantics as substr. |
| `substr` | fn | βœ… | β€” | 4 | extract portion of string | DataFusion is 0-based; Postgres is 1-based. Native DataFusion. DataFusion's substr is 0-based; Postgres is 1-based. Translate. |
| `substring` | both | βœ… | β€” | 8 | extract text matching SQL regular expression | Native DataFusion. Postgres 1-based offsets. |
| `to_ascii` | fn | 🚧 | P2 | 3 | encode text from DB encoding to ASCII text | |
| `to_bin` | fn | 🚧 | P2 | 2 | convert int4 number to binary | Intβ†’binary text. |
| `to_ascii` | fn | πŸ”§ | β€” | 3 | encode text from DB encoding to ASCII text | |
| `to_bin` | fn | πŸ”§ | β€” | 2 | convert int4 number to binary | Intβ†’binary text. |
| `to_hex` | fn | βœ… | β€” | 2 | convert int4 number to hex | Native DataFusion |
| `to_oct` | fn | 🚧 | P2 | 2 | convert int4 number to oct | Intβ†’octal text. |
| `to_oct` | fn | πŸ”§ | β€” | 2 | convert int4 number to oct | Intβ†’octal text. |
| `translate` | fn | βœ… | β€” | 1 | map a set of characters appearing in string | Native DataFusion |
| `trim` | both | βœ… | β€” | 0 | β€” | Native DataFusion (SQL special form). |
| `unicode_assigned` | fn | 🚧 | P2 | 1 | check valid Unicode | |
| `unistr` | fn | 🚧 | P2 | 1 | unescape Unicode characters | Unicode escape decoder. |
| `unicode_assigned` | fn | πŸ”§ | β€” | 1 | check valid Unicode | |
| `unistr` | fn | πŸ”§ | β€” | 1 | unescape Unicode characters | Unicode escape decoder. |
| `upper` | fn | βœ… | β€” | 3 | upper bound of multirange | Native DataFusion |

## Binary String Functions and Operators
Expand Down Expand Up @@ -344,9 +344,9 @@ implementation strategy in DataFusion.
| `regexp_match` | fn | βœ… | β€” | 2 | find first match for regexp | Native DataFusion |
| `regexp_matches` | fn | 🚧 | P2 | 2 | find match(es) for regexp | Postgres is set-returning; DataFusion returns an array. |
| `regexp_replace` | fn | βœ… | β€” | 5 | replace text using regexp | Native DataFusion |
| `regexp_split_to_array` | fn | 🚧 | P2 | 2 | split string by pattern | |
| `regexp_split_to_array` | fn | πŸ”§ | β€” | 2 | split string by pattern | |
| `regexp_split_to_table` | fn | 🚧 | P2 | 2 | split string by pattern | Set-returning. |
| `regexp_substr` | fn | 🚧 | P2 | 5 | extract substring that matches regexp | |
| `regexp_substr` | fn | πŸ”§ | β€” | 5 | extract substring that matches regexp | |
| `similar to` | op | 🚧 | P2 | 0 | β€” | |
| `starts_with` | fn | βœ… | β€” | 1 | β€” | Native DataFusion |
| `substring` | both | βœ… | β€” | 8 | extract text matching SQL regular expression | Native DataFusion. Postgres 1-based offsets. |
Expand Down
17 changes: 0 additions & 17 deletions datafusion-pg-functions/src/string.rs

This file was deleted.

Loading
Loading