Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
package com.marklogic.client.test.junit5;

import com.marklogic.client.test.Common;
import com.marklogic.client.test.MarkLogicVersion;
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext;

public class RequiresML12Dot0OrLower implements ExecutionCondition {

private static MarkLogicVersion markLogicVersion;

@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
if (markLogicVersion == null) {
markLogicVersion = Common.getMarkLogicVersion();
}
boolean isML12Dot0OrLower = markLogicVersion.getMajor() < 12 ||
(markLogicVersion.getMajor() == 12 && (markLogicVersion.getMinor() == null || markLogicVersion.getMinor() == 0));
return isML12Dot0OrLower ?
ConditionEvaluationResult.enabled("MarkLogic is version 12.0 or lower") :
ConditionEvaluationResult.disabled("MarkLogic is version 12.1 or higher");
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
* Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
package com.marklogic.client.test.rows;

Expand All @@ -9,6 +9,8 @@
import com.marklogic.client.row.RowRecord;
import com.marklogic.client.test.Common;
import com.marklogic.client.test.junit5.RequiresML11;
import com.marklogic.client.test.junit5.RequiresML12Dot0OrLower;
import com.marklogic.client.test.junit5.RequiresML12Dot1;
import com.marklogic.client.type.CtsReferenceExpr;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -40,6 +42,7 @@ public void propertiesFragmentsShouldNotBeReturned() {
* 2022-12-12 This is now running only on ML 11, as it's consistently failing on ML 10. We have a fix slated for
* 11.x, and it's not clear yet if it'll be backported to ML 10.
*/
@ExtendWith(RequiresML12Dot0OrLower.class)
Comment thread
jonmille marked this conversation as resolved.
@Test
public void propertiesFragmentShouldNotBeReturnedByFromLexicons() {
Map<String, CtsReferenceExpr> lexicons = new HashMap<>();
Expand All @@ -52,6 +55,30 @@ public void propertiesFragmentShouldNotBeReturnedByFromLexicons() {
verifyPropertiesFragmentsAreNotReturned(plan);
}

/**
* In ML 12.1+, fromLexicons enumerates both content fragments and properties fragments, so joinDoc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an internal MLE Jira ticket to tie to this? My first reaction on seeing this was - really?? And wanting to read the explanation for why fromLexicons was altered.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would include a link to MLE-27052 in the test comment for future reference.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comment with the Jira Ticket that introduced the behavior change (MLE-27052) and Jira Ticket that validated the change was intended (MLE-31757) for future reference.

* returns twice as many rows as written documents. This behavior was introduced in ML 12.1 as part of
* MLE-27052 and intended behavior was validated in MLE-31757 comments.
*/
@ExtendWith(RequiresML12Dot1.class)
@Test
public void propertiesFragmentShouldBeReturnedByFromLexicons() {
Map<String, CtsReferenceExpr> lexicons = new HashMap<>();
lexicons.put("uri", op.cts.uriReference());

PlanBuilder.ModifyPlan plan = op.fromLexicons(lexicons, "", op.fragmentIdCol("fragmentId"))
.where(op.cts.directoryQuery("/acme/"))
.joinDoc(op.col("doc"), op.col("uri"));

final int docCount = 50;
writeDocs(docCount);

List<RowRecord> rows = resultRows(plan);
assertEquals(docCount * 2, rows.size(),
"In ML 12.1+, fromLexicons returns both content fragments and properties fragments, so the row " +
"count should be twice the number of written documents.");
}

private void verifyPropertiesFragmentsAreNotReturned(PlanBuilder.ModifyPlan plan) {
final int docCount = 50;
writeDocs(docCount);
Expand Down
Loading