Skip to content

distinct存在bug #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2022
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
4 changes: 3 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
2019-09-08: add geo polygon support and update geo bounding box syntax
2019-09-10: add dis max support
2019-09-23: add geo shape support
2019-12-14: add insert/update support
2019-12-14: add insert/update support
2021-12-21: remove order by default sortMode, fixed in语句不能参与or计算
2022-01-19: fixed distinct support
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void parseNotGroupByClause(ElasticDslContext dslContext) {
dslContext.getParseResult().getHighlighter().add(distinctName);
}
}
if (StringUtils.isNotBlank(dslContext.getParseResult().getDistinctName())) {
if (StringUtils.isBlank(dslContext.getParseResult().getDistinctName())) {
dslContext.getParseResult().setDistinctName(distinctName);
}
includeFields.add(distinctName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ public class FixedHistoryTest {

protected static ElasticSql2DslParser parser = new ElasticSql2DslParser();

@Test
public void fixedAt20220119(){
// 1. distinct
String distinctSql = "select distinct name from user ";
System.out.println(parser.parse(distinctSql).toDsl());

}

@Test
public void fixedOn20211221() {
// 1. 去掉默认sortMode=avg ,默认为null
Expand Down