Skip to content

Commit 3209b98

Browse files
authored
feat: verify local_timestamp (apache#4331)
1 parent dc08a96 commit 3209b98

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

docs/source/contributor-guide/spark_expressions_support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
- [ ] from_utc_timestamp
242242
- [x] hour
243243
- [x] last_day
244-
- [ ] localtimestamp
244+
- [x] localtimestamp
245245
- [x] make_date
246246
- [ ] make_dt_interval
247247
- [ ] make_interval

docs/source/user-guide/latest/expressions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ of expressions that be disabled.
113113
| FromUnixTime | `from_unixtime` |
114114
| Hour | `hour` |
115115
| LastDay | `last_day` |
116+
| LocalTimestamp | `localtimestamp` |
116117
| MakeDate | `make_date` |
117118
| Minute | `minute` |
118119
| NextDay | `next_day` |
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- Licensed to the Apache Software Foundation (ASF) under one
2+
-- or more contributor license agreements. See the NOTICE file
3+
-- distributed with this work for additional information
4+
-- regarding copyright ownership. The ASF licenses this file
5+
-- to you under the Apache License, Version 2.0 (the
6+
-- "License"); you may not use this file except in compliance
7+
-- with the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing,
12+
-- software distributed under the License is distributed on an
13+
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
-- KIND, either express or implied. See the License for the
15+
-- specific language governing permissions and limitations
16+
-- under the License.
17+
18+
statement
19+
CREATE TABLE test_local_timestamp(id int) USING parquet
20+
21+
statement
22+
INSERT INTO test_local_timestamp VALUES (1), (2), (3), (4), (NULL)
23+
24+
query
25+
SELECT localtimestamp() IS NOT NULL
26+
27+
query
28+
SELECT id, localtimestamp() IS NOT NULL FROM test_local_timestamp
29+
30+
query
31+
SELECT id FROM test_local_timestamp WHERE localtimestamp() = localtimestamp()
32+
33+
query
34+
SELECT year(localtimestamp()) = year(current_date())

0 commit comments

Comments
 (0)