Skip to content

Commit

Permalink
Added support for 'IS NOT? NULL' clauses, added back load.sql for jus…
Browse files Browse the repository at this point in the history
…t the demo.csv
  • Loading branch information
fabuzaid21 committed Jan 24, 2018
1 parent a187b10 commit 57c461d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
3 changes: 3 additions & 0 deletions sql/load.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IMPORT FROM CSV FILE 'core/demo/sample.csv' INTO sample(usage double, latency
double, location string, version string);

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import edu.stanford.futuredata.macrobase.sql.tree.FunctionCall;
import edu.stanford.futuredata.macrobase.sql.tree.Identifier;
import edu.stanford.futuredata.macrobase.sql.tree.ImportCsv;
import edu.stanford.futuredata.macrobase.sql.tree.IsNotNullPredicate;
import edu.stanford.futuredata.macrobase.sql.tree.Literal;
import edu.stanford.futuredata.macrobase.sql.tree.LogicalBinaryExpression;
import edu.stanford.futuredata.macrobase.sql.tree.LogicalBinaryExpression.Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@
import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

public class IsNotNullPredicate extends Expression {
public class IsNotNullPredicate extends ComparisonExpression {

private final Expression value;

public IsNotNullPredicate(Expression value) {
this(Optional.empty(), value);
super(ComparisonExpressionType.NOT_EQUAL, value, new NullLiteral());
requireNonNull(value, "value is null");
this.value = value;
}

public IsNotNullPredicate(NodeLocation location, Expression value) {
this(Optional.of(location), value);
}

private IsNotNullPredicate(Optional<NodeLocation> location, Expression value) {
super(location);
super(location, ComparisonExpressionType.NOT_EQUAL, value, new NullLiteral(location));
requireNonNull(value, "value is null");
this.value = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@
import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

public class IsNullPredicate extends Expression {
public class IsNullPredicate extends ComparisonExpression {

private final Expression value;

public IsNullPredicate(Expression value) {
this(Optional.empty(), value);
super(ComparisonExpressionType.EQUAL, value, new NullLiteral());
requireNonNull(value, "value is null");
this.value = value;
}

public IsNullPredicate(NodeLocation location, Expression value) {
this(Optional.of(location), value);
}

private IsNullPredicate(Optional<NodeLocation> location, Expression value) {
super(location);
super(location, ComparisonExpressionType.EQUAL, value, new NullLiteral(location));
requireNonNull(value, "value is null");
this.value = value;
}
Expand Down

0 comments on commit 57c461d

Please sign in to comment.