Skip to content

Commit 229e253

Browse files
committed
Debug
1 parent aaa002b commit 229e253

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/lucene/LuceneSourceOperator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ public Page getCheckedOutput() throws IOException {
318318
final int discardedDocs = collectedDocs - limiter.tryAccumulateHits(collectedDocs);
319319
Page page = null;
320320
if (currentPagePos >= minPageSize || scorer.isDone() || (remainingDocs = limiter.remaining()) == 0) {
321+
log.error("SADADSF {}", remainingDocs);
321322
IntVector shard = null;
322323
IntVector leaf = null;
323324
IntVector docs = null;

x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneSourceOperatorTests.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1111

12+
import com.carrotsearch.randomizedtesting.annotations.Repeat;
13+
14+
import com.carrotsearch.randomizedtesting.annotations.Seed;
15+
1216
import org.apache.lucene.document.SortedNumericDocValuesField;
1317
import org.apache.lucene.index.IndexReader;
1418
import org.apache.lucene.index.IndexableField;
@@ -63,6 +67,8 @@
6367
import static org.hamcrest.Matchers.lessThanOrEqualTo;
6468
import static org.hamcrest.Matchers.matchesRegex;
6569

70+
//@Seed("4FF2CB98F60FD89D:EBBB701671985F2B")
71+
@Repeat(iterations = 100)
6672
public class LuceneSourceOperatorTests extends AnyOperatorTestCase {
6773
private static final MappedFieldType S_FIELD = new NumberFieldMapper.NumberFieldType("s", NumberFieldMapper.NumberType.LONG);
6874

@@ -211,7 +217,7 @@ private LuceneSourceOperator.Factory simple(DataPartitioning dataPartitioning, i
211217
ShardContext ctx = new MockShardContext(reader, 0);
212218
Function<ShardContext, List<LuceneSliceQueue.QueryAndTags>> queryFunction = c -> testCase.queryAndExtra();
213219
int maxPageSize = between(10, Math.max(10, numDocs));
214-
int taskConcurrency = randomIntBetween(1, 4);
220+
int taskConcurrency = 4; // randomIntBetween(1, 4); NOCOMMIT
215221
return new LuceneSourceOperator.Factory(
216222
List.of(ctx),
217223
queryFunction,
@@ -262,9 +268,11 @@ private void testSimple(DataPartitioning partitioning) {
262268
}
263269

264270
public void testEarlyTermination() {
265-
int numDocs = between(1_000, 20_000);
266-
int limit = between(0, numDocs * 2);
267-
LuceneSourceOperator.Factory factory = simple(randomFrom(DataPartitioning.values()), numDocs, limit, scoring);
271+
int numDocs = 20_000; //between(1_000, 20_000); NOCOMMIT
272+
int limit = 100_000; //between(0, numDocs * 2); NOCOMMIT
273+
LuceneSourceOperator.Factory factory = simple(DataPartitioning.DOC
274+
// randomFrom(DataPartitioning.values()) NOCOMMIT
275+
, numDocs, limit, scoring);
268276
int taskConcurrency = factory.taskConcurrency();
269277
final AtomicInteger receivedRows = new AtomicInteger();
270278
List<Driver> drivers = new ArrayList<>();
@@ -293,6 +301,13 @@ public void testEarlyTermination() {
293301
drivers.add(driver);
294302
}
295303
OperatorTestCase.runDriver(drivers);
304+
logger.info(
305+
"{} received={} limit={} numResults={}",
306+
factory.dataPartitioning,
307+
receivedRows.get(),
308+
limit,
309+
testCase.numResults(numDocs)
310+
);
296311
assertThat(receivedRows.get(), equalTo(Math.min(limit, testCase.numResults(numDocs))));
297312
}
298313

0 commit comments

Comments
 (0)