forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
701cb00
commit 2e204ed
Showing
7 changed files
with
210 additions
and
12 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
//! [`SpecialUDF`]: Special User Defined Functions | ||
pub mod special_doc_sections { | ||
use crate::DocSection; | ||
|
||
pub fn doc_sections() -> Vec<DocSection> { | ||
vec![DOC_SECTION_MAP] | ||
} | ||
|
||
pub const DOC_SECTION_MAP: DocSection = DocSection { | ||
include: true, | ||
label: "Map Functions", | ||
description: None, | ||
}; | ||
} |
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 |
---|---|---|
|
@@ -298,3 +298,50 @@ npx [email protected] --write "$TARGET_FILE" | |
|
||
echo "'$TARGET_FILE' successfully updated!" | ||
|
||
TARGET_FILE="docs/source/user-guide/sql/special_functions_new.md" | ||
PRINT_SPECIAL_FUNCTION_DOCS_COMMAND="cargo run --manifest-path datafusion/core/Cargo.toml --bin print_functions_docs -- special" | ||
|
||
echo "Inserting header" | ||
cat <<'EOF' > "$TARGET_FILE" | ||
<!--- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
<!--- | ||
This file was generated by the dev/update_function_docs.sh script. | ||
Do not edit it manually as changes will be overwritten. | ||
Instead, edit the SpecialUDFImpl's documentation() function to | ||
update documentation for an individual UDF or the | ||
dev/update_function_docs.sh file for updating surrounding text. | ||
--> | ||
# Special Functions (NEW) | ||
Note: this documentation is in the process of being migrated to be [automatically created from the codebase]. | ||
[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740 | ||
EOF | ||
|
||
echo "Running CLI and inserting special function docs table" | ||
$PRINT_SPECIAL_FUNCTION_DOCS_COMMAND >> "$TARGET_FILE" | ||
|
||
echo "Running prettier" | ||
npx [email protected] --write "$TARGET_FILE" | ||
|
||
echo "'$TARGET_FILE' successfully updated!" |
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!--- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
<!--- | ||
This file was generated by the dev/update_function_docs.sh script. | ||
Do not edit it manually as changes will be overwritten. | ||
Instead, edit the SpecialUDFImpl's documentation() function to | ||
update documentation for an individual UDF or the | ||
dev/update_function_docs.sh file for updating surrounding text. | ||
--> | ||
|
||
# Special Functions (NEW) | ||
|
||
Note: this documentation is in the process of being migrated to be [automatically created from the codebase]. | ||
|
||
[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740 | ||
|
||
## Map Functions | ||
|
||
- [map](#map) | ||
|
||
### `map` | ||
|
||
Returns an Arrow map with the specified key-value pairs. | ||
|
||
``` | ||
map(key, value) | ||
map(key: value) | ||
``` | ||
|
||
#### Arguments | ||
|
||
- **key**: Expression to be used for key. Can be a constant, column, or function, any combination of arithmetic or string operators, or a named expression of the previously listed. | ||
- **value**: Expression to be used for value. Can be a constant, column, or function, any combination of arithmetic or string operators, or a named expression of the previously listed. | ||
|
||
#### Example | ||
|
||
```sql | ||
SELECT MAP(['POST', 'HEAD', 'PATCH'], [41, 33, null]); | ||
---- | ||
{POST: 41, HEAD: 33, PATCH: } | ||
|
||
SELECT MAP([[1,2], [3,4]], ['a', 'b']); | ||
---- | ||
{[1, 2]: a, [3, 4]: b} | ||
|
||
SELECT MAP { 'a': 1, 'b': 2 }; | ||
---- | ||
{a: 1, b: 2} | ||
``` |