Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self):
self.sql = """CREATE TABLE real_tbl(
id INT,
c1 REAL,
c2 REAL NOT NULL);"""
c2 REAL NOT NULL)"""
self.data = [
{"id": 0, "c1": None, "c2": 2231.791},
{"id": 0, "c1": 57681.18, "c2": -38.27112},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static DBSPIntegrateTraceRetainKeysOperator create(
DBSPParameter param;
DBSPExpression compare;
DBSPVariablePath controlArg = controlType.ref().var();
DBSPExpression compare0 = controlArg.deref().field(0).not();
DBSPExpression compare0 = controlArg.deepCopy().deref().field(0).not();
if (data.outputType().is(DBSPTypeIndexedZSet.class)) {
DBSPType keyType = data.getOutputIndexedZSetType().keyType;
if (keyType.sameType(DBSPTypeTuple.EMPTY))
Expand All @@ -69,7 +69,7 @@ public static DBSPIntegrateTraceRetainKeysOperator create(
DBSPExpression project = dataField0
.projectExpression(dataArg.deref());
compare = DBSPControlledKeyFilterOperator.generateTupleCompare(
project, controlArg.deref().field(1).field(0), DBSPOpcode.CONTROLLED_FILTER_GTE);
project, controlArg.deepCopy().deref().field(1).field(0), DBSPOpcode.CONTROLLED_FILTER_GTE);
} else {
DBSPType keyType = data.getOutputZSetElementType();
DBSPVariablePath dataArg = keyType.ref().var();
Expand All @@ -78,7 +78,7 @@ public static DBSPIntegrateTraceRetainKeysOperator create(
return null;
DBSPExpression project = dataProjection.projectExpression(dataArg.deref());
compare = DBSPControlledKeyFilterOperator.generateTupleCompare(
project, controlArg.deref().field(1), DBSPOpcode.CONTROLLED_FILTER_GTE);
project, controlArg.deepCopy().deref().field(1), DBSPOpcode.CONTROLLED_FILTER_GTE);
}
compare = ExpressionCompiler.makeBinaryExpression(
node, compare.getType(), DBSPOpcode.OR, compare0, compare);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public static DBSPIntegrateTraceRetainValuesOperator create(
.to(PartiallyMonotoneTuple.class)
.getField(1)
.projectExpression(dataArg.deref());
DBSPExpression compare0 = controlArg.deref().field(0).not();
DBSPExpression compare0 = controlArg.deepCopy().deref().field(0).not();
DBSPExpression compare = DBSPControlledKeyFilterOperator.generateTupleCompare(
project, controlArg.deref().field(1), DBSPOpcode.CONTROLLED_FILTER_GTE);
project, controlArg.deepCopy().deref().field(1), DBSPOpcode.CONTROLLED_FILTER_GTE);
compare = ExpressionCompiler.makeBinaryExpression(
node, compare.getType(), DBSPOpcode.OR, compare0, compare);
DBSPExpression closure = compare.closure(param, controlArg.asParameter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void start(String visitor) {
void stop(String visitor) {
long end = System.currentTimeMillis();
var pair = Utilities.removeLast(this.running);
Utilities.enforce(pair.left.equals(visitor));
Utilities.enforce(pair.left.equals(visitor), () -> "Expected to finish " + pair.left + " but it is " + visitor);
Long started = pair.right;
Profile previous = this.profiles.getOrDefault(visitor, new Profile(0, 0));
this.profiles.put(visitor, previous.add(end - started));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.util.function.Function;

/** A function that transforms an InnerNode into another one. */
public interface IRTransform extends Function<IDBSPInnerNode, IDBSPInnerNode>, ICastable {
/** The operator containing the inner node that is being transformed */
void setOperatorContext(DBSPOperator operator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ public void postorder(DBSPLetStatement statement) {

@Override
public VisitDecision preorder(DBSPLetExpression expression) {
// Initializer variables resolved in outer context
expression.initializer.accept(this);
this.substitutionContext.newContext();
this.substitutionContext.substitute(expression.variable.variable, expression);
return VisitDecision.CONTINUE;
}

@Override
public void postorder(DBSPLetExpression expression) {
expression.consumer.accept(this);
this.substitutionContext.popContext();
return VisitDecision.STOP;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ else if (source.is(DBSPIfExpression.class)) {
ifExp.condition,
ifExp.positive.is_null(),
ifExp.negative.is_null());
} else if (source.is(DBSPBaseTupleExpression.class)) {
// An explicit tuple constructor is never null
result = new DBSPBoolLiteral(false);
}
this.map(expression, result);
}
Expand Down
Loading