Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
-- !select --
0

-- !select --
0

-- !select --
0

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
// specific language governing permissions and limitations
// under the License.

suite("test_constant_fold", "query") {
suite("test_compound_predicate_constant_child", "query") {
// define a sql table
def testTable = "test_constant_fold_fuzzy"
def testTable = "test_compound_predicate_constant_child"
sql """drop table if exists ${testTable};"""

sql """
CREATE TABLE IF NOT EXISTS ${testTable} (
Expand Down Expand Up @@ -51,4 +52,20 @@ suite("test_constant_fold", "query") {
(NOT ((true)||(CASE ${testTable}.c0 WHEN ${testTable}.c0 THEN false WHEN ${testTable}.c0 THEN true ELSE true END ))) AS INT) as count
FROM ${testTable}) as res;
"""

sql """ set enable_fold_constant_by_be=true """

qt_select """ SELECT SUM(count) FROM
(SELECT CAST((NOT ((1378719999)||(CASE ${testTable}.c0 WHEN ${testTable}.c0 THEN -388844163 WHEN ${testTable}.c0 THEN 1455674610 ELSE 671348352 END ))) IS NOT NULL AND
(NOT ((1378719999)||(CASE ${testTable}.c0 WHEN ${testTable}.c0 THEN -388844163 WHEN ${testTable}.c0 THEN 1455674610 ELSE 671348352 END ))) AS INT) as count
FROM ${testTable}) as res;
"""

sql """ set enable_fold_constant_by_be=false """

qt_select """ SELECT SUM(count) FROM
(SELECT CAST((NOT ((1378719999)||(CASE ${testTable}.c0 WHEN ${testTable}.c0 THEN -388844163 WHEN ${testTable}.c0 THEN 1455674610 ELSE 671348352 END ))) IS NOT NULL AND
(NOT ((1378719999)||(CASE ${testTable}.c0 WHEN ${testTable}.c0 THEN -388844163 WHEN ${testTable}.c0 THEN 1455674610 ELSE 671348352 END ))) AS INT) as count
FROM ${testTable}) as res;
"""
}