eldenmoon commented on code in PR #39468: URL: https://github.com/apache/doris/pull/39468#discussion_r1746501679
########## regression-test/suites/point_query_p0/test_point_query_partition_IN.groovy: ########## @@ -0,0 +1,139 @@ +// 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. + +import java.math.BigDecimal; + +suite("test_point_query_partition_IN") { + def user = context.config.jdbcUser + def password = context.config.jdbcPassword + def realDb = "regression_test_serving_p0" + def tableName = realDb + ".tbl_point_query_partition_IN" + sql "CREATE DATABASE IF NOT EXISTS ${realDb}" + // Parse url + String jdbcUrl = context.config.jdbcUrl + String urlWithoutSchema = jdbcUrl.substring(jdbcUrl.indexOf("://") + 3) + def sql_ip = urlWithoutSchema.substring(0, urlWithoutSchema.indexOf(":")) + def sql_port + if (urlWithoutSchema.indexOf("/") >= 0) { + // e.g: jdbc:mysql://locahost:8080/?a=b + sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") + 1, urlWithoutSchema.indexOf("/")) + } else { + // e.g: jdbc:mysql://locahost:8080 + sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") + 1) + } + // set server side prepared statement url + def prepare_url = "jdbc:mysql://" + sql_ip + ":" + sql_port + "/" + realDb + "?&useServerPrepStmts=true" + + def generateString = {len -> + def str = "" + for (int i = 0; i < len; i++) { + str += "a" + } + return str + } + + def nprep_sql = { sql_str -> + def url_without_prep = "jdbc:mysql://" + sql_ip + ":" + sql_port + "/" + realDb + connect(user = user, password = password, url = url_without_prep) { + sql sql_str + } + } + + sql """DROP TABLE IF EXISTS ${tableName}""" + sql """ + CREATE TABLE IF NOT EXISTS ${tableName} ( + `k1` int(11) NULL COMMENT "", + `value` text NULL COMMENT "" + ) ENGINE=OLAP + UNIQUE KEY(`k1`) + PARTITION BY RANGE(`k1`) + ( + PARTITION `p1` VALUES LESS THAN ("1"), + PARTITION `p2` VALUES LESS THAN ("10"), + PARTITION `p3` VALUES LESS THAN ("30"), + PARTITION `p4` VALUES LESS THAN ("40"), + PARTITION `p5` VALUES LESS THAN ("1000") + ) + DISTRIBUTED BY HASH(`k1`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "store_row_column" = "true", + "enable_unique_key_merge_on_write" = "true", + "light_schema_change" = "true", + "storage_format" = "V2") + """ + + sql """INSERT INTO ${tableName} VALUES (1, 'a')""" + sql """INSERT INTO ${tableName} VALUES (2, 'b')""" + sql """INSERT INTO ${tableName} VALUES (-1, 'c')""" + sql """INSERT INTO ${tableName} VALUES (11, 'd')""" + sql """INSERT INTO ${tableName} VALUES (15, 'e')""" + sql """INSERT INTO ${tableName} VALUES (33, 'f')""" + sql """INSERT INTO ${tableName} VALUES (45, 'g')""" + sql """INSERT INTO ${tableName} VALUES (999, 'h')""" + def result1 = connect(user=user, password=password, url=prepare_url) { + def stmt = prepareStatement "SELECT * FROM ${tableName} WHERE k1 IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ORDER BY k1" + assertEquals(stmt.class, com.mysql.cj.jdbc.ServerPreparedStatement); + stmt.setInt(1, 1) + stmt.setInt(2, 2) + stmt.setInt(3, 11) + stmt.setInt(4, -1) + stmt.setInt(5, 12) + stmt.setInt(6, 34) + stmt.setInt(7, 33) + stmt.setInt(8, 45) + stmt.setInt(9, 666) + stmt.setInt(10, 999) + stmt.setInt(11, 1000) + qe_point_in_select stmt + } + + sql "DROP TABLE IF EXISTS regression_test_serving_p0.customer_in"; + sql """ + CREATE TABLE regression_test_serving_p0.customer_in ( + `customer_key` BIGINT NULL, + `customer_value_0` TEXT NULL, + `customer_value_1` TEXT NULL, + `customer_value_2` TEXT NULL, + `customer_value_3` TEXT NULL, + `customer_value_4` TEXT NULL, + `customer_value_5` TEXT NULL, + `customer_value_6` TEXT NULL, + `customer_value_7` TEXT NULL, + `customer_value_8` TEXT NULL, + `customer_value_10` TEXT NULL + ) ENGINE=OLAP + UNIQUE KEY(`customer_key`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`customer_key`) BUCKETS 10 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "store_row_column" = "true" + ); + """ + sql """INSERT INTO regression_test_serving_p0.customer_in(customer_key, customer_value_0, customer_value_1) VALUES (686612, "686612", "686612")""" + sql """INSERT INTO regression_test_serving_p0.customer_in(customer_key, customer_value_0, customer_value_1) VALUES (686613, "686613", "686613")""" + def result3 = connect(user=user, password=password, url=prepare_url) { + def stmt = prepareStatement "SELECT /*+ SET_VAR(enable_nereids_planner=true) */ * FROM regression_test_serving_p0.customer_in WHERE customer_key IN (?, ?) ORDER BY customer_key" Review Comment: not add order by -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org