Skip to content

Commit 1030932

Browse files
georgeajitehennum
georgeajit
authored and
ehennum
committed
No Task - Out of order key cols can be used in namedgroup
1 parent 4aeb678 commit 1030932

File tree

1 file changed

+27
-0
lines changed
  • marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest

1 file changed

+27
-0
lines changed

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/TestOpticOnViews.java

+27
Original file line numberDiff line numberDiff line change
@@ -2914,6 +2914,33 @@ public void testgroupByUnion() throws KeyManagementException, NoSuchAlgorithmExc
29142914
assertEquals("Row 2 testgroupByUnion MasterDate value incorrect", "2015-12-01", jsonBindingsNodesDate.get(1).path("MasterDate").path("value").asText());
29152915
assertEquals("Row 2 testgroupByUnion DateCount size incorrect", 1, jsonBindingsNodesDate.get(1).path("DateCount").path("value").asInt());
29162916
assertEquals("Row 2 testgroupByUnion color value incorrect", "null", jsonBindingsNodesDate.get(1).path("color").path("type").asText());
2917+
2918+
// Note that this plan5 is ued to verify if non-alphabetic col key name have any issues. Refer to BT56490
2919+
ModifyPlan plan5 = plan1.union(plan2)
2920+
.select(p.as("MasterDate", p.schemaCol("opticFunctionalTest", "master", "date")),
2921+
p.as("DetailName", p.schemaCol("opticFunctionalTest", "detail", "name")),
2922+
p.as("DetailId", p.schemaCol("opticFunctionalTest", "detail", "masterId")),
2923+
p.col("amount"),
2924+
p.col("color")
2925+
)
2926+
.groupByUnion(p.groupSeq(p.col("DetailId"), p.col("MasterDate"), p.col("color")),
2927+
p.aggregateSeq(p.count("DateCount", "MasterDate")))
2928+
.orderBy(p.desc(p.col("MasterDate")));
2929+
2930+
JacksonHandle jacksonHandleColOrder = new JacksonHandle();
2931+
jacksonHandleColOrder.setMimetype("application/json");
2932+
2933+
rowMgr.resultDoc(plan5, jacksonHandleColOrder);
2934+
JsonNode jsonResultsColOrd = jacksonHandleColOrder.get();
2935+
JsonNode jsonBindingsNodesColOrd = jsonResultsColOrd.path("rows");
2936+
System.out.println("Results from Column in non alphbetic column name order are : " + jsonBindingsNodesColOrd);
2937+
2938+
assertEquals("Nine nodes not returned from testgroupByUnion of plan5 ", 9, jsonBindingsNodesColOrd.size());
2939+
assertEquals("Row 1 plan5 of testgroupByUnion MasterDate value incorrect", "2015-12-02", jsonBindingsNodesColOrd.get(0).path("MasterDate").path("value").asText());
2940+
assertEquals("Row 1 plan5 of testgroupByUnion DateCount size incorrect", 1, jsonBindingsNodesColOrd.get(0).path("DateCount").path("value").asInt());
2941+
assertEquals("Row 7 plan5 of testgroupByUnion color type incorrect", "null", jsonBindingsNodesColOrd.get(7).path("color").path("type").asText());
2942+
assertEquals("Row 7 plan5 of testgroupByUnion color value incorrect", "blue", jsonBindingsNodesColOrd.get(6).path("color").path("value").asText());
2943+
29172944
}
29182945

29192946
// Same as testgroupsByUnion with facade.

0 commit comments

Comments
 (0)