Skip to content
Open
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
Expand Up @@ -398,7 +398,9 @@ private RuntimeTupleIterator visitFlowrClause(
groupByExpressionIterator,
variableName,
clause.getMetadata(),
var.getCollationURI(),
var.getCollationURI() == null
? clause.getStaticContext().getDefaultCollation()
: var.getCollationURI(),
var.getActualSequenceType()
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.rumbledb.exceptions.UnexpectedTypeException;
import org.rumbledb.runtime.flwor.FlworDataFrameColumn;
import org.rumbledb.runtime.flwor.expression.GroupByClauseSparkIteratorExpression;
import org.rumbledb.runtime.misc.CollationSupport;
import org.rumbledb.runtime.typing.InstanceOfIterator;
import org.rumbledb.types.SequenceType;

Expand All @@ -45,6 +46,7 @@ public class GroupClauseCreateColumnsUDF implements UDF1<Row, Row> {
private static final long serialVersionUID = 1L;
private final DataFrameContext dataFrameContext;
private final List<Name> groupingVariableNames;
private final List<String> groupingCollationURIs;
private final List<SequenceType> groupingSequenceTypes;

private final List<Object> results;
Expand All @@ -71,9 +73,11 @@ public GroupClauseCreateColumnsUDF(
) {
this.dataFrameContext = new DataFrameContext(context, columns);
this.groupingVariableNames = new ArrayList<>();
this.groupingCollationURIs = new ArrayList<>();
this.groupingSequenceTypes = new ArrayList<>();
for (GroupByClauseSparkIteratorExpression expression : groupingExpressions) {
this.groupingVariableNames.add(expression.getVariableName());
this.groupingCollationURIs.add(expression.getCollationURI());
this.groupingSequenceTypes.add(expression.getSequenceType());
}
this.results = new ArrayList<>();
Expand All @@ -88,6 +92,7 @@ public Row call(Row row) {

for (int i = 0; i < this.groupingVariableNames.size(); i++) {
Name groupingVariableName = this.groupingVariableNames.get(i);
String collationURI = this.groupingCollationURIs.get(i);
SequenceType declaredType = this.groupingSequenceTypes.get(i);
List<Item> items = this.dataFrameContext.getContext()
.getVariableValues()
Expand All @@ -108,7 +113,11 @@ public Row call(Row row) {
continue;
}

Item nextItem = atomizedGroupingKey.get(0);
Item nextItem = CollationSupport.normalizeItemForCollation(
atomizedGroupingKey.get(0),
collationURI,
this.metadata
);
this.createColumnsForItem(nextItem);
}

Expand Down
Loading