eldenmoon commented on code in PR #50748: URL: https://github.com/apache/doris/pull/50748#discussion_r2083790663
########## regression-test/suites/variant_p0/test_variant_is_null_expr.groovy: ########## @@ -0,0 +1,70 @@ +// 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_variant_is_null_expr", "p0, nonConcurrent") { + // define a sql table + def testTable = "test_variant_is_null_expr" + + sql """ DROP TABLE IF EXISTS ${testTable} """ + sql """ + CREATE TABLE ${testTable} ( + `k` int(11) NULL COMMENT "", + `v` variant NULL COMMENT "", + INDEX idx_a (v) USING INVERTED + ) ENGINE=OLAP + DUPLICATE KEY(`k`) + COMMENT "OLAP" + DISTRIBUTED BY HASH(`k`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + sql """ + INSERT INTO ${testTable} VALUES (1, '{"int1" : 1, "string1" : "aa"}'), (2, '{"int2" : 2, "string2" : "bb"}'), (3, '{"int3" : 3, "string3" : "cc"}'); + """ + + + def queryAndCheck = { String sqlQuery, int expectedFilteredRows = -1, boolean checkFilterUsed = true -> + def checkpoints_name = "segment_iterator.inverted_index.filtered_rows" + try { + GetDebugPoint().enableDebugPointForAllBEs("segment_iterator.apply_inverted_index") + GetDebugPoint().enableDebugPointForAllBEs(checkpoints_name, [filtered_rows: expectedFilteredRows]) + sql "set experimental_enable_parallel_scan = false" + sql " set inverted_index_skip_threshold = 0 " + sql "sync" + sql "${sqlQuery}" + } finally { + GetDebugPoint().disableDebugPointForAllBEs(checkpoints_name) + GetDebugPoint().disableDebugPointForAllBEs("segment_iterator.apply_inverted_index") + } + } + + queryAndCheck (" select * from ${testTable} where v['int1'] is not null; ", 2) + queryAndCheck (" select * from ${testTable} where v['int1'] is null; ", 1) + queryAndCheck (" select * from ${testTable} where v['string1'] is not null; ", 2) + queryAndCheck (" select * from ${testTable} where v['string1'] is null; ", 1) + queryAndCheck (" select * from ${testTable} where v['int1'] is not null or v['string2'] is not null; ", 1) + queryAndCheck (" select * from ${testTable} where v['int1'] is not null or v['string2'] is null; ", 1) Review Comment: add cast case -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
