Skip to content
Permalink
Browse files

handling of groupby

  • Loading branch information...
arcuri82 committed Jul 7, 2019
1 parent a6a6e45 commit c26c2af5ce16532147bab1d7a33ee5b887ab447a
@@ -118,6 +118,7 @@ private static void handleSelectBody(SelectBody selectBody) {
PlainSelect plainSelect = (PlainSelect) selectBody;
plainSelect.setWhere(null);
plainSelect.setLimit(null);
plainSelect.setGroupByElement(null);
} else if (selectBody instanceof SetOperationList) {
for(SelectBody select : ((SetOperationList) selectBody).getSelects()){
handleSelectBody(select);
@@ -20,6 +20,21 @@ public void testCount(){
assertFalse(withoutOperations.contains("count"));
}

@Test
public void testGroupBy(){

String select = "select count(x), y from Foo f group by y";

String withFields = SelectTransformer.addFieldsToSelect(select);
String withoutConstraints = SelectTransformer.removeConstraints(withFields);
String withoutOperations = SelectTransformer.removeOperations(withoutConstraints);

assertFalse(withoutOperations.contains("where"));
assertTrue(withoutOperations.contains("y"));
assertFalse(withoutOperations.contains("count"));
assertFalse(withoutOperations.contains("group"));
}


@Test
public void testAddFields() {

0 comments on commit c26c2af

Please sign in to comment.
You can’t perform that action at this time.