-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Cherry-picked from #44326 Co-authored-by: Mryange <[email protected]>
- Loading branch information
1 parent
90c1e58
commit 0075a83
Showing
5 changed files
with
124 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
regression-test/data/correctness/test_cast_decimalv3_as_bool.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !select1 -- | ||
0.000 13131.213132100 0E-16 | ||
0.000 2131231.231000000 2.3323000E-9 | ||
3.141 0E-9 123123.2131231231322130 | ||
|
||
-- !select2 -- | ||
false true false | ||
false true true | ||
true false true | ||
|
||
-- !select3 -- | ||
true 1 true false | ||
|
||
-- !select3 -- | ||
true 1 true false | ||
|
55 changes: 55 additions & 0 deletions
55
regression-test/suites/correctness/test_cast_decimalv3_as_bool.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// 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. | ||
|
||
suite("test_cast_decimalv3_as_bool") { | ||
sql """ DROP TABLE IF EXISTS cast_decimalv3_as_bool """ | ||
sql """ | ||
CREATE TABLE IF NOT EXISTS cast_decimalv3_as_bool ( | ||
`id` int(11) , | ||
`k1` decimalv3(9,3) , | ||
`k2` decimalv3(18,9) , | ||
`k3` decimalv3(38,16) , | ||
) | ||
UNIQUE KEY(`id`) | ||
DISTRIBUTED BY HASH(`id`) BUCKETS 10 | ||
PROPERTIES ( | ||
"enable_unique_key_merge_on_write" = "true", | ||
"replication_num" = "1" | ||
); | ||
""" | ||
sql """ | ||
set enable_nereids_planner=true,enable_fold_constant_by_be = false | ||
""" | ||
sql """ | ||
INSERT INTO cast_decimalv3_as_bool VALUES | ||
(1,0.00001,13131.2131321,0.000000000000000000), | ||
(2,0.00000,2131231.231,0.0000000023323), | ||
(3,3.141414,0.0000000000,123123.213123123132213); | ||
""" | ||
qt_select1 """ | ||
select k1,k2,k3 from cast_decimalv3_as_bool order by id | ||
""" | ||
qt_select2 """ | ||
select cast(k1 as boolean), cast(k2 as boolean) , cast(k3 as boolean) from cast_decimalv3_as_bool order by id | ||
""" | ||
qt_select3""" | ||
select cast(3.00001 as boolean), cast(cast(3.00001 as boolean) as int),cast(0.001 as boolean),cast(0.000 as boolean); | ||
""" | ||
qt_select3""" | ||
select cast(cast(3.00001 as double)as boolean), cast(cast(cast(3.00001 as double) as boolean) as int),cast(cast(0.001 as double) as boolean),cast(cast(0.000 as double) as boolean); | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters