cleanup: Fix more build warnings in DataStreamSuite

Alot more
This commit is contained in:
John Colvin committed 2026-01-11 15:15:13 -05:00
1 parent 989d103eef
commit bcd207f89e
118 files changed
+1812 -1597

No files matched your search

@@ -1,4 +1,9 @@
using System.Collections;
using Bts.DataStreamCore;
using Spark.Core.Diagnostics;
using System;
using System.Collections.Generic;
namespace BCG
{
@@ -12,7 +17,8 @@ namespace BCG
protected IDataPacket? myLeftDataPacket;
protected IDataPacket? myRightDataPacket;
//Container to contain all the left rows that are orphaned during a deletion operation
private IDictionary myLeftOrphanedRows;
Dictionary<int, RowNode>? myLeftOrphanedRows;
public LeftInternalJoinStream (ViewStream vsLeft, string jcLeft, ViewStream vsRight, string jcRight) :
base (vsLeft, jcLeft, vsRight, jcRight) {}
@@ -61,7 +67,9 @@ namespace BCG
private void myTestAndFire (bool isLeft)
{
JoinOperand jo = isLeft ? myLeftOperand : myRightOperand;
var dp = isLeft ? myLeftDataPacket : myRightDataPacket;
var dp = isLeft
? ExceptionAssert.NotNull(myLeftDataPacket)
: ExceptionAssert.NotNull(myRightDataPacket);
//to test whether both have received call backs
if (myLeftOperand.hasReceivedData)
jo.changeHandler (dp);
@@ -79,11 +87,13 @@ namespace BCG
/// <param name="isLeft"></param>
public override void addRows (IBlueRowCollection rows, bool isLeft)
{
ExceptionAssert.NotNull(myLastFiredPacket);
foreach (IBlueRow row in rows)
myAddRow (row, isLeft);
if (!isLeft)
foreach (RowNode node in myLeftOrphanedRows.Values)
((JoinTable)myLastFiredPacket.newRows).addRow (node.row, null, myLastFiredPacket);
foreach (RowNode node in ExceptionAssert.NotNull(myLeftOrphanedRows).Values) {
((JoinTable)myLastFiredPacket.newRows).addRow(node.RequireRow(), null, myLastFiredPacket);
}
}
/// <summary>
@@ -93,17 +103,19 @@ namespace BCG
/// <param name="isLeft"></param>
public override void deleteRows (IBlueRowCollection rows, bool isLeft)
{
myLeftOrphanedRows = new Hashtable ();
myLeftOrphanedRows = new();
foreach (IBlueRow row in rows)
myDeleteRow (row, isLeft);
}
private void myAddRow (IBlueRow row, bool isLeft)
{
ExceptionAssert.NotNull(myLastFiredPacket);
if (isLeft)
{
myLeftOperand.addRow (row);
RowList matchedRows = myRightOperand.getMatchingRows (row[myLeftJoinColOrdinal]);
var joinKey = ExceptionAssert.NotNull(row[myLeftJoinColOrdinal]);
RowList matchedRows = myRightOperand.getMatchingRows(joinKey);
if (matchedRows.Count == 0)
((JoinTable)myLastFiredPacket.newRows).addRow (row, null, myLastFiredPacket);
else
@@ -112,22 +124,25 @@ namespace BCG
}
else
{
RowList matchedRows = myLeftOperand.getMatchingRows (row[myRightJoinColOrdinal]);
int rightMatchingRowCount = myRightOperand.getMatchingRows (row[myRightJoinColOrdinal]).Count;
var joinKey = ExceptionAssert.NotNull(row[myRightJoinColOrdinal]);
RowList matchedRows = myLeftOperand.getMatchingRows(joinKey);
int rightMatchingRowCount = myRightOperand.getMatchingRows(joinKey).Count;
myRightOperand.addRow (row);
int newRightMatchingRowCount = myRightOperand.getMatchingRows (row[myRightJoinColOrdinal]).Count;
int newRightMatchingRowCount = myRightOperand.getMatchingRows(joinKey).Count;
if (matchedRows.Count != 0){
foreach (RowNode matchedNode in matchedRows)
{
ExceptionAssert.NotNull(matchedNode.row);
//if the left rows were orphaned in this transaction (ie in this callback), they should
//just be removed from the orphanedlist and we dont need to worry about the consistency of
//the jointable as a new row will replace it
if (rightMatchingRowCount == 0 && newRightMatchingRowCount > 0)
{
if (myLeftOrphanedRows[matchedNode.row["id"]] == null)
((JoinTable)myLastFiredPacket.newRows).deleteRow (true, matchedNode.row, myLastFiredPacket);
else
myLeftOrphanedRows.Remove (matchedNode.row["id"]);
ExceptionAssert.NotNull(myLeftOrphanedRows);
int matchedId = matchedNode.row.Id();
if (!myLeftOrphanedRows.Remove(matchedId)) {
((JoinTable)myLastFiredPacket.newRows).deleteRow(true, matchedNode.row, myLastFiredPacket);
}
}
//they were orphaned by a previous transaction and hence the orphans need to be
//removed from the Jointable and the complete row added
@@ -140,41 +155,52 @@ namespace BCG
private void myDeleteRow (IBlueRow row, bool isLeft)
{
var last = requireLastFiredPacket();
if (isLeft)
{
myLeftOperand.deleteRow (row);
((JoinTable)myLastFiredPacket.newRows).deleteRow (true, row, myLastFiredPacket);
((JoinTable)last.newRows).deleteRow (true, row, myLastFiredPacket);
}
else
{
RowList matchedRows = myLeftOperand.getMatchingRows (row[myRightJoinColOrdinal]);
int rightMatchingRowCount = myRightOperand.getMatchingRows (row[myRightJoinColOrdinal]).Count;
var rightJoinKey = row[myRightJoinColOrdinal] ?? throw new InvalidOperationException("RightJoinKey is null");
RowList matchedRows = myLeftOperand.getMatchingRows(rightJoinKey);
int rightMatchingRowCount = myRightOperand.getMatchingRows(rightJoinKey).Count;
myRightOperand.deleteRow (row);
int newRightMatchingRowCount = myRightOperand.getMatchingRows (row[myRightJoinColOrdinal]).Count;
int newRightMatchingRowCount = myRightOperand.getMatchingRows(rightJoinKey).Count;
if (matchedRows.Count != 0)
{
if (rightMatchingRowCount > 0 && newRightMatchingRowCount == 0)
if (rightMatchingRowCount > 0 && newRightMatchingRowCount == 0) {
ExceptionAssert.MemberNotNull(myLeftOrphanedRows);
//ie all the matchedRows were joined with 'this' right row (method arg), and hence they need to
//be handled specially, ie joined with nulls, if there are no right rows with this
//joincolumn value being inserted.
ExceptionAssert.NotNull(myLeftOrphanedRows);
foreach (RowNode matchedNode in matchedRows)
{
// BlueEventLog.logAssert (myLeftOrphanedRows[matchedNode.row["id"]] == null);
myLeftOrphanedRows[matchedNode.row["id"]] = matchedNode;
myLeftOrphanedRows[matchedNode.row.Id()] = matchedNode;
}
((JoinTable)myLastFiredPacket.newRows).deleteRow (false, row, myLastFiredPacket);
}
((JoinTable)last.newRows).deleteRow (false, row, myLastFiredPacket);
}
}
}
public override void onTableClear (bool isLeft)
{
if (myLastFiredPacket is null) {
return;
}
requireSchema();
myLastFiredPacket.deletedRows = myLastFiredPacket.newRows;
myLastFiredPacket.newRows = new JoinTable (mySchema);
myLastFiredPacket.addedRows = new BlueTable (mySchema);
if (!isLeft)
if (!isLeft) {
ExceptionAssert.MemberNotNull(myLeftDataPacket);
foreach (IBlueRow row in myLeftDataPacket.newRows)
((JoinTable)myLastFiredPacket.newRows).addRow (row, null, myLastFiredPacket);
}
}
}