Skip to content

Commit ae02a1d

Browse files
skalashnikovdevozerov
authored andcommitted
IGNITE-6024: SQL: Implemented "skipReducerOnUpdate" flag. This closes apache#2488.
1 parent 5ec744c commit ae02a1d

File tree

61 files changed

+3999
-296
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3999
-296
lines changed

modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.apache.ignite.testframework.GridTestUtils;
3232
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
3333
import org.jetbrains.annotations.NotNull;
34-
import org.jetbrains.annotations.Nullable;
3534

3635
import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
3736

@@ -315,6 +314,7 @@ public void testSqlHints() throws Exception {
315314
assertFalse(((JdbcConnection)conn).isDistributedJoins());
316315
assertFalse(((JdbcConnection)conn).isCollocatedQuery());
317316
assertFalse(((JdbcConnection)conn).isLazy());
317+
assertFalse(((JdbcConnection)conn).skipReducerOnUpdate());
318318
}
319319

320320
try (final Connection conn = DriverManager.getConnection(CFG_URL_PREFIX + "distributedJoins=true@"
@@ -323,6 +323,7 @@ public void testSqlHints() throws Exception {
323323
assertTrue(((JdbcConnection)conn).isDistributedJoins());
324324
assertFalse(((JdbcConnection)conn).isCollocatedQuery());
325325
assertFalse(((JdbcConnection)conn).isLazy());
326+
assertFalse(((JdbcConnection)conn).skipReducerOnUpdate());
326327
}
327328

328329
try (final Connection conn = DriverManager.getConnection(CFG_URL_PREFIX + "collocated=true@"
@@ -331,13 +332,23 @@ public void testSqlHints() throws Exception {
331332
assertFalse(((JdbcConnection)conn).isDistributedJoins());
332333
assertTrue(((JdbcConnection)conn).isCollocatedQuery());
333334
assertFalse(((JdbcConnection)conn).isLazy());
335+
assertFalse(((JdbcConnection)conn).skipReducerOnUpdate());
334336
}
335337

336338
try (final Connection conn = DriverManager.getConnection(CFG_URL_PREFIX + "lazy=true@" + configURL())) {
337339
assertFalse(((JdbcConnection)conn).isEnforceJoinOrder());
338340
assertFalse(((JdbcConnection)conn).isDistributedJoins());
339341
assertFalse(((JdbcConnection)conn).isCollocatedQuery());
340342
assertTrue(((JdbcConnection)conn).isLazy());
343+
assertFalse(((JdbcConnection)conn).skipReducerOnUpdate());
344+
}
345+
try (final Connection conn = DriverManager.getConnection(CFG_URL_PREFIX + "skipReducerOnUpdate=true@"
346+
+ configURL())) {
347+
assertFalse(((JdbcConnection)conn).isEnforceJoinOrder());
348+
assertFalse(((JdbcConnection)conn).isDistributedJoins());
349+
assertFalse(((JdbcConnection)conn).isCollocatedQuery());
350+
assertFalse(((JdbcConnection)conn).isLazy());
351+
assertTrue(((JdbcConnection)conn).skipReducerOnUpdate());
341352
}
342353
}
343354
}

modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
import org.apache.ignite.jdbc.thin.JdbcThinSelectAfterAlterTable;
5959
import org.apache.ignite.jdbc.thin.JdbcThinStatementSelfTest;
6060
import org.apache.ignite.jdbc.thin.JdbcThinUpdateStatementSelfTest;
61+
import org.apache.ignite.jdbc.thin.JdbcThinComplexDmlDdlSkipReducerOnUpdateSelfTest;
62+
import org.apache.ignite.jdbc.thin.JdbcThinInsertStatementSkipReducerOnUpdateSelfTest;
63+
import org.apache.ignite.jdbc.thin.JdbcThinMergeStatementSkipReducerOnUpdateSelfTest;
64+
import org.apache.ignite.jdbc.thin.JdbcThinUpdateStatementSkipReducerOnUpdateSelfTest;
6165

6266
/**
6367
* JDBC driver test suite.
@@ -152,6 +156,13 @@ public static TestSuite suite() throws Exception {
152156

153157
suite.addTest(new TestSuite(JdbcThinSelectAfterAlterTable.class));
154158

159+
// Update on server
160+
suite.addTest(new TestSuite(JdbcThinInsertStatementSkipReducerOnUpdateSelfTest.class));
161+
suite.addTest(new TestSuite(JdbcThinUpdateStatementSkipReducerOnUpdateSelfTest.class));
162+
suite.addTest(new TestSuite(JdbcThinMergeStatementSkipReducerOnUpdateSelfTest.class));
163+
suite.addTest(new TestSuite(JdbcThinComplexDmlDdlSkipReducerOnUpdateSelfTest.class));
164+
165+
155166
return suite;
156167
}
157168
}

modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAbstractDmlStatementSelfTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.Serializable;
2121
import java.sql.Connection;
2222
import java.sql.DriverManager;
23+
import java.sql.SQLException;
2324
import java.util.Collections;
2425
import org.apache.ignite.cache.QueryEntity;
2526
import org.apache.ignite.cache.query.annotations.QuerySqlField;
@@ -42,9 +43,6 @@ public abstract class JdbcThinAbstractDmlStatementSelfTest extends JdbcThinAbstr
4243
/** IP finder. */
4344
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
4445

45-
/** URL. */
46-
private static final String URL = "jdbc:ignite:thin://127.0.0.1/";
47-
4846
/** SQL SELECT query for verification. */
4947
static final String SQL_SELECT = "select _key, id, firstName, lastName, age from Person";
5048

@@ -67,7 +65,7 @@ public abstract class JdbcThinAbstractDmlStatementSelfTest extends JdbcThinAbstr
6765
@Override protected void beforeTest() throws Exception {
6866
ignite(0).getOrCreateCache(cacheConfig());
6967

70-
conn = DriverManager.getConnection(URL);
68+
conn = createConnection();
7169

7270
conn.setSchema('"' + DEFAULT_CACHE_NAME + '"');
7371
}
@@ -81,6 +79,14 @@ public abstract class JdbcThinAbstractDmlStatementSelfTest extends JdbcThinAbstr
8179
assertTrue(conn.isClosed());
8280
}
8381

82+
/**
83+
* @return JDBC connection.
84+
* @throws SQLException On error.
85+
*/
86+
protected Connection createConnection() throws SQLException {
87+
return DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1/");
88+
}
89+
8490
/** {@inheritDoc} */
8591
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
8692
return getConfiguration0(igniteInstanceName);

modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinComplexDmlDdlSelfTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ private CacheConfiguration cacheConfiguration(@NotNull String name) throws Excep
9393
return cfg;
9494
}
9595

96+
/**
97+
* @return JDBC connection.
98+
* @throws SQLException On error.
99+
*/
100+
protected Connection createConnection() throws SQLException {
101+
return DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1");
102+
}
103+
96104
/** {@inheritDoc} */
97105
@Override protected void beforeTestsStarted() throws Exception {
98106
super.beforeTestsStarted();
@@ -109,7 +117,7 @@ private CacheConfiguration cacheConfiguration(@NotNull String name) throws Excep
109117
@Override protected void beforeTest() throws Exception {
110118
super.beforeTest();
111119

112-
conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1");
120+
conn = createConnection();
113121
}
114122

115123
/** {@inheritDoc} */
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.jdbc.thin;
19+
20+
import java.sql.Connection;
21+
import java.sql.DriverManager;
22+
import java.sql.SQLException;
23+
import org.apache.ignite.jdbc.thin.JdbcThinComplexDmlDdlSelfTest;
24+
25+
/**
26+
* Base class for complex SQL tests based on JDBC driver.
27+
*/
28+
public class JdbcThinComplexDmlDdlSkipReducerOnUpdateSelfTest extends JdbcThinComplexDmlDdlSelfTest {
29+
/** {@inheritDoc} */
30+
@Override protected Connection createConnection() throws SQLException {
31+
return DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?skipReducerOnUpdate=true");
32+
}
33+
}

modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ public void testSqlHints() throws Exception {
187187
assertFalse(io(conn).collocated());
188188
assertFalse(io(conn).replicatedOnly());
189189
assertFalse(io(conn).lazy());
190+
assertFalse(io(conn).skipReducerOnUpdate());
190191
}
191192

192193
try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?distributedJoins=true")) {
@@ -195,6 +196,7 @@ public void testSqlHints() throws Exception {
195196
assertFalse(io(conn).collocated());
196197
assertFalse(io(conn).replicatedOnly());
197198
assertFalse(io(conn).lazy());
199+
assertFalse(io(conn).skipReducerOnUpdate());
198200
}
199201

200202
try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?enforceJoinOrder=true")) {
@@ -203,6 +205,7 @@ public void testSqlHints() throws Exception {
203205
assertFalse(io(conn).collocated());
204206
assertFalse(io(conn).replicatedOnly());
205207
assertFalse(io(conn).lazy());
208+
assertFalse(io(conn).skipReducerOnUpdate());
206209
}
207210

208211
try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?collocated=true")) {
@@ -211,6 +214,7 @@ public void testSqlHints() throws Exception {
211214
assertTrue(io(conn).collocated());
212215
assertFalse(io(conn).replicatedOnly());
213216
assertFalse(io(conn).lazy());
217+
assertFalse(io(conn).skipReducerOnUpdate());
214218
}
215219

216220
try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?replicatedOnly=true")) {
@@ -219,6 +223,7 @@ public void testSqlHints() throws Exception {
219223
assertFalse(io(conn).collocated());
220224
assertTrue(io(conn).replicatedOnly());
221225
assertFalse(io(conn).lazy());
226+
assertFalse(io(conn).skipReducerOnUpdate());
222227
}
223228

224229
try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?lazy=true")) {
@@ -227,15 +232,26 @@ public void testSqlHints() throws Exception {
227232
assertFalse(io(conn).collocated());
228233
assertFalse(io(conn).replicatedOnly());
229234
assertTrue(io(conn).lazy());
235+
assertFalse(io(conn).skipReducerOnUpdate());
236+
}
237+
238+
try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?skipReducerOnUpdate=true")) {
239+
assertFalse(io(conn).distributedJoins());
240+
assertFalse(io(conn).enforceJoinOrder());
241+
assertFalse(io(conn).collocated());
242+
assertFalse(io(conn).replicatedOnly());
243+
assertFalse(io(conn).lazy());
244+
assertTrue(io(conn).skipReducerOnUpdate());
230245
}
231246

232247
try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?distributedJoins=true&" +
233-
"enforceJoinOrder=true&collocated=true&replicatedOnly=true&lazy=true")) {
248+
"enforceJoinOrder=true&collocated=true&replicatedOnly=true&lazy=true&skipReducerOnUpdate=true")) {
234249
assertTrue(io(conn).distributedJoins());
235250
assertTrue(io(conn).enforceJoinOrder());
236251
assertTrue(io(conn).collocated());
237252
assertTrue(io(conn).replicatedOnly());
238253
assertTrue(io(conn).lazy());
254+
assertTrue(io(conn).skipReducerOnUpdate());
239255
}
240256
}
241257

modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinInsertStatementSelfTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.Arrays;
2525
import java.util.HashSet;
2626
import java.util.concurrent.Callable;
27-
import org.apache.ignite.IgniteCheckedException;
2827
import org.apache.ignite.testframework.GridTestUtils;
2928

3029
/**
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.jdbc.thin;
19+
20+
import java.sql.Connection;
21+
import java.sql.DriverManager;
22+
import java.sql.SQLException;
23+
import org.apache.ignite.jdbc.thin.JdbcThinInsertStatementSelfTest;
24+
25+
/**
26+
* Statement test.
27+
*/
28+
public class JdbcThinInsertStatementSkipReducerOnUpdateSelfTest extends JdbcThinInsertStatementSelfTest {
29+
/** {@inheritDoc} */
30+
@Override protected Connection createConnection() throws SQLException {
31+
return DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?skipReducerOnUpdate=true");
32+
}
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.jdbc.thin;
19+
20+
import java.sql.Connection;
21+
import java.sql.DriverManager;
22+
import java.sql.SQLException;
23+
import org.apache.ignite.jdbc.thin.JdbcThinMergeStatementSelfTest;
24+
25+
/**
26+
* MERGE statement test.
27+
*/
28+
public class JdbcThinMergeStatementSkipReducerOnUpdateSelfTest extends JdbcThinMergeStatementSelfTest {
29+
/** {@inheritDoc} */
30+
@Override protected Connection createConnection() throws SQLException {
31+
return DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?skipReducerOnUpdate=true");
32+
}
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.jdbc.thin;
19+
20+
import java.sql.Connection;
21+
import java.sql.DriverManager;
22+
import java.sql.SQLException;
23+
import org.apache.ignite.jdbc.thin.JdbcThinUpdateStatementSelfTest;
24+
25+
/**
26+
*
27+
*/
28+
public class JdbcThinUpdateStatementSkipReducerOnUpdateSelfTest extends JdbcThinUpdateStatementSelfTest {
29+
/** {@inheritDoc} */
30+
@Override protected Connection createConnection() throws SQLException {
31+
return DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1?skipReducerOnUpdate=true");
32+
}
33+
}

0 commit comments

Comments
 (0)