vvysotskyi commented on a change in pull request #1714: DRILL-7048: Implement JDBC Statement.setMaxRows() with System Option URL: https://github.com/apache/drill/pull/1714#discussion_r272122067
########## File path: exec/jdbc/src/test/java/org/apache/drill/jdbc/PreparedStatementMaxRowsTest.java ########## @@ -0,0 +1,265 @@ +/* + * 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. + */ +package org.apache.drill.jdbc; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Properties; +import java.util.Random; +import java.util.concurrent.Semaphore; + +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.planner.physical.PlannerSettings; +import org.apache.drill.categories.JdbcTest; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import org.junit.experimental.categories.Category; + +/** + * Test for Drill's implementation of PreparedStatement's get/setMaxRows methods + */ +@Category(JdbcTest.class) +public class PreparedStatementMaxRowsTest extends JdbcTestBase { + +// private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PreparedStatementMaxRowsTest.class); + private static final Random RANDOMIZER = new Random(20150304); + + private static final String SYS_OPTIONS_SQL = "SELECT * FROM sys.options"; + private static final String SYS_OPTIONS_SQL_LIMIT_10 = "SELECT * FROM sys.options LIMIT 12"; + private static final String ALTER_SYS_OPTIONS_MAX_ROWS_LIMIT_X = "ALTER SYSTEM SET `" + ExecConstants.QUERY_MAX_ROWS + "`="; + // Lock used by all tests to avoid corrupting test scenario + static final Semaphore maxRowsSysOptionLock = new Semaphore(1); + + private static Connection connection; + + + @BeforeClass + public static void setUpConnection() throws SQLException { + Driver.load(); + Properties properties = new Properties(); + // Increased prepared statement creation timeout so test doesn't timeout on my laptop Review comment: Please rephrase it to: ```suggestion // Increased prepared statement creation timeout to avoid timeout failures ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services