Skip to content

Commit

Permalink
fix: fix tests cases
Browse files Browse the repository at this point in the history
  • Loading branch information
spena committed Aug 16, 2019
1 parent c2fd549 commit 3c7cdae
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ public void shouldSetPropertyInRunScript() {
final Map<String, Object> overriddenProperties = new HashMap<>();

KsqlEngineTestUtil.execute(ksqlEngine,
"SET 'auto.offset.reset' = 'earliest';",
"SET 'auto.offset.reset'='earliest';",
KSQL_CONFIG, overriddenProperties);

assertThat(overriddenProperties.get("auto.offset.reset"), equalTo("earliest"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@
import io.confluent.ksql.parser.tree.JoinCriteria;
import io.confluent.ksql.parser.tree.JoinOn;
import io.confluent.ksql.parser.tree.ListFunctions;
import io.confluent.ksql.parser.tree.ListStreams;
import io.confluent.ksql.parser.tree.ListTables;
import io.confluent.ksql.parser.tree.Node;
import io.confluent.ksql.parser.tree.Query;
import io.confluent.ksql.parser.tree.Relation;
import io.confluent.ksql.parser.tree.Select;
import io.confluent.ksql.parser.tree.SelectItem;
import io.confluent.ksql.parser.tree.SetProperty;
import io.confluent.ksql.parser.tree.ShowColumns;
import io.confluent.ksql.parser.tree.SingleColumn;
import io.confluent.ksql.parser.tree.Table;
import io.confluent.ksql.parser.tree.TableElement;
import io.confluent.ksql.parser.tree.TerminateQuery;
import io.confluent.ksql.parser.tree.UnsetProperty;
import io.confluent.ksql.util.ParserUtil;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -421,6 +426,55 @@ protected Void visitDropTable(final DropTable node, final Integer context) {
return null;
}

@Override
protected Void visitTerminateQuery(final TerminateQuery node, final Integer context) {
builder.append("TERMINATE ");
builder.append(node.getQueryId().getId());
return null;
}

@Override
protected Void visitListTables(final ListTables node, final Integer context) {
builder.append("SHOW TABLES");
if (node.getShowExtended()) {
visitExtended();
}
return null;
}

@Override
protected Void visitListStreams(final ListStreams node, final Integer context) {
builder.append("SHOW STREAMS");
if (node.getShowExtended()) {
visitExtended();
}
return null;
}

@Override
protected Void visitUnsetProperty(final UnsetProperty node, final Integer context) {
builder.append("UNSET '");
builder.append(node.getPropertyName());
builder.append("'");

return null;
}

@Override
protected Void visitSetProperty(final SetProperty node, final Integer context) {
builder.append("SET '");
builder.append(node.getPropertyName());
builder.append("'='");
builder.append(node.getPropertyValue());
builder.append("'");

return null;
}

private void visitExtended() {
builder.append(" EXTENDED");
}

private void visitDrop(final DropStatement node, final String sourceType) {
builder.append("DROP ");
builder.append(sourceType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,24 @@ protected R visitGroupingElement(final GroupingElement node, final C context) {
protected R visitSimpleGroupBy(final SimpleGroupBy node, final C context) {
return visitGroupingElement(node, context);
}

protected R visitTerminateQuery(final TerminateQuery node, final C context) {
return visitStatement(node, context);
}

protected R visitListStreams(final ListStreams node, final C context) {
return visitStatement(node, context);
}

protected R visitListTables(final ListTables node, final C context) {
return visitStatement(node, context);
}

protected R visitUnsetProperty(final UnsetProperty node, final C context) {
return visitStatement(node, context);
}

protected R visitSetProperty(final SetProperty node, final C context) {
return visitStatement(node, context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public boolean getShowExtended() {
return showExtended;
}

@Override
public <R, C> R accept(final AstVisitor<R, C> visitor, final C context) {
return visitor.visitListStreams(this, context);
}

@Override
public boolean equals(final Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public boolean getShowExtended() {
return showExtended;
}

@Override
public <R, C> R accept(final AstVisitor<R, C> visitor, final C context) {
return visitor.visitListTables(this, context);
}

@Override
public boolean equals(final Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public String getPropertyValue() {
return propertyValue;
}

@Override
public <R, C> R accept(final AstVisitor<R, C> visitor, final C context) {
return visitor.visitSetProperty(this, context);
}

@Override
public boolean equals(final Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public QueryId getQueryId() {
return queryId;
}

@Override
public <R, C> R accept(final AstVisitor<R, C> visitor, final C context) {
return visitor.visitTerminateQuery(this, context);
}

@Override
public boolean equals(final Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public String getPropertyName() {
return propertyName;
}

@Override
public <R, C> R accept(final AstVisitor<R, C> visitor, final C context) {
return visitor.visitUnsetProperty(this, context);
}

@Override
public boolean equals(final Object o) {
if (this == o) {
Expand Down

0 comments on commit 3c7cdae

Please sign in to comment.