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
Expand Up @@ -1733,7 +1733,10 @@ private void splitAggregate(
if (hasDistinctAggregate)
mapAgg = agg.child();
else {
mapAgg = SplitterUtils.aggregate(agg.distinct(), agg.type()).resultType(GridSqlType.STRING)
mapAgg = SplitterUtils
.aggregate(agg.distinct(), agg.type())
.setGroupConcatSeparator(agg.getGroupConcatSeparator())
.resultType(GridSqlType.STRING)
.addChild(agg.child());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.ignite.internal.processors.query;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -113,6 +114,31 @@ public void testGroupConcatSimple() {
}
}

/**
*
*/
@Test
public void testGroupConcatSeparator() {
IgniteCache c = ignite(CLIENT).cache(CACHE_NAME);

List<List<Object>> res = c.query(
new SqlFieldsQuery("select grp, GROUP_CONCAT(str0 SEPARATOR '.') from Value WHERE id < ? group by grp")
.setCollocated(true).setArgs(KEY_BASE_FOR_DUPLICATES)).getAll();

List<List<Object>> expRes = Arrays.asList(
Arrays.asList(1, "A"),
Arrays.asList(2, "C.B"),
Arrays.asList(3, "E.D.F"),
Arrays.asList(4, "J.G.I.H"),
Arrays.asList(5, "O.L.N.K.M"),
Arrays.asList(6, "Q.S.U.P.R.T"));

assertEquals(res.size(), expRes.size());

for (int i = 0; i < res.size(); i++)
assertEqualsCollections(expRes.get(i), res.get(i));
}

/**
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.ignite.internal.processors.query;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
Expand Down Expand Up @@ -96,6 +97,30 @@ public void testGroupConcatSimple() {
}
}

/**
*
*/
@Test
public void testGroupConcatSeparator() {
IgniteCache c = ignite(CLIENT).cache(CACHE_NAME);

List<List<Object>> res = c.query(
new SqlFieldsQuery("select grp, GROUP_CONCAT(str0 SEPARATOR '.') from Value group by grp")).getAll();

List<List<Object>> expRes = Arrays.asList(
Arrays.asList(1, "A"),
Arrays.asList(2, "C.B"),
Arrays.asList(3, "E.D.F"),
Arrays.asList(4, "J.G.I.H"),
Arrays.asList(5, "O.L.N.K.M"),
Arrays.asList(6, "Q.S.U.P.R.T"));

assertEquals(res.size(), expRes.size());

for (int i = 0; i < res.size(); i++)
assertEqualsCollections(expRes.get(i), res.get(i));
}

/**
*
*/
Expand Down