Skip to content

Commit

Permalink
Merge pull request #5 from programer-0/release-1.0.0
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
yuanxiaodong authored Jan 4, 2022
2 parents 5ba00d3 + f5a97fa commit 105858b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ public class WindowBuilder extends SelectSQLBuilder {
protected List<String> shuffleOverWindowOrderByFieldNames;
protected int overWindowTopN = 100;

@Override
protected void build() {
@Override protected void build() {
AbstractWindow window;
if (overWindowName != null) {
if (!isShuffleOverWindow) {
Expand All @@ -133,17 +132,17 @@ protected void build() {
window.setTimeUnitAdjust(1);

if (window instanceof WindowOperator) {
window.setSizeInterval(Optional.ofNullable(size).orElse(AbstractWindow.DEFAULT_WINDOW_SIZE));
window.setSizeInterval(Optional.ofNullable(size).orElse(AbstractWindow.DEFAULT_WINDOW_SIZE * 60));
window.setSizeVariable(sizeVariable);
window.setSizeAdjust(sizeAdjust);

window.setSlideInterval(Optional.ofNullable(slide).orElse(AbstractWindow.DEFAULT_WINDOW_SLIDE));
window.setSlideInterval(Optional.ofNullable(slide).orElse(window.getSizeInterval()));
window.setSlideVariable(slideVariable);
window.setSlideAdjust(slideAdjust);
}

if (window instanceof SessionOperator) {
SessionOperator theWindow = (SessionOperator)window;
SessionOperator theWindow = (SessionOperator) window;
theWindow.setSessionTimeOut(Optional.ofNullable(timeout).orElse(AbstractWindow.DEFAULT_WINDOW_SESSION_TIMEOUT));
}

Expand All @@ -153,7 +152,7 @@ protected void build() {
Iterator<Entry<String, IParseResult>> it = owner.getFieldName2ParseResult().entrySet().iterator();
while (it.hasNext()) {
Entry<String, IParseResult> entry = it.next();
ScriptParseResult scriptParseResult = (ScriptParseResult)entry.getValue();
ScriptParseResult scriptParseResult = (ScriptParseResult) entry.getValue();
if (CollectionUtil.isEmpty(scriptParseResult.getScriptValueList())) {
selectMap.put(entry.getKey(), entry.getKey());
} else {
Expand Down Expand Up @@ -217,8 +216,7 @@ protected void buildOverWindow() {
getPipelineBuilder().addChainStage(overWindow);
}

@Override
public Set<String> parseDependentTables() {
@Override public Set<String> parseDependentTables() {
return new HashSet<>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
import com.alibaba.rsqldb.parser.parser.result.IParseResult;
import com.alibaba.rsqldb.parser.parser.result.ScriptParseResult;
import com.alibaba.rsqldb.parser.parser.sqlnode.AbstractSelectNodeParser;
import java.util.List;
import org.apache.calcite.sql.SqlBasicCall;
import org.apache.calcite.sql.SqlNode;

import java.util.List;

public class CountParser extends AbstractSelectNodeParser<SqlBasicCall> {

@Override
Expand All @@ -34,8 +33,7 @@ public IParseResult parse(SelectSQLBuilder tableDescriptor, SqlBasicCall sqlBasi
SqlNode varNode = nodeList.get(0);
String fieldName = parseSqlNode(tableDescriptor, varNode).getReturnValue();
ScriptParseResult scriptParseResult = new ScriptParseResult();
if (sqlBasicCall.getFunctionQuantifier() != null && sqlBasicCall.getFunctionQuantifier().toValue().toLowerCase()
.equals("distinct")) {
if (sqlBasicCall.getFunctionQuantifier() != null && sqlBasicCall.getFunctionQuantifier().toValue().toLowerCase().equals("distinct")) {
String returnName = ParserNameCreator.createName("distinct", null);
scriptParseResult.addScript(tableDescriptor, returnName + "=distinct(" + fieldName + ");");
fieldName = returnName;
Expand All @@ -53,7 +51,7 @@ public IParseResult parse(SelectSQLBuilder tableDescriptor, SqlBasicCall sqlBasi
@Override
public boolean support(Object sqlNode) {
if (sqlNode instanceof SqlBasicCall) {
SqlBasicCall sqlBasicCall = (SqlBasicCall)sqlNode;
SqlBasicCall sqlBasicCall = (SqlBasicCall) sqlNode;
if (sqlBasicCall.getOperator().getName().toLowerCase().equals("count")) {
return true;
}
Expand Down

0 comments on commit 105858b

Please sign in to comment.