cleanup: Fix build warnings

* BlueOrbNLStream.cs
* ChangeTableNameStream.cs
* FilterStream.cs
* FilterStream.cs
* GroupByOutputTable.cs
* GroupByStream.cs
* JoinForeignTable.cs
* MultiRowRollingMathStream.cs
* MutableAppendStream.cs
* PersistWindowState.cs
* PubsubEchoTestStream.cs
* RowDictionaryTable.cs
* SortedTable.cs
* TimeSeriesStream.cs

Also add Metadata prop to IDataPacket
This commit is contained in:
John Colvin committed 2025-11-15 12:38:49 -05:00
1 parent 8bbe850549
commit 75f2678df6
20 files changed
+532 -472

No files matched your search

@@ -402,13 +402,13 @@ namespace BCG {
}
}
public static DataPacket build_dp(IBlueRowCollection new_rows, DataPacket last_fired_dp) {
public static DataPacket build_dp(IBlueRowCollection new_rows, IDataPacket last_fired_dp) {
IBlueRowCollection added_rows = new_rows;
IBlueRowCollection deleted_rows = last_fired_dp == null ? new BlueTable(new_rows.schema) : last_fired_dp.newRows;
return new DataPacket(new_rows, added_rows, deleted_rows);
}
public static DataPacket build_dp_inc(IBlueRowCollection new_rows, DataPacket last_fired_dp, bool deep_row_comapre = false) {
public static DataPacket build_dp_inc(IBlueRowCollection new_rows, IDataPacket last_fired_dp, bool deep_row_comapre = false) {
if (last_fired_dp == null) {
IBlueRowCollection added_rows = new_rows;
IBlueRowCollection deleted_rows = new BlueTable(new_rows.schema);
@@ -13,11 +13,9 @@ namespace BCG
public override object Current {get{return Entry;}}
#region IDictionaryEnumerator members
public object Key {get{return myRow.schema[myPos].colName;}}
public object Value {get{return myRow[myPos];}}
public DictionaryEntry Entry {get{return new DictionaryEntry (Key, Value);}}
public override object Key => myRow.schema[myPos].colName;
public override object Value => myRow[myPos];
public override DictionaryEntry Entry => new(Key, Value);
#endregion
}
}
@@ -19,10 +19,10 @@ namespace BCG
myRowSize = row.schema.columnNames.Length;
}
public DictionaryEntry Entry =>
public virtual DictionaryEntry Entry =>
new(myRow.schema.columnInfo[myPos].colName, myRow[myPos]);
public object Key => myRow.schema.columnInfo[myPos].colName;
public object Value => myRow[myPos];
public virtual object Key => myRow.schema.columnInfo[myPos].colName;
public virtual object Value => myRow[myPos];
#region IEnumerator members
public void Reset() {myPos = 0;}
@@ -43,7 +43,7 @@ namespace BCG {
}
public IBlueRowCollection newRows, addedRows, deletedRows;
public IDictionary<string, object> meta_data = null;
public Dictionary<string, object> meta_data = null;
public DataPacket() { }
public DataPacket(IBlueRowCollection newRows, IBlueRowCollection addedRows, IBlueRowCollection deletedRows) {
this.newRows = newRows;
@@ -54,6 +54,7 @@ namespace BCG {
IBlueRowCollection IDataPacket.newRows => newRows;
IBlueRowCollection IDataPacket.addedRows => addedRows;
IBlueRowCollection IDataPacket.deletedRows => deletedRows;
IReadOnlyDictionary<string, object> IDataPacket.Metadata => meta_data;
public void get_new_added_deleted(out ICollection new_rows, out ICollection added_rows, out ICollection deleted_rows) {
new_rows = newRows;
@@ -287,15 +288,22 @@ namespace BCG {
}
public class DataPacket<T> : IDataPacket<T> where T : IBlueRow {
public DataPacket(IBlueRowCollection<T> newRows, IBlueRowCollection<T> addedRows, IBlueRowCollection<T> deletedRows) {
public DataPacket(
IBlueRowCollection<T> newRows,
IBlueRowCollection<T> addedRows,
IBlueRowCollection<T> deletedRows,
IReadOnlyDictionary<string, object> metadata = null
) {
this.newRows = newRows;
this.addedRows = addedRows;
this.deletedRows = deletedRows;
Metadata = metadata ?? DictionaryHelper.empty<string, object>();
}
public IBlueRowCollection<T> newRows { get; }
public IBlueRowCollection<T> addedRows { get; }
public IBlueRowCollection<T> deletedRows { get; }
public IReadOnlyDictionary<string, object> Metadata { get; }
public static DataPacket<T> Empty(IBlueTableSchema schema) =>
new(
@@ -13,6 +13,7 @@ namespace BCG {
IBlueRowCollection newRows { get; }
IBlueRowCollection addedRows { get; }
IBlueRowCollection deletedRows { get; }
IReadOnlyDictionary<string, object> Metadata { get; }
//this is an ICollection of IDictionary
void get_new_added_deleted(out ICollection new_rows, out ICollection added_rows, out ICollection deleted_rows);
}
@@ -41,6 +42,12 @@ namespace BCG {
dataPacket.addedRows,
dataPacket.deletedRows);
public static IDataPacket ClearMetadata(this IDataPacket dataPacket) =>
new MetadataWrapper(dataPacket, DictionaryHelper.empty<string, object>());
public static IDataPacket ResetMetadata(this IDataPacket dataPacket, IReadOnlyDictionary<string,object> metadata) =>
new MetadataWrapper(dataPacket, metadata);
public static string GetIncrementalIdString(this IDataPacket dataPacket) {
var incIdSerializer = new DataPacketIncrementalIdsJsonSerializer();
return incIdSerializer.Serialize(dataPacket);
@@ -63,5 +70,24 @@ namespace BCG {
// }
// }
}
class MetadataWrapper : IDataPacket {
readonly IDataPacket source;
public MetadataWrapper(IDataPacket source, IReadOnlyDictionary<string, object> metadata) {
this.source = source;
Metadata = metadata;
}
public IBlueTableSchema Schema => source.Schema;
public IBlueRowCollection newRows => source.newRows;
public IBlueRowCollection addedRows => source.addedRows;
public IBlueRowCollection deletedRows => source.deletedRows;
public IReadOnlyDictionary<string, object> Metadata { get; }
public void get_new_added_deleted(out ICollection new_rows, out ICollection added_rows, out ICollection deleted_rows) {
source.get_new_added_deleted(out new_rows, out added_rows, out deleted_rows);
}
}
}
}