|
| 1 | + |
| 2 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +// or more contributor license agreements. See the NOTICE file |
| 4 | +// distributed with this work for additional information |
| 5 | +// regarding copyright ownership. The ASF licenses this file |
| 6 | +// to you under the Apache License, Version 2.0 (the |
| 7 | +// "License"); you may not use this file except in compliance |
| 8 | +// with the License. You may obtain a copy of the License at |
| 9 | +// |
| 10 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +// |
| 12 | +// Unless required by applicable law or agreed to in writing, |
| 13 | +// software distributed under the License is distributed on an |
| 14 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +// KIND, either express or implied. See the License for the |
| 16 | +// specific language governing permissions and limitations |
| 17 | +// under the License. |
| 18 | + |
| 19 | +suite("test_datev1") { |
| 20 | + def tbName = "test_datev1_exprs" |
| 21 | + |
| 22 | + sql """set enable_nereids_planner=true""" |
| 23 | + sql """set enable_fallback_to_original_planner=false""" |
| 24 | + sql """set enable_nereids_dml=true""" |
| 25 | + |
| 26 | + sql "DROP TABLE IF EXISTS ${tbName}" |
| 27 | + sql """ |
| 28 | + create table ${tbName}(k1 datetimev1, k2 int) distributed by hash(k1) buckets 1 properties("replication_num" = "1"); |
| 29 | + """ |
| 30 | + sql """ insert into ${tbName} values("2016-11-04 00:00:01", 1); """ |
| 31 | + |
| 32 | + qt_sql1 """ select dt |
| 33 | + from |
| 34 | + ( |
| 35 | + select cast(k1 as datev1) as dt |
| 36 | + from ${tbName} |
| 37 | + ) r; """ |
| 38 | + qt_sql2 """ select dt |
| 39 | + from |
| 40 | + ( |
| 41 | + select cast(k1 as date) as dt |
| 42 | + from ${tbName} |
| 43 | + ) r; """ |
| 44 | + sql "DROP TABLE ${tbName}" |
| 45 | + |
| 46 | + tbName = "test_datev1_runtime_filter" |
| 47 | + sql "DROP TABLE IF EXISTS ${tbName}" |
| 48 | + sql """ |
| 49 | + CREATE TABLE IF NOT EXISTS ${tbName} ( |
| 50 | + c0 int, |
| 51 | + c2 datev1, |
| 52 | + c3 datetimev1 |
| 53 | + ) |
| 54 | + DISTRIBUTED BY HASH(c0) BUCKETS 5 properties("replication_num" = "1"); |
| 55 | + """ |
| 56 | + sql "insert into ${tbName} values(1, '2000-01-01', '2000-01-01 11:11:11')" |
| 57 | + sql "insert into ${tbName} values(2, '2000-02-02', '2000-02-02 11:11:11')" |
| 58 | + sql "insert into ${tbName} values(3, '2000-03-02', '2000-03-02 11:11:11')" |
| 59 | + |
| 60 | + qt_sql1 "select * from ${tbName} ORDER BY c2" |
| 61 | + |
| 62 | + sql " set runtime_filter_type = 1; " |
| 63 | + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" |
| 64 | + |
| 65 | + sql " set runtime_filter_type = 2; " |
| 66 | + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" |
| 67 | + |
| 68 | + sql " set runtime_filter_type = 4; " |
| 69 | + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" |
| 70 | + |
| 71 | + sql " set runtime_filter_type = 8; " |
| 72 | + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" |
| 73 | + |
| 74 | + sql " set runtime_filter_wait_time_ms = 0; " |
| 75 | + |
| 76 | + sql " set runtime_filter_type = 1; " |
| 77 | + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" |
| 78 | + |
| 79 | + sql " set runtime_filter_type = 2; " |
| 80 | + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" |
| 81 | + |
| 82 | + sql " set runtime_filter_type = 4; " |
| 83 | + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" |
| 84 | + |
| 85 | + sql " set runtime_filter_type = 8; " |
| 86 | + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" |
| 87 | + |
| 88 | + sql "DROP TABLE ${tbName}" |
| 89 | +} |
0 commit comments