This is an automated email from the ASF dual-hosted git repository.
zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new f78d56244a9 [feat](func) Support GET_FORAMT function (#2939)
f78d56244a9 is described below
commit f78d56244a9d67a1cc4ad2487bf8d4a7d058cce2
Author: linrrarity <[email protected]>
AuthorDate: Mon Oct 20 12:33:26 2025 +0800
[feat](func) Support GET_FORAMT function (#2939)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../date-time-functions/get-format.md | 113 +++++++++++++++++++++
.../date-time-functions/get-format.md | 113 +++++++++++++++++++++
sidebars.json | 1 +
3 files changed, 227 insertions(+)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/get-format.md
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/get-format.md
new file mode 100644
index 00000000000..e4718b4e952
--- /dev/null
+++
b/docs/sql-manual/sql-functions/scalar-functions/date-time-functions/get-format.md
@@ -0,0 +1,113 @@
+---
+{
+ "title": "GET_FORMAT",
+ "language": "en"
+}
+---
+
+## Description
+
+Returns a specific format string.
+
+This function behaves the same as the MySQL [GET_FORMAT
function](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_get-format).
+
+
+## Syntax
+
+```sql
+GET_FORMAT({DATE|DATETIME|TIME}, {'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'})
+```
+
+## Return Value
+
+Returns a format string. The results for different arguments are shown in the
table below:
+| Function Call | Result |
+| ------------------------------------ | -------------------- |
+| GET_FORMAT(DATE,'USA') | '%m.%d.%Y' |
+| GET_FORMAT(DATE,'JIS') | '%Y-%m-%d' |
+| GET_FORMAT(DATE,'ISO') | '%Y-%m-%d' |
+| GET_FORMAT(DATE,'EUR') | '%d.%m.%Y' |
+| GET_FORMAT(DATE,'INTERNAL') | '%Y%m%d' |
+| GET_FORMAT(DATETIME,'USA') | '%Y-%m-%d %H.%i.%s' |
+| GET_FORMAT(DATETIME,'JIS') | '%Y-%m-%d %H:%i:%s' |
+| GET_FORMAT(DATETIME,'ISO') | '%Y-%m-%d %H:%i:%s' |
+| GET_FORMAT(DATETIME,'EUR') | '%Y-%m-%d %H.%i.%s' |
+| GET_FORMAT(DATETIME,'INTERNAL') | '%Y%m%d%H%i%s' |
+| GET_FORMAT(TIME,'USA') | '%h:%i:%s %p' |
+| GET_FORMAT(TIME,'JIS') | '%H:%i:%s' |
+| GET_FORMAT(TIME,'ISO') | '%H:%i:%s' |
+| GET_FORMAT(TIME,'EUR') | '%H.%i.%s' |
+| GET_FORMAT(TIME,'INTERNAL') | '%H%i%s' |
+
+If the second argument is not one of `'USA', 'JIS', 'ISO', 'EUR', 'INTERNAL'`
or is NULL, the function returns NULL.
+
+## Examples
+```sql
+SELECT * FROM get_format_test
+```
+```text
++------+----------+
+| id | lc |
++------+----------+
+| 1 | USA |
+| 2 | JIS |
+| 3 | ISO |
+| 4 | EUR |
+| 5 | INTERNAL |
+| 6 | Doris |
++------+----------+
+```
+
+```sql
+SELECT lc, GET_FORMAT(DATE, lc) FROM get_format_test;
+```
+```text
++----------+----------------------+
+| lc | GET_FORMAT(DATE, lc) |
++----------+----------------------+
+| USA | %m.%d.%Y |
+| JIS | %Y-%m-%d |
+| ISO | %Y-%m-%d |
+| EUR | %d.%m.%Y |
+| INTERNAL | %Y%m%d |
+| Doris | NULL |
++----------+----------------------+
+```
+
+```sql
+SELECT lc, GET_FORMAT(DATETIME, lc) FROM get_format_test;
+```
+```text
++----------+--------------------------+
+| lc | GET_FORMAT(DATETIME, lc) |
++----------+--------------------------+
+| USA | %Y-%m-%d %H.%i.%s |
+| JIS | %Y-%m-%d %H:%i:%s |
+| ISO | %Y-%m-%d %H:%i:%s |
+| EUR | %Y-%m-%d %H.%i.%s |
+| INTERNAL | %Y%m%d%H%i%s |
+| Doris | NULL |
++----------+--------------------------+
+```
+
+```sql
+SELECT lc, GET_FORMAT(TIME, lc) FROM get_format_test;
+```
+```text
++----------+----------------------+
+| lc | GET_FORMAT(TIME, lc) |
++----------+----------------------+
+| USA | %h:%i:%s %p |
+| JIS | %H:%i:%s |
+| ISO | %H:%i:%s |
+| EUR | %H.%i.%s |
+| INTERNAL | %H%i%s |
+| Doris | NULL |
++----------+----------------------+
+```
+
+```sql
+mysql> SELECT GET_FROMAT(ILLEGAL, 'USA');
+ERROR 1105 (HY000): errCode = 2, detailMessage =
+rule primaryExpression failed predicate: {
$functionName.text.equalsIgnoreCase("get_format") }?(line 1, pos 17)
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/get-format.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/get-format.md
new file mode 100644
index 00000000000..e505a1270c3
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/date-time-functions/get-format.md
@@ -0,0 +1,113 @@
+---
+{
+ "title": "GET_FORMAT",
+ "language": "zh-CN"
+}
+---
+
+## 描述
+
+返回特定的格式字符串
+
+该函数与 mysql 中的 [GET_FORMAT
函数](https://dev.mysql.com/doc/refman/8.4/en/date-and-time-functions.html#function_get-format)
行为一致
+
+
+## 语法
+
+```sql
+GET_FORMAT({DATE|DATETIME|TIME}, {'EUR'|'USA'|'JIS'|'ISO'|'INTERNAL'})
+```
+
+## 返回值
+
+返回一个格式字符串,不同参数最终的结果值如下表所示:
+| 函数调用 | 结果 |
+| ------------------------------- | ------------------- |
+| GET_FORMAT(DATE,'USA') | '%m.%d.%Y' |
+| GET_FORMAT(DATE,'JIS') | '%Y-%m-%d' |
+| GET_FORMAT(DATE,'ISO') | '%Y-%m-%d' |
+| GET_FORMAT(DATE,'EUR') | '%d.%m.%Y' |
+| GET_FORMAT(DATE,'INTERNAL') | '%Y%m%d' |
+| GET_FORMAT(DATETIME,'USA') | '%Y-%m-%d %H.%i.%s' |
+| GET_FORMAT(DATETIME,'JIS') | '%Y-%m-%d %H:%i:%s' |
+| GET_FORMAT(DATETIME,'ISO') | '%Y-%m-%d %H:%i:%s' |
+| GET_FORMAT(DATETIME,'EUR') | '%Y-%m-%d %H.%i.%s' |
+| GET_FORMAT(DATETIME,'INTERNAL') | '%Y%m%d%H%i%s' |
+| GET_FORMAT(TIME,'USA') | '%h:%i:%s %p' |
+| GET_FORMAT(TIME,'JIS') | '%H:%i:%s' |
+| GET_FORMAT(TIME,'ISO') | '%H:%i:%s' |
+| GET_FORMAT(TIME,'EUR') | '%H.%i.%s' |
+| GET_FORMAT(TIME,'INTERNAL') | '%H%i%s' |
+
+当第二个参数不为 `'USA', 'JIS', 'ISO', 'EUR', 'INTERNAL'` 之一或者为 NULL 时返回 NULL
+
+## 举例
+```sql
+SELECT * FROM get_format_test
+```
+```text
++------+----------+
+| id | lc |
++------+----------+
+| 1 | USA |
+| 2 | JIS |
+| 3 | ISO |
+| 4 | EUR |
+| 5 | INTERNAL |
+| 6 | Doris |
++------+----------+
+```
+
+```sql
+SELECT lc, GET_FORMAT(DATE, lc) FROM get_format_test;
+```
+```text
++----------+----------------------+
+| lc | GET_FORMAT(DATE, lc) |
++----------+----------------------+
+| USA | %m.%d.%Y |
+| JIS | %Y-%m-%d |
+| ISO | %Y-%m-%d |
+| EUR | %d.%m.%Y |
+| INTERNAL | %Y%m%d |
+| Doris | NULL |
++----------+----------------------+
+```
+
+```sql
+SELECT lc, GET_FORMAT(DATETIME, lc) FROM get_format_test;
+```
+```text
++----------+--------------------------+
+| lc | GET_FORMAT(DATETIME, lc) |
++----------+--------------------------+
+| USA | %Y-%m-%d %H.%i.%s |
+| JIS | %Y-%m-%d %H:%i:%s |
+| ISO | %Y-%m-%d %H:%i:%s |
+| EUR | %Y-%m-%d %H.%i.%s |
+| INTERNAL | %Y%m%d%H%i%s |
+| Doris | NULL |
++----------+--------------------------+
+```
+
+```sql
+SELECT lc, GET_FORMAT(TIME, lc) FROM get_format_test;
+```
+```text
++----------+----------------------+
+| lc | GET_FORMAT(TIME, lc) |
++----------+----------------------+
+| USA | %h:%i:%s %p |
+| JIS | %H:%i:%s |
+| ISO | %H:%i:%s |
+| EUR | %H.%i.%s |
+| INTERNAL | %H%i%s |
+| Doris | NULL |
++----------+----------------------+
+```
+
+```sql
+mysql> SELECT GET_FROMAT(ILLEGAL, 'USA');
+ERROR 1105 (HY000): errCode = 2, detailMessage =
+rule primaryExpression failed predicate: {
$functionName.text.equalsIgnoreCase("get_format") }?(line 1, pos 17)
+```
\ No newline at end of file
diff --git a/sidebars.json b/sidebars.json
index 6799788352f..1e0cb892603 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1364,6 +1364,7 @@
"sql-manual/sql-functions/scalar-functions/date-time-functions/from-millisecond",
"sql-manual/sql-functions/scalar-functions/date-time-functions/from-second",
"sql-manual/sql-functions/scalar-functions/date-time-functions/from-unixtime",
+
"sql-manual/sql-functions/scalar-functions/date-time-functions/get-format",
"sql-manual/sql-functions/scalar-functions/date-time-functions/hour",
"sql-manual/sql-functions/scalar-functions/date-time-functions/hour-ceil",
"sql-manual/sql-functions/scalar-functions/date-time-functions/hour-floor",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]