@@ -52,87 +52,9 @@ public void testJoinTimeoutHintPreventsPointInTimeExpiration() throws IOExceptio
52
52
assertTrue ("Should respect LIMIT" , resultsCount <= 10 );
53
53
}
54
54
55
- /** Test that JOIN_TIME_OUT hint works with different join types (LEFT JOIN) */
56
- @ Test
57
- public void testJoinTimeoutHintWithLeftJoin () throws IOException {
58
- String query =
59
- String .format (
60
- Locale .ROOT ,
61
- "SELECT /*! JOIN_TIME_OUT(180) */ a.firstname, d.dog_name "
62
- + "FROM %s a LEFT JOIN %s d ON d.holdersName = a.firstname "
63
- + "WHERE a.age > 20 LIMIT 15" ,
64
- TEST_INDEX_PEOPLE ,
65
- TEST_INDEX_DOG );
66
-
67
- JSONObject result = executeQuerySafely (query );
68
- assertNotNull ("LEFT JOIN with timeout hint should execute" , result );
69
-
70
- int resultsCount = getResultsCount (result );
71
- assertTrue ("LEFT JOIN should execute successfully" , resultsCount >= 0 );
72
- assertTrue ("Should respect LIMIT" , resultsCount <= 15 );
73
- }
74
-
75
- /** Test JOIN_TIME_OUT hint interaction with other hints to ensure no conflicts */
76
- @ Test
77
- public void testJoinTimeoutHintWithOtherHints () throws IOException {
78
- String query =
79
- String .format (
80
- Locale .ROOT ,
81
- "SELECT /*! HASH_WITH_TERMS_FILTER*/ /*! JOIN_TIME_OUT(240) */ /*!"
82
- + " JOIN_TABLES_LIMIT(500,200) */ a.firstname, d.dog_name FROM %s a JOIN %s d ON"
83
- + " d.holdersName = a.firstname WHERE a.age > 25 LIMIT 8" ,
84
- TEST_INDEX_PEOPLE ,
85
- TEST_INDEX_DOG );
86
-
87
- JSONObject result = executeQuerySafely (query );
88
- assertNotNull ("Query with multiple hints should execute" , result );
89
-
90
- int resultsCount = getResultsCount (result );
91
- assertTrue ("Should execute with multiple hints" , resultsCount >= 0 );
92
- assertTrue ("Should respect LIMIT" , resultsCount <= 8 );
93
- }
94
-
95
- /** Test JOIN_TIME_OUT hint with complex nested field joins */
96
- @ Test
97
- public void testJoinTimeoutHintWithComplexNestedFields () throws IOException {
98
- String query =
99
- String .format (
100
- Locale .ROOT ,
101
- "SELECT /*! JOIN_TIME_OUT(150) */ "
102
- + "c.name.firstname, h.hname, h.words "
103
- + "FROM %1$s c JOIN %1$s h ON h.hname = c.house "
104
- + "WHERE c.name.firstname IS NOT NULL LIMIT 10" ,
105
- TEST_INDEX_GAME_OF_THRONES );
106
-
107
- JSONObject result = executeQuerySafely (query );
108
- assertNotNull ("Complex nested field join with timeout hint should execute" , result );
109
-
110
- int resultsCount = getResultsCount (result );
111
- assertTrue ("Should execute complex nested join successfully" , resultsCount >= 0 );
112
- assertTrue ("Should respect LIMIT" , resultsCount <= 10 );
113
- }
114
55
115
- /** Test JOIN_TIME_OUT hint with complex WHERE conditions and ORDER BY */
116
- @ Test
117
- public void testJoinTimeoutHintWithComplexQuery () throws IOException {
118
- String query =
119
- String .format (
120
- Locale .ROOT ,
121
- "SELECT /*! JOIN_TIME_OUT(300) */ "
122
- + "a.firstname, a.lastname, a.age, d.dog_name "
123
- + "FROM %s a JOIN %s d ON d.holdersName = a.firstname "
124
- + "WHERE (a.age > 25 OR a.balance > 1000) AND d.age > 2 "
125
- + "ORDER BY a.age DESC LIMIT 12" ,
126
- TEST_INDEX_PEOPLE ,
127
- TEST_INDEX_DOG );
128
56
129
- JSONObject result = executeQuerySafely (query );
130
- assertNotNull ("Complex query with timeout hint should execute" , result );
131
57
132
- int resultsCount = getResultsCount (result );
133
- assertTrue ("Should execute complex query successfully" , resultsCount >= 0 );
134
- assertTrue ("Should respect LIMIT" , resultsCount <= 12 );
135
- }
136
58
137
59
/**
138
60
* Regression test: Verify queries without JOIN_TIME_OUT hint still work to ensure implementation
@@ -157,49 +79,7 @@ public void testJoinWithoutTimeoutHintStillWorks() throws IOException {
157
79
assertTrue ("Should respect LIMIT" , resultsCount <= 5 );
158
80
}
159
81
160
- /** Test with large timeout value to ensure edge cases are handled */
161
- @ Test
162
- public void testJoinTimeoutHintWithLargeTimeout () throws IOException {
163
- String query =
164
- String .format (
165
- Locale .ROOT ,
166
- "SELECT /*! JOIN_TIME_OUT(1800) */ a.firstname, d.dog_name "
167
- + "FROM %s a JOIN %s d ON d.holdersName = a.firstname LIMIT 5" ,
168
- TEST_INDEX_PEOPLE ,
169
- TEST_INDEX_DOG );
170
-
171
- JSONObject result = executeQuerySafely (query );
172
- assertNotNull ("Query with large timeout should execute" , result );
173
-
174
- int resultsCount = getResultsCount (result );
175
- assertTrue ("Should handle large timeout value" , resultsCount >= 0 );
176
- assertTrue ("Should respect LIMIT" , resultsCount <= 5 );
177
- }
178
-
179
- /** Consistency test: Verify repeated queries with JOIN_TIME_OUT produce consistent results */
180
- @ Test
181
- public void testJoinTimeoutHintConsistency () throws IOException {
182
- String query =
183
- String .format (
184
- Locale .ROOT ,
185
- "SELECT /*! JOIN_TIME_OUT(100) */ a.firstname, d.dog_name "
186
- + "FROM %s a JOIN %s d ON d.holdersName = a.firstname "
187
- + "WHERE a.age > 25 LIMIT 3" ,
188
- TEST_INDEX_PEOPLE ,
189
- TEST_INDEX_DOG );
190
82
191
- // Execute the same query multiple times to ensure consistency
192
- JSONObject result1 = executeQuerySafely (query );
193
- JSONObject result2 = executeQuerySafely (query );
194
-
195
- assertNotNull ("First execution should succeed" , result1 );
196
- assertNotNull ("Second execution should succeed" , result2 );
197
-
198
- int resultsCount1 = getResultsCount (result1 );
199
- int resultsCount2 = getResultsCount (result2 );
200
-
201
- assertEquals ("Results should be consistent between executions" , resultsCount1 , resultsCount2 );
202
- }
203
83
204
84
private JSONObject executeQuerySafely (String query ) throws IOException {
205
85
JSONObject result = executeQuery (query );
0 commit comments