Skip to content

Commit 9a77733

Browse files
llingllinggit
lling
authored andcommitted
#1322 modify the facetBy parameter type to make it work with namedGroup
1 parent 12854c8 commit 9a77733

File tree

4 files changed

+62
-44
lines changed

4 files changed

+62
-44
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/expression/PlanBuilder.java

-20
Original file line numberDiff line numberDiff line change
@@ -1410,26 +1410,6 @@ public interface ModifyPlan extends PreparePlan, PlanBuilderBase.ModifyPlanBase
14101410
* @return a ModifyPlan object
14111411
*/
14121412
public abstract ModifyPlan existsJoin(ModifyPlan right, PlanJoinKeySeq keys, ServerExpression condition);
1413-
/**
1414-
* This method counts values for multiple grouping key columns.
1415-
* @param keys This parameter specifies the list of column keys for performing counts. For each column, the operation determines the unique values of that column and produces a separate count for the rows with that value. A column can be named with a string or a column parameter function such as op:col or constructed from an expression with the op:as function. See {@link PlanBuilder#colSeq(String...)}
1416-
* @return a ModifyPlan object
1417-
*/
1418-
public abstract ModifyPlan facetBy(PlanExprColSeq keys);
1419-
/**
1420-
* This method counts values for multiple grouping key columns.
1421-
* @param keys This parameter specifies the list of column keys for performing counts. For each column, the operation determines the unique values of that column and produces a separate count for the rows with that value. A column can be named with a string or a column parameter function such as op:col or constructed from an expression with the op:as function. See {@link PlanBuilder#colSeq(String...)}
1422-
* @param countCol Specifies what to count over the rows for each unique value of each key column. By default, the operation counts the rows. To count the values of a column instead, specify the column to count with this parameter. To count documents, specify a fragment id column with op:fragment-id-col.
1423-
* @return a ModifyPlan object
1424-
*/
1425-
public abstract ModifyPlan facetBy(PlanExprColSeq keys, String countCol);
1426-
/**
1427-
* This method counts values for multiple grouping key columns.
1428-
* @param keys This parameter specifies the list of column keys for performing counts. For each column, the operation determines the unique values of that column and produces a separate count for the rows with that value. A column can be named with a string or a column parameter function such as op:col or constructed from an expression with the op:as function. See {@link PlanBuilder#colSeq(String...)}
1429-
* @param countCol Specifies what to count over the rows for each unique value of each key column. By default, the operation counts the rows. To count the values of a column instead, specify the column to count with this parameter. To count documents, specify a fragment id column with op:fragment-id-col.
1430-
* @return a ModifyPlan object
1431-
*/
1432-
public abstract ModifyPlan facetBy(PlanExprColSeq keys, PlanExprCol countCol);
14331413
/**
14341414
* This method collapses a group of rows into a single row.
14351415
* @param keys This parameter specifies the columns used to determine the groups. Rows with the same values in these columns are consolidated into a single group. The columns can be existing columns or new columns created by an expression specified with op:as. The rows produced by the group by operation include the key columns. Specify an empty sequence to create a single group for all of the rows in the row set. See {@link PlanBuilder#colSeq(String...)}

marklogic-client-api/src/main/java/com/marklogic/client/expression/PlanBuilderBase.java

+43
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,49 @@ interface ModifyPlanBase {
664664
* @return a ModifyPlan object
665665
*/
666666
PlanBuilder.ModifyPlan groupToArrays(PlanNamedGroupSeq keys, PlanAggregateColSeq aggregates);
667+
/**
668+
* This method counts values for multiple grouping key columns.
669+
* @param keys This parameter specifies the list of column keys or group keys for performing counts. For each
670+
* column/group, the operation determines the unique values of that column/group and produces a
671+
* separate count for the rows with that value. A column can be named with a string or a column
672+
* parameter function such as op:col or constructed from an expression with the op:as function.
673+
* See {@link PlanBuilder#colSeq(String...)}. A group can be a namedGroup or bucketGroup. see
674+
* {@link PlanBuilder#namedGroupSeq(PlanNamedGroup...)} , {@link PlanBuilder#namedGroup(String, PlanExprColSeq)}
675+
* and {@link PlanBuilder#bucketGroup(String, String, XsAnyAtomicTypeSeqVal)}
676+
* @return a ModifyPlan object
677+
*/
678+
PlanBuilder.ModifyPlan facetBy(PlanNamedGroupSeq keys);
679+
/**
680+
* This method counts values for multiple grouping key columns.
681+
* @param keys This parameter specifies the list of column keys or group keys for performing counts. For each
682+
* column, the operation determines the unique values of that column/group and produces a separate
683+
* count for the rows with that value. A column can be named with a string or a column parameter
684+
* function such as op:col or constructed from an expression with the op:as function.
685+
* See {@link PlanBuilder#colSeq(String...)}. A group can be a namedGroup or bucketGroup. see
686+
* {@link PlanBuilder#namedGroupSeq(PlanNamedGroup...)}, {@link PlanBuilder#namedGroup(String, PlanExprColSeq)}
687+
* and {@link PlanBuilder#bucketGroup(String, String, XsAnyAtomicTypeSeqVal)}.
688+
* @param countCol Specifies what to count over the rows for each unique value of each key column. By default,
689+
* the operation counts the rows. To count the values of a column instead, specify the column
690+
* to count with this parameter. To count documents, specify a fragment id column with
691+
* op:fragment-id-col.
692+
* @return a ModifyPlan object
693+
*/
694+
PlanBuilder.ModifyPlan facetBy(PlanNamedGroupSeq keys, String countCol);
695+
/**
696+
* This method counts values for multiple grouping key columns.
697+
* @param keys This parameter specifies the list of column keys or group keys for performing counts. For each
698+
* column, the operation determines the unique values of that column/group and produces a separate
699+
* count for the rows with that value. A column can be named with a string or a column parameter
700+
* function such as op:col or constructed from an expression with the op:as function.
701+
* See {@link PlanBuilder#colSeq(String...)}, {@link PlanBuilder#namedGroup(String, PlanExprColSeq)}
702+
* and {@link PlanBuilder#bucketGroup(String, String, XsAnyAtomicTypeSeqVal)}.
703+
* @param countCol Specifies what to count over the rows for each unique value of each key column. By default,
704+
* the operation counts the rows. To count the values of a column instead, specify the column
705+
* to count with this parameter. To count documents, specify a fragment id column with
706+
* op:fragment-id-col.
707+
* @return a ModifyPlan object
708+
*/
709+
PlanBuilder.ModifyPlan facetBy(PlanNamedGroupSeq keys, PlanExprCol countCol);
667710

668711
/**
669712
* This method returns a subset of the rows in the result set by returning the specified number of rows.

marklogic-client-api/src/main/java/com/marklogic/client/impl/PlanBuilderImpl.java

-24
Original file line numberDiff line numberDiff line change
@@ -1652,31 +1652,7 @@ public ModifyPlan existsJoin(ModifyPlan right, PlanJoinKeySeq keys, ServerExpres
16521652
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "exists-join", new Object[]{ right, keys, condition });
16531653
}
16541654

1655-
1656-
@Override
1657-
public ModifyPlan facetBy(PlanExprColSeq keys) {
1658-
if (keys == null) {
1659-
throw new IllegalArgumentException("keys parameter for facetBy() cannot be null");
1660-
}
1661-
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "facet-by", new Object[]{ keys });
1662-
}
1663-
1664-
1665-
@Override
1666-
public ModifyPlan facetBy(PlanExprColSeq keys, String countCol) {
1667-
return facetBy(keys, (countCol == null) ? (PlanExprCol) null : exprCol(countCol));
1668-
}
1669-
1670-
1671-
@Override
1672-
public ModifyPlan facetBy(PlanExprColSeq keys, PlanExprCol countCol) {
1673-
if (keys == null) {
1674-
throw new IllegalArgumentException("keys parameter for facetBy() cannot be null");
1675-
}
1676-
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "facet-by", new Object[]{ keys, countCol });
1677-
}
16781655

1679-
16801656
@Override
16811657
public ModifyPlan groupBy(PlanExprColSeq keys) {
16821658
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "group-by", new Object[]{ keys });

marklogic-client-api/src/main/java/com/marklogic/client/impl/PlanBuilderSubImpl.java

+19
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,25 @@ public PlanBuilder.ModifyPlan groupToArrays(PlanNamedGroupSeq keys, PlanAggregat
798798
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "group-to-arrays", new Object[]{ keys, aggregates });
799799
}
800800

801+
@Override
802+
public ModifyPlan facetBy(PlanNamedGroupSeq keys) {
803+
if (keys == null) {
804+
throw new IllegalArgumentException("keys parameter for facetBy() cannot be null");
805+
}
806+
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "facet-by", new Object[]{ keys });
807+
}
808+
@Override
809+
public ModifyPlan facetBy(PlanNamedGroupSeq keys, String countCol) {
810+
return facetBy(keys, (countCol == null) ? (PlanExprCol) null : exprCol(countCol));
811+
}
812+
@Override
813+
public ModifyPlan facetBy(PlanNamedGroupSeq keys, PlanExprCol countCol) {
814+
if (keys == null) {
815+
throw new IllegalArgumentException("keys parameter for facetBy() cannot be null");
816+
}
817+
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "facet-by", new Object[]{ keys, countCol });
818+
}
819+
801820
@Override
802821
public ModifyPlan limit(long length) {
803822
return limit(xs.longVal(length));

0 commit comments

Comments
 (0)