1818package org .apache .ignite .internal .processors .cache .distributed .near ;
1919
2020import java .io .Serializable ;
21- import java .util .Random ;
2221import org .apache .ignite .IgniteCache ;
2322import org .apache .ignite .cache .affinity .rendezvous .RendezvousAffinityFunction ;
2423import org .apache .ignite .cache .query .annotations .QuerySqlField ;
25- import org .apache .ignite .cache .query .annotations .QuerySqlFunction ;
2624import org .apache .ignite .configuration .CacheConfiguration ;
2725import org .apache .ignite .configuration .IgniteConfiguration ;
28- import org .apache .ignite .internal .IgniteInterruptedCheckedException ;
2926import org .apache .ignite .internal .processors .cache .index .AbstractIndexingCommonTest ;
30- import org .apache .ignite .internal .util .GridRandom ;
3127import org .apache .ignite .internal .util .typedef .F ;
32- import org .apache .ignite .internal . util . typedef . internal . U ;
28+ import org .apache .ignite .testframework . GridTestUtils ;
3329
3430import static org .apache .ignite .cache .CacheAtomicityMode .TRANSACTIONAL ;
3531import static org .apache .ignite .cache .CacheMode .PARTITIONED ;
@@ -65,10 +61,10 @@ public class IgniteCacheQueryAbstractDistributedJoinSelfTest extends AbstractInd
6561 "order by co._key, pr._key " ;
6662
6763 /** */
68- protected static final String QRY_LONG = "select pe.id, co.id, pr._key\n " +
64+ protected static final String QRY_LONG = "select id1 from (select pe.id as id1 , co.id, pr._key\n " +
6965 "from \" pe\" .Person pe, \" pr\" .Product pr, \" co\" .Company co, \" pu\" .Purchase pu\n " +
70- "where pe._key = pu.personId and pu.productId = pr._key and pr.companyId = co._key \n " +
71- "order by pe.id desc " ;
66+ "where pe._key = pu.personId and pu.productId = pr._key and pr.companyId = co._key\n " +
67+ "order by pe.id) where id1 > sleep(10) " ;
7268
7369 /** */
7470 protected static final int GRID_CNT = 2 ;
@@ -104,6 +100,7 @@ public class IgniteCacheQueryAbstractDistributedJoinSelfTest extends AbstractInd
104100 cc .setRebalanceMode (SYNC );
105101 cc .setLongQueryWarningTimeout (15_000 );
106102 cc .setAffinity (new RendezvousAffinityFunction (false , 60 ));
103+ cc .setSqlFunctionClasses (GridTestUtils .SqlTestFunctions .class );
107104
108105 switch (name ) {
109106 case "pe" :
@@ -163,10 +160,8 @@ private void fillCaches() {
163160
164161 IgniteCache <Integer , Product > pr = grid (0 ).cache ("pr" );
165162
166- Random rnd = new GridRandom ();
167-
168163 for (int i = 0 ; i < PRODUCT_CNT ; i ++)
169- pr .put (i , new Product (i , rnd . nextInt ( COMPANY_CNT ) ));
164+ pr .put (i , new Product (i , i % COMPANY_CNT ));
170165
171166 IgniteCache <Integer , Person > pe = grid (0 ).cache ("pe" );
172167
@@ -176,8 +171,8 @@ private void fillCaches() {
176171 IgniteCache <Integer , Purchase > pu = grid (0 ).cache ("pu" );
177172
178173 for (int i = 0 ; i < PURCHASE_CNT ; i ++) {
179- int persId = rnd . nextInt ( PERS_CNT ) ;
180- int prodId = rnd . nextInt ( PRODUCT_CNT ) ;
174+ int persId = i % PERS_CNT ;
175+ int prodId = i % PRODUCT_CNT ;
181176
182177 pu .put (i , new Purchase (persId , prodId ));
183178 }
@@ -258,20 +253,4 @@ protected static class Product implements Serializable {
258253 this .companyId = companyId ;
259254 }
260255 }
261-
262- /** */
263- public static class Functions {
264- /** */
265- @ QuerySqlFunction
266- public static int sleep () {
267- try {
268- U .sleep (1_000 );
269- }
270- catch (IgniteInterruptedCheckedException ignored ) {
271- // No-op.
272- }
273-
274- return 0 ;
275- }
276- }
277256}
0 commit comments