-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-31429][SQL][DOC] Automatically generates a SQL document for built-in functions #28224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| sql-configs.html | ||
| generated-*.html |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2623,10 +2623,10 @@ Spark subsystems. | |
|
|
||
|
|
||
| {% for static_file in site.static_files %} | ||
| {% if static_file.name == 'sql-configs.html' %} | ||
| {% if static_file.name == 'generated-sql-configuration-table.html' %} | ||
| ### Spark SQL | ||
|
|
||
| {% include_relative sql-configs.html %} | ||
| {% include_relative generated-sql-configuration-table.html %} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks the spaces are inserted together. I removed it just to be safe. |
||
| {% break %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| --- | ||
| layout: global | ||
| title: Built-in Functions | ||
| displayTitle: Built-in Functions | ||
| license: | | ||
| 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. | ||
| --- | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now it should be fairly easy to add some more sections and/or make these separate pages. |
||
| {% for static_file in site.static_files %} | ||
| {% if static_file.name == 'generated-agg-funcs-table.html' %} | ||
| ### Aggregate Functions | ||
| {% include_relative generated-agg-funcs-table.html %} | ||
| #### Examples | ||
| {% include_relative generated-agg-funcs-examples.html %} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we put all the examples in one section?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, we currently put examples per group in one section like this;
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to put everything about one function (signature, desc, examples, etc.) together. Did we decide to do this due to technical difficulties?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can do it. I just a bit rushed to merge this to keep this PR narrow-scoped as a base work. As an easy way, we can refer other DBMSs documentations and mimic I guess.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so and we can improve the structure by follow-up activities. But, I'm not sure the improvement should be applied at the 3.0 release.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea we can improve it in 3.1
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, thanks, I'll file jira later.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| {% break %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% for static_file in site.static_files %} | ||
| {% if static_file.name == 'generated-window-funcs-table.html' %} | ||
| ### Window Functions | ||
| {% include_relative generated-window-funcs-table.html %} | ||
| {% break %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% for static_file in site.static_files %} | ||
| {% if static_file.name == 'generated-array-funcs-table.html' %} | ||
| ### Array Functions | ||
| {% include_relative generated-array-funcs-table.html %} | ||
| #### Examples | ||
| {% include_relative generated-array-funcs-examples.html %} | ||
| {% break %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% for static_file in site.static_files %} | ||
| {% if static_file.name == 'generated-map-funcs-table.html' %} | ||
| ### Map Functions | ||
| {% include_relative generated-map-funcs-table.html %} | ||
| #### Examples | ||
| {% include_relative generated-map-funcs-examples.html %} | ||
| {% break %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% for static_file in site.static_files %} | ||
| {% if static_file.name == 'generated-datetime-funcs-table.html' %} | ||
| ### Date and Timestamp Functions | ||
| {% include_relative generated-datetime-funcs-table.html %} | ||
| #### Examples | ||
| {% include_relative generated-datetime-funcs-examples.html %} | ||
| {% break %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| {% for static_file in site.static_files %} | ||
| {% if static_file.name == 'generated-json-funcs-table.html' %} | ||
| ### JSON Functions | ||
| {% include_relative generated-json-funcs-table.html %} | ||
| #### Examples | ||
| {% include_relative generated-agg-funcs-examples.html %} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. generated-agg-funcs-examples.html -> generated-json-funcs-examples.html ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea... @huaxingao @dilipbiswal Could you include this fix in your open PRs? #28451
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. I will fix this.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, @huaxingao
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, it was my mistake I guess. Thanks guys, |
||
| {% break %} | ||
| {% endif %} | ||
| {% endfor %} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,18 @@ license: | | |
| Spark SQL provides two function features to meet a wide range of user needs: built-in functions and user-defined functions (UDFs). | ||
| Built-in functions are commonly used routines that Spark SQL predefines and a complete list of the functions can be found in the [Built-in Functions](api/sql/) API document. UDFs allow users to define their own functions when the system’s built-in functions are not enough to perform the desired task. | ||
|
|
||
| ### Built-in Functions | ||
|
|
||
| Spark SQL has some categories of frequently-used built-in functions for aggregtion, arrays/maps, date/timestamp, and JSON data. | ||
| This subsection presents the usages and descriptions of these functions. | ||
|
|
||
| * [Aggregate Functions](sql-ref-functions-builtin.html#aggregate-functions) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super nit: order of bullets/words in the above statement is different from that in sql-ref-functions-builtin.html. .e. the alphabetical order in sql-ref-functions-builtin.html. I am neutral on the order (current or consistent among them).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, actually, I sorted them by similar functionality, e.g., array and map. On the other hand, in |
||
| * [Window Functions](sql-ref-functions-builtin.html#window-functions) | ||
| * [Array Functions](sql-ref-functions-builtin.html#array-functions) | ||
| * [Map Functions](sql-ref-functions-builtin.html#map-functions) | ||
| * [Date and Timestamp Functions](sql-ref-functions-builtin.html#date-and-timestamp-functions) | ||
| * [JSON Functions](sql-ref-functions-builtin.html#json-functions) | ||
|
|
||
| ### UDFs (User-Defined Functions) | ||
|
|
||
| User-Defined Functions (UDFs) are a feature of Spark SQL that allows users to define their own functions when the system's built-in functions are not enough to perform the desired task. To use UDFs in Spark SQL, users must first define the function, then register the function with Spark, and finally call the registered function. The User-Defined Functions can act on a single row or act on multiple rows at once. Spark SQL also supports integration of existing Hive implementations of UDFs, UDAFs and UDTFs. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.