33import static io .trino .spi .type .VarcharType .VARCHAR ;
44import static io .trino .testing .DataProviders .toDataProvider ;
55import static io .trino .testing .MaterializedResult .resultBuilder ;
6+ import static io .trino .testing .TestingConnectorBehavior .SUPPORTS_CREATE_TABLE ;
67import static io .trino .testing .TestingConnectorBehavior .SUPPORTS_INSERT ;
78import static io .trino .testing .assertions .Assert .assertEquals ;
89import static io .trino .tpch .TpchTable .CUSTOMER ;
@@ -102,22 +103,6 @@ protected TestTable createTableWithDefaultColumns() {
102103 throw new SkipException ("test disabled for RediSearch" );
103104 }
104105
105- @ Test
106- public void testLimitMax () {
107- int maxLimit = 1000000 ;
108- // max int
109- assertQuery ("SELECT orderkey FROM orders LIMIT " + maxLimit );
110- assertQuery ("SELECT orderkey FROM orders ORDER BY orderkey LIMIT " + maxLimit );
111-
112- // max long; a connector may attempt a pushdown while remote system may not
113- // accept such high limit values
114- assertQuery ("SELECT nationkey FROM nation LIMIT " + maxLimit , "SELECT nationkey FROM nation" );
115- // Currently this is not supported but once it's supported, it should be tested
116- // with connectors as well
117- assertQueryFails ("SELECT nationkey FROM nation ORDER BY nationkey LIMIT " + Long .MAX_VALUE ,
118- "ORDER BY LIMIT > 2147483647 is not supported" );
119- }
120-
121106 @ Override
122107 public void testShowSchemasLikeWithEscape () {
123108 throw new SkipException ("Not supported by RediSearch connector" );
@@ -158,6 +143,24 @@ public void testShowColumns() {
158143 throw new SkipException ("Not supported by RediSearch connector" );
159144 }
160145
146+ @ Override
147+ @ Test
148+ public void testLimitMax () {
149+ int maxLimit = 1000000 ;
150+ // max int
151+ assertQuery ("SELECT orderkey FROM orders LIMIT " + maxLimit );
152+ assertQuery ("SELECT orderkey FROM orders ORDER BY orderkey LIMIT " + maxLimit );
153+
154+ // max long; a connector may attempt a pushdown while remote system may not
155+ // accept such high limit values
156+ assertQuery ("SELECT nationkey FROM nation LIMIT " + maxLimit , "SELECT nationkey FROM nation" );
157+ // Currently this is not supported but once it's supported, it should be tested
158+ // with connectors as well
159+ assertQueryFails ("SELECT nationkey FROM nation ORDER BY nationkey LIMIT " + Long .MAX_VALUE ,
160+ "ORDER BY LIMIT > 2147483647 is not supported" );
161+ }
162+
163+ @ SuppressWarnings ("resource" )
161164 @ Test
162165 public void testInsert () {
163166 if (!hasBehavior (SUPPORTS_INSERT )) {
@@ -167,9 +170,7 @@ public void testInsert() {
167170
168171 String query = "SELECT phone, custkey, acctbal FROM customer" ;
169172
170- try (QueryRunner queryRunner = getQueryRunner ();
171- TestTable table = new TestTable (queryRunner ::execute , "test_insert_" ,
172- "AS " + query + " WITH NO DATA" )) {
173+ try (TestTable table = new TestTable (getQueryRunner ()::execute , "test_insert_" , "AS " + query + " WITH NO DATA" )) {
173174 assertQuery ("SELECT count(*) FROM " + table .getName () + "" , "SELECT 0" );
174175
175176 assertUpdate ("INSERT INTO " + table .getName () + " " + query , "SELECT count(*) FROM customer" );
@@ -233,17 +234,20 @@ public void testDescribeTable() {
233234 assertEquals (actualColumns , expectedColumns );
234235 }
235236
237+ @ SuppressWarnings ("deprecation" )
236238 @ Test (dataProvider = "testCaseSensitiveDataMappingProvider" , enabled = false )
237239 public void testCaseSensitiveDataMapping (DataMappingTestSetup dataMappingTestSetup ) {
238240 }
239241
242+ @ SuppressWarnings ("deprecation" )
240243 @ Test (dataProvider = "testRediSearchDataMappingSmokeTestDataProvider" )
241244 public void testDataMappingSmokeTest (DataMappingTestSetup dataMappingTestSetup ) {
242245 testDataMapping (dataMappingTestSetup );
243246 }
244247
248+ @ SuppressWarnings ("deprecation" )
245249 private void testDataMapping (DataMappingTestSetup dataMappingTestSetup ) {
246- skipTestUnless (supportsCreateTable ( ));
250+ skipTestUnless (hasBehavior ( SUPPORTS_CREATE_TABLE ));
247251
248252 String trinoTypeName = dataMappingTestSetup .getTrinoTypeName ();
249253 String sampleValueLiteral = dataMappingTestSetup .getSampleValueLiteral ();
@@ -289,12 +293,14 @@ private void testDataMapping(DataMappingTestSetup dataMappingTestSetup) {
289293 assertUpdate ("DROP TABLE " + tableName );
290294 }
291295
296+ @ SuppressWarnings ("deprecation" )
292297 @ DataProvider
293298 public final Object [][] testRediSearchDataMappingSmokeTestDataProvider () {
294299 return testDataMappingSmokeTestData ().stream ().map (this ::filterDataMappingSmokeTestData )
295300 .flatMap (Optional ::stream ).collect (toDataProvider ());
296301 }
297302
303+ @ SuppressWarnings ("deprecation" )
298304 private List <DataMappingTestSetup > testDataMappingSmokeTestData () {
299305 return ImmutableList .<DataMappingTestSetup >builder ()
300306// .add(new DataMappingTestSetup("boolean", "false", "true"))
0 commit comments