This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 9b5733fe61 typo: change delimeter to delimiter (#7521)
9b5733fe61 is described below
commit 9b5733fe618aecdd6e78eae7ef3135a0e9663744
Author: Alex Huang <[email protected]>
AuthorDate: Tue Sep 12 01:36:49 2023 +0800
typo: change delimeter to delimiter (#7521)
---
datafusion/common/src/file_options/csv_writer.rs | 4 +--
datafusion/common/src/file_options/mod.rs | 2 +-
datafusion/expr/src/expr_fn.rs | 2 +-
datafusion/physical-expr/src/array_expressions.rs | 34 +++++++++++------------
datafusion/sqllogictest/test_files/copy.slt | 2 +-
docs/source/user-guide/expressions.md | 2 +-
docs/source/user-guide/sql/scalar_functions.md | 4 +--
7 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/datafusion/common/src/file_options/csv_writer.rs
b/datafusion/common/src/file_options/csv_writer.rs
index 336180b256..b69e778431 100644
--- a/datafusion/common/src/file_options/csv_writer.rs
+++ b/datafusion/common/src/file_options/csv_writer.rs
@@ -93,13 +93,13 @@ impl TryFrom<(&ConfigOptions, &StatementOptions)> for
CsvWriterOptions {
compression =
CompressionTypeVariant::from_str(value.replace('\'', "").as_str())?;
builder
},
- "delimeter" => {
+ "delimiter" => {
// Ignore string literal single quotes passed from sql
parsing
let value = value.replace('\'', "");
let chars: Vec<char> = value.chars().collect();
if chars.len()>1{
return Err(DataFusionError::Configuration(format!(
- "CSV Delimeter Option must be a single char, got:
{}", value
+ "CSV Delimiter Option must be a single char, got:
{}", value
)))
}
builder.with_delimiter(chars[0].try_into().map_err(|_| {
diff --git a/datafusion/common/src/file_options/mod.rs
b/datafusion/common/src/file_options/mod.rs
index ab792bdca7..61c5affd12 100644
--- a/datafusion/common/src/file_options/mod.rs
+++ b/datafusion/common/src/file_options/mod.rs
@@ -508,7 +508,7 @@ mod tests {
option_map.insert("rfc3339".to_owned(), "true".to_owned());
option_map.insert("null_value".to_owned(), "123".to_owned());
option_map.insert("compression".to_owned(), "gzip".to_owned());
- option_map.insert("delimeter".to_owned(), ";".to_owned());
+ option_map.insert("delimiter".to_owned(), ";".to_owned());
let options = StatementOptions::from(&option_map);
let config = ConfigOptions::new();
diff --git a/datafusion/expr/src/expr_fn.rs b/datafusion/expr/src/expr_fn.rs
index 8801588975..325d2f16fb 100644
--- a/datafusion/expr/src/expr_fn.rs
+++ b/datafusion/expr/src/expr_fn.rs
@@ -677,7 +677,7 @@ scalar_expr!(
scalar_expr!(
ArrayToString,
array_to_string,
- array delimeter,
+ array delimiter,
"converts each element to its text representation."
);
scalar_expr!(
diff --git a/datafusion/physical-expr/src/array_expressions.rs
b/datafusion/physical-expr/src/array_expressions.rs
index 081345f8a5..2d84d8b3bd 100644
--- a/datafusion/physical-expr/src/array_expressions.rs
+++ b/datafusion/physical-expr/src/array_expressions.rs
@@ -1471,18 +1471,18 @@ array_replacement_function!(
);
macro_rules! to_string {
- ($ARG:expr, $ARRAY:expr, $DELIMETER:expr, $NULL_STRING:expr,
$WITH_NULL_STRING:expr, $ARRAY_TYPE:ident) => {{
+ ($ARG:expr, $ARRAY:expr, $DELIMITER:expr, $NULL_STRING:expr,
$WITH_NULL_STRING:expr, $ARRAY_TYPE:ident) => {{
let arr = downcast_arg!($ARRAY, $ARRAY_TYPE);
for x in arr {
match x {
Some(x) => {
$ARG.push_str(&x.to_string());
- $ARG.push_str($DELIMETER);
+ $ARG.push_str($DELIMITER);
}
None => {
if $WITH_NULL_STRING {
$ARG.push_str($NULL_STRING);
- $ARG.push_str($DELIMETER);
+ $ARG.push_str($DELIMITER);
}
}
}
@@ -1495,8 +1495,8 @@ macro_rules! to_string {
pub fn array_to_string(args: &[ArrayRef]) -> Result<ArrayRef> {
let arr = &args[0];
- let delimeters = as_generic_string_array::<i32>(&args[1])?;
- let delimeters: Vec<Option<&str>> = delimeters.iter().collect();
+ let delimiters = as_generic_string_array::<i32>(&args[1])?;
+ let delimiters: Vec<Option<&str>> = delimiters.iter().collect();
let mut null_string = String::from("");
let mut with_null_string = false;
@@ -1510,7 +1510,7 @@ pub fn array_to_string(args: &[ArrayRef]) ->
Result<ArrayRef> {
fn compute_array_to_string(
arg: &mut String,
arr: ArrayRef,
- delimeter: String,
+ delimiter: String,
null_string: String,
with_null_string: bool,
) -> Result<&mut String> {
@@ -1522,7 +1522,7 @@ pub fn array_to_string(args: &[ArrayRef]) ->
Result<ArrayRef> {
compute_array_to_string(
arg,
list_array.value(i),
- delimeter.clone(),
+ delimiter.clone(),
null_string.clone(),
with_null_string,
)?;
@@ -1537,7 +1537,7 @@ pub fn array_to_string(args: &[ArrayRef]) ->
Result<ArrayRef> {
to_string!(
arg,
arr,
- &delimeter,
+ &delimiter,
&null_string,
with_null_string,
$ARRAY_TYPE
@@ -1555,19 +1555,19 @@ pub fn array_to_string(args: &[ArrayRef]) ->
Result<ArrayRef> {
match arr.data_type() {
DataType::List(_) | DataType::LargeList(_) |
DataType::FixedSizeList(_, _) => {
let list_array = arr.as_list::<i32>();
- for (arr, &delimeter) in list_array.iter().zip(delimeters.iter()) {
- if let (Some(arr), Some(delimeter)) = (arr, delimeter) {
+ for (arr, &delimiter) in list_array.iter().zip(delimiters.iter()) {
+ if let (Some(arr), Some(delimiter)) = (arr, delimiter) {
arg = String::from("");
let s = compute_array_to_string(
&mut arg,
arr,
- delimeter.to_string(),
+ delimiter.to_string(),
null_string.clone(),
with_null_string,
)?
.clone();
- if let Some(s) = s.strip_suffix(delimeter) {
+ if let Some(s) = s.strip_suffix(delimiter) {
res.push(Some(s.to_string()));
} else {
res.push(Some(s));
@@ -1578,20 +1578,20 @@ pub fn array_to_string(args: &[ArrayRef]) ->
Result<ArrayRef> {
}
}
_ => {
- // delimeter length is 1
- assert_eq!(delimeters.len(), 1);
- let delimeter = delimeters[0].unwrap();
+ // delimiter length is 1
+ assert_eq!(delimiters.len(), 1);
+ let delimiter = delimiters[0].unwrap();
let s = compute_array_to_string(
&mut arg,
arr.clone(),
- delimeter.to_string(),
+ delimiter.to_string(),
null_string,
with_null_string,
)?
.clone();
if !s.is_empty() {
- let s = s.strip_suffix(delimeter).unwrap().to_string();
+ let s = s.strip_suffix(delimiter).unwrap().to_string();
res.push(Some(s));
} else {
res.push(Some(s));
diff --git a/datafusion/sqllogictest/test_files/copy.slt
b/datafusion/sqllogictest/test_files/copy.slt
index 3ade43b4e8..a41d1fca66 100644
--- a/datafusion/sqllogictest/test_files/copy.slt
+++ b/datafusion/sqllogictest/test_files/copy.slt
@@ -213,7 +213,7 @@ single_file_output false,
header false,
compression 'uncompressed',
datetime_format '%FT%H:%M:%S.%9f',
-delimeter ';',
+delimiter ';',
null_value 'NULLVAL');
----
2
diff --git a/docs/source/user-guide/expressions.md
b/docs/source/user-guide/expressions.md
index a481e525fe..6d4dea691b 100644
--- a/docs/source/user-guide/expressions.md
+++ b/docs/source/user-guide/expressions.md
@@ -206,7 +206,7 @@ Unlike to some databases the math functions in Datafusion
works the same way as
| array_replace_n(array, from, to, max) | Replaces the first `max` occurrences
of the specified element with another specified element. `array_replace_n([1,
2, 2, 3, 2, 1, 4], 2, 5, 2) -> [1, 5, 5, 3, 2, 1, 4]` |
| array_replace_all(array, from, to) | Replaces all occurrences of the
specified element with another specified element. `array_replace_all([1, 2, 2,
3, 2, 1, 4], 2, 5) -> [1, 5, 5, 3, 5, 1, 4]` |
| array_slice(array, index) | Returns a slice of the array.
`array_slice([1, 2, 3, 4, 5, 6, 7, 8], 3, 6) -> [3, 4, 5, 6]`
|
-| array_to_string(array, delimeter) | Converts each element to its text
representation. `array_to_string([1, 2, 3, 4], ',') -> 1,2,3,4`
|
+| array_to_string(array, delimiter) | Converts each element to its text
representation. `array_to_string([1, 2, 3, 4], ',') -> 1,2,3,4`
|
| cardinality(array) | Returns the total number of elements
in the array. `cardinality([[1, 2, 3], [4, 5, 6]]) -> 6`
|
| make_array(value1, [value2 [, ...]]) | Returns an Arrow array using the
specified input expressions. `make_array(1, 2, 3) -> [1, 2, 3]`
|
| trim_array(array, n) | Deprecated
|
diff --git a/docs/source/user-guide/sql/scalar_functions.md
b/docs/source/user-guide/sql/scalar_functions.md
index fc62938502..cd7245b347 100644
--- a/docs/source/user-guide/sql/scalar_functions.md
+++ b/docs/source/user-guide/sql/scalar_functions.md
@@ -2166,14 +2166,14 @@ array_slice(array, begin, end)
Converts each element to its text representation.
```
-array_to_string(array, delimeter)
+array_to_string(array, delimiter)
```
#### Arguments
- **array**: Array expression.
Can be a constant, column, or function, and any combination of array
operators.
-- **delimeter**: Array element separator.
+- **delimiter**: Array element separator.
#### Example