- 
                Notifications
    You must be signed in to change notification settings 
- Fork 74
Closed
Description
Version of MarkLogic Java Client API
develop branch (after 5.2.0 release)
Version of MarkLogic Server
10.0 nightly build
Java version
Open JDK 9
OS and version
IntelliJ IDE Windows
Input: Some code to illustrate the problem, preferably in a state that can be independently reproduced on our end
Using QA's functional test project's optic API data files (TDE and docs) as input, this test configures a RowBatcher with 2 threads and batch size of 1. The results of the Plan is 6 rows.
Plan has a bind parameter named ID.
        StringBuilder failedBuf = null;
        StringBuilder successBuf = null;
        RowBatcher<JsonNode> rowsBatcherOfJsonObj = dmManager.newRowBatcher(new JacksonHandle())
                .withBatchSize(3)
                .withThreadCount(2)
                .withJobName("Export As Rows of JsonNodes");
        RowManager rowMgr = rowsBatcherOfJsonObj.getRowManager();
        rowMgr.setDatatypeStyle(RowManager.RowSetPart.HEADER);
        PlanBuilder p = rowMgr.newPlanBuilder();
        PlanBuilder.ModifyPlan plan1 = p.fromView("opticFunctionalTest", "detail")
                .orderBy(p.schemaCol("opticFunctionalTest", "detail", "id"));
        PlanBuilder.ModifyPlan plan2 = p.fromView("opticFunctionalTest", "master")
                .orderBy(p.schemaCol("opticFunctionalTest", "master", "id"));
        PlanParamExpr idParam = p.param("ID");
        PlanBuilder.ModifyPlan plan3 = plan1.joinInner(plan2)
                .where(
                        p.eq(p.schemaCol("opticFunctionalTest", "master", "id"), idParam)
                )
                .orderBy(p.asc(p.schemaCol("opticFunctionalTest", "detail", "id")));
        JacksonHandle jacksonHandle = new JacksonHandle();
        jacksonHandle.setMimetype("application/json");
        plan3.bindParam("ID", 1);
        rowsBatcherOfJsonObj.withBatchView(plan3);
        ArrayList<Double> exptdAmt = new ArrayList(Arrays.asList(10.01,20.02,30.03,40.04,50.05,60.06));
        ArrayList<Double> resultAmt = new ArrayList<>();
        rowsBatcherOfJsonObj.onSuccess(e ->{
            JsonNode resDoc = e.getRowsDoc().get("rows");
            if (resDoc == null)
                failedBuf.append("No rows returned in batch from " + e.getLowerBound() + "to" + e.getUpperBound());
            else {
                for (int i=0; i<resDoc.size(); i++) {
                    //System.out.println("Thread id : " + Thread.currentThread().getId() + " is named as " + Thread.currentThread().getName());
                    System.out.println("row : "+ resDoc.get(i).get("opticFunctionalTest.detail.amount").asText());
                    resultAmt.add(resDoc.get(i).get("opticFunctionalTest.detail.amount").asDouble());
                }
            }
        })
                .onFailure((fevt, mythrows)-> {
                            failedBuf.append("Batch Failures in " + fevt.getJobBatchNumber() + "batch from "+ fevt.getLowerBound() + "to" + fevt.getUpperBound());
                        }
                );
        dmManager.startJob(rowsBatcherOfJsonObj);
        rowsBatcherOfJsonObj.awaitCompletion();
        for (Double d : resultAmt) {
            assertTrue(exptdAmt.contains(d.doubleValue()));
Actual output: What did you observe? What errors did you see? Can you attach the logs? (Java logs, MarkLogic logs)
In the IDE console we have:
In testRowBatcherWithBind method
23:01:23.547 [Test worker] INFO  c.m.c.d.impl.RowBatcherImpl - (withForestConfig) Using forests on [localhost] hosts for "RowBatcherFuncDB"
23:01:23.549 [Test worker] INFO  c.m.c.d.impl.RowBatcherImpl - Adding DatabaseClient on port 8011 for host "localhost" to the rotation
23:01:23.757 [Test worker] INFO  c.m.c.d.impl.RowBatcherImpl - plan analysis schema name: opticFunctionalTest, view name: detail, row estimate: 6
23:01:23.761 [Test worker] INFO  c.m.c.d.impl.RowBatcherImpl - batch count: 7, batch size: 2635249153387078802
23:01:23.764 [pool-2-thread-2] INFO  c.m.c.d.impl.RowBatcherImpl - current batch: 2, lower bound: 2635249153387078802, upper bound: 5270498306774157603
23:01:23.764 [pool-2-thread-1] INFO  c.m.c.d.impl.RowBatcherImpl - current batch: 1, lower bound: 0, upper bound: 2635249153387078801
23:01:24.881 [pool-2-thread-2] INFO  c.m.c.d.impl.RowBatcherImpl - error in failure listener: java.lang.NullPointerException
23:01:24.881 [pool-2-thread-1] INFO  c.m.c.d.impl.RowBatcherImpl - error in failure listener: java.lang.NullPointerException
23:01:24.881 [pool-2-thread-2] INFO  c.m.c.d.impl.RowBatcherImpl - current batch: 3, lower bound: 5270498306774157604, upper bound: 7905747460161236405
23:01:24.881 [pool-2-thread-1] INFO  c.m.c.d.impl.RowBatcherImpl - current batch: 4, lower bound: 7905747460161236406, upper bound: 10540996613548315207
23:01:24.892 [pool-2-thread-2] INFO  c.m.c.d.impl.RowBatcherImpl - error in failure listener: java.lang.NullPointerException
23:01:24.892 [pool-2-thread-1] INFO  c.m.c.d.impl.RowBatcherImpl - error in failure listener: java.lang.NullPointerException
23:01:24.892 [pool-2-thread-2] INFO  c.m.c.d.impl.RowBatcherImpl - current batch: 5, lower bound: 10540996613548315208, upper bound: 13176245766935394009
23:01:24.892 [pool-2-thread-1] INFO  c.m.c.d.impl.RowBatcherImpl - current batch: 6, lower bound: 13176245766935394010, upper bound: 15811494920322472811
23:01:24.901 [pool-2-thread-2] INFO  c.m.c.d.impl.RowBatcherImpl - error in failure listener: java.lang.NullPointerException
23:01:24.901 [pool-2-thread-1] INFO  c.m.c.d.impl.RowBatcherImpl - error in failure listener: java.lang.NullPointerException
23:01:24.901 [pool-2-thread-2] INFO  c.m.c.d.impl.RowBatcherImpl - current batch: 7, lower bound: 15811494920322472812, upper bound: 18446744073709551615
23:01:24.912 [pool-2-thread-2] INFO  c.m.c.d.impl.RowBatcherImpl - error in failure listener: java.lang.NullPointerException
In tearDownAfterClass
Expected output: What specifically did you expect to happen?
6 rows should have been returned. But we see this line in the console output-
INFO  c.m.c.d.impl.RowBatcherImpl - batch count: 7, batch size: 2635249153387078802
### Alternatives: What else have you tried, actual/expected?