Skip to content

Commit

Permalink
[SYSTEMDS-3010] Add missing lineage support for list operations
Browse files Browse the repository at this point in the history
This patch adds a missing lineage support for list creation from Eval,
which was leading to a NullPointerException for topk cleaning.
  • Loading branch information
phaniarnab committed Jan 23, 2025
1 parent eb2ca62 commit e32c323
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,15 @@ public void processInstruction(ExecutionContext ec) {
Data[] ldata = boundOutputNames.stream()
.map(n -> ec.getVariable(n)).toArray(Data[]::new);
String[] lnames = boundOutputNames.toArray(new String[0]);
ListObject listOutput = new ListObject(ldata, lnames);
ListObject listOutput = null;
if (DMLScript.LINEAGE) {
CPOperand[] listOperands = boundOutputNames.stream().map(n -> ec.containsVariable(n) ? new CPOperand(n,
ec.getVariable(n)) : new CPOperand(n, ValueType.STRING, DataType.SCALAR, true)).toArray(CPOperand[]::new);
LineageItem[] liList = LineageItemUtils.getLineage(ec, listOperands);
listOutput = new ListObject(Arrays.asList(ldata), boundOutputNames, Arrays.asList(liList));
}
else
listOutput = new ListObject(ldata, lnames);
ec.setVariable(output.getName(), listOutput);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.sysds.runtime.instructions.cp.ComputationCPInstruction;
import org.apache.sysds.runtime.instructions.cp.Data;
import org.apache.sysds.runtime.instructions.cp.DataGenCPInstruction;
import org.apache.sysds.runtime.instructions.cp.FrameIndexingCPInstruction;
import org.apache.sysds.runtime.instructions.cp.ListIndexingCPInstruction;
import org.apache.sysds.runtime.instructions.cp.MatrixIndexingCPInstruction;
import org.apache.sysds.runtime.instructions.fed.ComputationFEDInstruction;
Expand Down Expand Up @@ -268,7 +269,8 @@ public static boolean isReusable (Instruction inst, ExecutionContext ec) {
|| inst instanceof GPUInstruction
|| inst instanceof ComputationSPInstruction)
&& !(inst instanceof ListIndexingCPInstruction)
&& !(inst instanceof BinaryScalarScalarCPInstruction);
&& !(inst instanceof BinaryScalarScalarCPInstruction)
&& !(inst instanceof FrameIndexingCPInstruction);
boolean rightCPOp = (ArrayUtils.contains(REUSE_OPCODES, inst.getOpcode())
|| (inst.getOpcode().equals("append") && isVectorAppend(inst, ec))
|| (inst.getOpcode().startsWith("spoof"))
Expand Down

0 comments on commit e32c323

Please sign in to comment.