[Enhance] Add prepare phase for some timestamp functions (#3947)
Fix: #3946 CL: 1. Add prepare phase for `from_unixtime()`, `date_format()` and `convert_tz()` functions, to handle the format string once for all. 2. Find the cctz timezone when init `runtime state`, so that don't need to find timezone for each rows. 3. Add constant rewrite rule for `utc_timestamp()` 4. Add doc for `to_date()` 5. Comment out the `push_handler_test`, it can not run in DEBUG mode, will be fixed later. 6. Remove `timezone_db.h/cpp` and add `timezone_utils.h/cpp` The performance shows bellow: 11,000,000 rows SQL1: `select count(from_unixtime(k1)) from tbl1;` Before: 8.85s After: 2.85s SQL2: `select count(from_unixtime(k1, '%Y-%m-%d %H:%i:%s')) from tbl1 limit 1;` Before: 10.73s After: 4.85s The date string format seems still slow, we may need a further enhancement about it.
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
---
|
||||
{
|
||||
"title": "to_date",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# to_date
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
`DATE TO_DATE(DATETIME)`
|
||||
|
||||
Return the DATE part of DATETIME value.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select to_date("2020-02-02 00:00:00");
|
||||
+--------------------------------+
|
||||
| to_date('2020-02-02 00:00:00') |
|
||||
+--------------------------------+
|
||||
| 2020-02-02 |
|
||||
+--------------------------------+
|
||||
```
|
||||
|
||||
##keyword
|
||||
|
||||
TO_DATE
|
||||
Reference in New Issue
Block a user