fix: Make sure transient streams are attached to IServiceProvider
So they can retrieve services necessary to function (e.g., add themselves to the master IWorkScheduler so doWork gets called, etc.)
This commit is contained in:
1 parent
5fa284cad3
commit
3ce9f57e95
33 files changed
+113
-102
No files matched your search
@@ -15,7 +15,7 @@ namespace BCG {
|
||||
|
||||
public AddColumnsStream(ViewStream vs, string col_def) {
|
||||
_new_col = parse_exp(col_def);
|
||||
ViewStream rs = new MapStream(vs, (IBlueTableSchema s) => _get_schema(s), (IBlueRow r) => _map(r));
|
||||
ViewStream rs = AttachStream(new MapStream(vs, _get_schema, _map));
|
||||
mySetRealSource(rs);
|
||||
}
|
||||
|
||||
|
||||
+9
-5
@@ -91,10 +91,14 @@ namespace BCG
|
||||
}
|
||||
_increment_values = increment_values_del;
|
||||
_get_column_prefix = get_column_prefix_del;
|
||||
if(only_fire_once)
|
||||
mySetRealSource(new NonIncGroupByStream(new OnlyFireOnceStream(stream), this));
|
||||
else
|
||||
mySetRealSource(new NonIncGroupByStream(stream, this));
|
||||
if(only_fire_once) {
|
||||
ViewStream vs = AttachStream(new OnlyFireOnceStream(stream));
|
||||
vs = AttachStream(new NonIncGroupByStream(vs, this));
|
||||
mySetRealSource(vs);
|
||||
} else {
|
||||
ViewStream vs = AttachStream(new NonIncGroupByStream(stream, this));
|
||||
mySetRealSource(vs);
|
||||
}
|
||||
}
|
||||
|
||||
private void _set_schema(List<string> tc_prefixes, Pair<string, Type>[] group_by_col_info, string table_name)
|
||||
@@ -241,4 +245,4 @@ namespace BCG
|
||||
return values;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace BCG
|
||||
public CaseChangeStream(ViewStream input, bool toUpper, params string[] columnsToChangeCase)
|
||||
{
|
||||
myCaseChangingColumns = columnsToChangeCase;
|
||||
mySetRealSource(new SuperMapStream(input, this));
|
||||
mySetRealSource(AttachStream(new SuperMapStream(input, this)));
|
||||
myIsUpperCase = toUpper;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -32,10 +32,10 @@ namespace BCG
|
||||
|
||||
{
|
||||
mySetRealSource (
|
||||
new MapStream (sourceStream,
|
||||
AttachStream(new MapStream (sourceStream,
|
||||
isConcatenatedDataConfined ? new ConcatenateColumnsMapperForSameDataSet (columnDefs) :
|
||||
new ConcatenateColumnsMapper (columnDefs)
|
||||
)
|
||||
))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace BCG
|
||||
public AverageCollectorStream(ViewStream stream, params string[] columnsToAverage)
|
||||
{
|
||||
myAveragingColumns = columnsToAverage;
|
||||
mySetRealSource(new CrushingCollectorStream(stream, this));
|
||||
mySetRealSource(AttachStream(new CrushingCollectorStream(stream, this)));
|
||||
}
|
||||
|
||||
private string[] myAveragingColumns;
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace BCG
|
||||
foreach (string col in cols)
|
||||
foreach (string c in col.Split (' '))
|
||||
groupByCols.Add (c);
|
||||
mySetRealSource (new GroupByStream (stream,
|
||||
new DistinctRowEvaluator (groupByCols.ToArray (typeof(string)) as string[]), false));
|
||||
mySetRealSource (AttachStream(new GroupByStream (stream,
|
||||
new DistinctRowEvaluator (groupByCols.ToArray (typeof(string)) as string[]), false)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ namespace BCG
|
||||
if (myUseNewFilter)
|
||||
{
|
||||
myFilterStream = new BCG.StreamWorld.Addition.FilterStream(vs, filter);
|
||||
mySetRealSource(myFilterStream);
|
||||
mySetRealSource(AttachStream(myFilterStream));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace BCG {
|
||||
public MaxStream(ViewStream stream, string outputCol, string inputCols) : this(stream, outputCol, inputCols.Split(' ')) {
|
||||
}
|
||||
public MaxStream(ViewStream stream, string outputCol, string[] inputCols) {
|
||||
mySetRealSource(new GroupByStream(stream,
|
||||
new MaxGroupByEvaluator(outputCol, inputCols)));
|
||||
mySetRealSource(AttachStream(new GroupByStream(stream,
|
||||
new MaxGroupByEvaluator(outputCol, inputCols))));
|
||||
}
|
||||
|
||||
public MaxStream(ViewStream stream, string outputCol)
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace BCG {
|
||||
public class MinStream : ViewStream {
|
||||
public MinStream(ViewStream stream, string outputCol, string[] inputCol) {
|
||||
mySetRealSource(new GroupByStream(stream,
|
||||
new MinGroupByEvaluator(outputCol, inputCol)));
|
||||
}
|
||||
public class MinStream : ViewStream {
|
||||
public MinStream(ViewStream stream, string outputCol, string[] inputCol) {
|
||||
mySetRealSource(AttachStream(new GroupByStream(stream,
|
||||
new MinGroupByEvaluator(outputCol, inputCol))));
|
||||
}
|
||||
|
||||
public MinStream(ViewStream stream, string outputCol)
|
||||
: this(new AddColumnsStream(stream, "fakeCol=0"), outputCol, new string[] { "fakeCol" }) { }
|
||||
}
|
||||
public MinStream(ViewStream stream, string outputCol)
|
||||
: this(new AddColumnsStream(stream, "fakeCol=0"), outputCol, new string[] { "fakeCol" }) {
|
||||
ViewStream vs = AttachStream(new AddColumnsStream(stream, "fakeCol=0"));
|
||||
vs = AttachStream(new GroupByStream(vs, new MinGroupByEvaluator(outputCol, new[] { "fakeCol" })));
|
||||
mySetRealSource(vs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,22 +26,22 @@ namespace BCG {
|
||||
public SumStream(ViewStream stream, string spaceSeparatedOutputCols, string spaceSeparatedGroupByCols) {
|
||||
string[] outputCols = spaceSeparatedOutputCols.Split(' ');
|
||||
string[] groupByCols = spaceSeparatedGroupByCols.Split(' ');
|
||||
mySetRealSource(new GroupByStream(stream,
|
||||
mySetRealSource(AttachStream(new GroupByStream(stream,
|
||||
outputCols.Length == 1 ? new SumGroupByEvaluator(outputCols[0], groupByCols) as IGroupByEvaluator :
|
||||
new MultiColumnSumGroupByEvaluator(spaceSeparatedOutputCols, spaceSeparatedGroupByCols)));
|
||||
new MultiColumnSumGroupByEvaluator(spaceSeparatedOutputCols, spaceSeparatedGroupByCols))));
|
||||
}
|
||||
|
||||
public SumStream(ViewStream stream, string[] output_columns) {
|
||||
ViewStream rs = new AddColumnsStream(stream, "fake_col=0");
|
||||
rs = new SumStream(rs, output_columns, new string[] { "fake_col" }, false);
|
||||
rs = new ProjectStream(rs, "!fake_col");
|
||||
ViewStream rs = AttachStream(new AddColumnsStream(stream, "fake_col=0"));
|
||||
rs = AttachStream(new SumStream(rs, output_columns, new string[] { "fake_col" }, false));
|
||||
rs = AttachStream(new ProjectStream(rs, "!fake_col"));
|
||||
mySetRealSource(rs);
|
||||
}
|
||||
|
||||
public SumStream(ViewStream stream, string space_seperated_output_columns, string space_seperated_groupby_columns, bool force_null_into_other_columns) {
|
||||
string[] output_columns = space_seperated_output_columns.Split(' ');
|
||||
string[] groupby_columns = String.IsNullOrEmpty(space_seperated_groupby_columns) ? new string[] { } : space_seperated_groupby_columns.Split(' ');
|
||||
mySetRealSource(new SumStream(stream, output_columns, groupby_columns, force_null_into_other_columns));
|
||||
mySetRealSource(AttachStream(new SumStream(stream, output_columns, groupby_columns, force_null_into_other_columns)));
|
||||
}
|
||||
|
||||
public SumStream(ViewStream stream, string[] output_columns, string[] groupby_columns, bool force_null_into_other_columns) {
|
||||
@@ -52,12 +52,13 @@ namespace BCG {
|
||||
// rs = new GroupByStream(rs, new MultiColumnSumGroupByEvaluator(output_columns, new string[] { "fake_col" }));
|
||||
// rs = new ProjectStream(rs, "!fake_col");
|
||||
} else {
|
||||
rs = new GroupByStream(stream, new MultiColumnSumGroupByEvaluator(output_columns, groupby_columns));
|
||||
rs = AttachStream(new GroupByStream(stream, new MultiColumnSumGroupByEvaluator(output_columns, groupby_columns)));
|
||||
}
|
||||
if (force_null_into_other_columns) {
|
||||
ArgumentNullException.ThrowIfNull(rs);
|
||||
List<string> valid_cols = new List<string>(output_columns);
|
||||
valid_cols.AddRange(groupby_columns);
|
||||
rs = new MapStream(rs, new NullMapper(valid_cols.ToArray()));
|
||||
rs = AttachStream(new MapStream(rs, new NullMapper(valid_cols.ToArray())));
|
||||
}
|
||||
mySetRealSource(rs);
|
||||
}
|
||||
@@ -71,9 +72,9 @@ namespace BCG {
|
||||
public IntSumStream(ViewStream stream, string spaceSeparatedOutputCols, string spaceSeparatedGroupByCols) {
|
||||
string[] outputCols = spaceSeparatedOutputCols.Split(' ');
|
||||
string[] groupByCols = spaceSeparatedGroupByCols.Split(' ');
|
||||
mySetRealSource(new GroupByStream(stream,
|
||||
mySetRealSource(AttachStream(new GroupByStream(stream,
|
||||
outputCols.Length == 1 ? new SumGroupByEvaluator<int>(outputCols[0], groupByCols) as IGroupByEvaluator :
|
||||
new MultiColumnSumGroupByEvaluator<int>(spaceSeparatedOutputCols, spaceSeparatedGroupByCols)));
|
||||
new MultiColumnSumGroupByEvaluator<int>(spaceSeparatedOutputCols, spaceSeparatedGroupByCols))));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -82,8 +83,8 @@ namespace BCG {
|
||||
public class SumStream<T> : ViewStream {
|
||||
public SumStream(ViewStream stream, string outputCol, string spaceSeparatedInputCols) {
|
||||
string[] inputCols = spaceSeparatedInputCols.Split(' ');
|
||||
mySetRealSource(new GroupByStream(stream,
|
||||
new SumGroupByEvaluator<T>(outputCol, inputCols)));
|
||||
mySetRealSource(AttachStream(new GroupByStream(stream,
|
||||
new SumGroupByEvaluator<T>(outputCol, inputCols))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,9 @@ namespace BCG
|
||||
{
|
||||
if (myUseSuperJoin)
|
||||
{
|
||||
ViewStream rs = this is LeftJoinStream ?
|
||||
new SuperLeftJoinStream(v1, joinCol1, cm1.columnExpression, v2, joinCol2, cm2.columnExpression) as ViewStream :
|
||||
new SuperJoinStream(v1, joinCol1, cm1.columnExpression, v2, joinCol2, cm2.columnExpression) as ViewStream;
|
||||
ViewStream rs = AttachStream(this is LeftJoinStream
|
||||
? new SuperLeftJoinStream(v1, joinCol1, cm1.columnExpression, v2, joinCol2, cm2.columnExpression)
|
||||
: new SuperJoinStream(v1, joinCol1, cm1.columnExpression, v2, joinCol2, cm2.columnExpression));
|
||||
mySetRealSource(rs);
|
||||
}
|
||||
else
|
||||
@@ -65,9 +65,9 @@ namespace BCG
|
||||
{
|
||||
if (myUseSuperJoin)
|
||||
{
|
||||
ViewStream rs = this is LeftJoinStream ?
|
||||
new SuperLeftJoinStream(v1, joinCol1, v2, joinCol2) as ViewStream :
|
||||
new SuperJoinStream(v1, joinCol1, v2, joinCol2) as ViewStream;
|
||||
ViewStream rs = AttachStream(this is LeftJoinStream
|
||||
? new SuperLeftJoinStream(v1, joinCol1, v2, joinCol2)
|
||||
: new SuperJoinStream(v1, joinCol1, v2, joinCol2));
|
||||
mySetRealSource(rs);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace BCG
|
||||
rightJoinColArray = rightJoinColumns.Split(' ', ',', ';');
|
||||
if (leftJoinColArray.Length == 1 && rightJoinColArray.Length == 1)
|
||||
/// so that this handles regular joins too
|
||||
mySetRealSource(leftJoin ? new SuperLeftJoinStream(leftStream, leftJoinColArray[0], leftProject,
|
||||
mySetRealSource(AttachStream(leftJoin ? new SuperLeftJoinStream(leftStream, leftJoinColArray[0], leftProject,
|
||||
rightStream, rightJoinColArray[0], rightProject) :
|
||||
new SuperJoinStream(leftStream, leftJoinColArray[0], leftProject,
|
||||
rightStream, rightJoinColArray[0], rightProject));
|
||||
rightStream, rightJoinColArray[0], rightProject)));
|
||||
else
|
||||
{
|
||||
string leftCols = "ljc:";
|
||||
@@ -41,12 +41,12 @@ namespace BCG
|
||||
foreach (string c in rightJoinColArray)
|
||||
rightCols += c + " ";
|
||||
rightCols = rightCols.Trim();
|
||||
ViewStream res =
|
||||
leftJoin ? new SuperLeftJoinStream(new ConcatenateColumnsStream(leftStream, leftCols), "ljc", leftProject,
|
||||
new ConcatenateColumnsStream(rightStream, rightCols), "rjc", rightProject) :
|
||||
new SuperJoinStream(new ConcatenateColumnsStream(leftStream, leftCols), "ljc", leftProject,
|
||||
new ConcatenateColumnsStream(rightStream, rightCols), "rjc", rightProject);
|
||||
res = new ProjectStream(res, "!ljc rjc");
|
||||
leftStream = AttachStream(new ConcatenateColumnsStream(leftStream, leftCols));
|
||||
rightStream = AttachStream(new ConcatenateColumnsStream(rightStream, rightCols));
|
||||
ViewStream res = AttachStream(leftJoin
|
||||
? new SuperLeftJoinStream(leftStream, "ljc", leftProject, rightStream, "rjc", rightProject)
|
||||
: new SuperJoinStream(leftStream, "ljc", leftProject, rightStream, "rjc", rightProject));
|
||||
res = AttachStream(new ProjectStream(res, "!ljc rjc"));
|
||||
mySetRealSource(res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace BCG {
|
||||
throw (new Exception("Error occured at line: " + n.ToString() + " " + e.Message));
|
||||
}
|
||||
|
||||
mySetRealSource(new BlueRowCollectionStaticStream(t));
|
||||
mySetRealSource(AttachStream(new BlueRowCollectionStaticStream(t)));
|
||||
}
|
||||
|
||||
public LiteralStream(string schema, string value) : this("literal", schema, value) { }
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace BCG {
|
||||
|
||||
public MapStream(ViewStream vs, IStreamMapper mapper) : base(vs) {
|
||||
if (myUseNewMap)
|
||||
mySetRealSource(new SuperMapStream(vs, mapper));
|
||||
mySetRealSource(AttachStream(new SuperMapStream(vs, mapper)));
|
||||
else
|
||||
myMapper = mapper;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace BCG {
|
||||
|
||||
public MapStream(ViewStream vs, IChangeableStreamMapper mapper) : this(vs, (IStreamMapper)mapper) {
|
||||
if (myUseNewMap)
|
||||
mySetRealSource(new SuperMapStream(vs, mapper));
|
||||
mySetRealSource(AttachStream(new SuperMapStream(vs, mapper)));
|
||||
else {
|
||||
mapper.onMapperChange += new MapperChangeDelegate(myMapperChanged);
|
||||
myChangeableMapper = mapper;
|
||||
|
||||
@@ -561,7 +561,7 @@ namespace BCG {
|
||||
private static TestResult _run_pubsub_server_stream_tag_handler_test() {
|
||||
// create message
|
||||
var schema = create_schema_with_all_types();
|
||||
var tag = "DS_" + schema.tableName;
|
||||
var tag = DSTagManager.get_stream_tag(schema.tableName);
|
||||
BlueTable cr_rows = new BlueTable(schema);
|
||||
// 100 rows
|
||||
int n_rows = 100;
|
||||
@@ -570,7 +570,7 @@ namespace BCG {
|
||||
cr_rows.addRow(nr);
|
||||
}
|
||||
|
||||
PubsubServerSingleStreamTagHandler handler = new PubsubServerSingleStreamTagHandler();
|
||||
PubsubServerSingleStreamTagHandler handler = new PubsubServerSingleStreamTagHandler(tag);
|
||||
bts.StreamIOMessage.CreateMessage cr_msg = new bts.StreamIOMessage.CreateMessage(cr_rows);
|
||||
bts.StreamIOMessage str_io_msg = new bts.StreamIOMessage(cr_msg);
|
||||
IStreamIOMsgSerializer ser = new StreamIOSerializationController();
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace BCG {
|
||||
: this(TimeSpan.FromSeconds(ticking_period_msecs)) { }
|
||||
|
||||
public TickingTestStream(TimeSpan ticking_period_msecs) {
|
||||
ViewStream vs = new DisplayableMillisecondStream(Convert.ToInt32(ticking_period_msecs.TotalMilliseconds), 10);
|
||||
vs = new MathStream(vs, "x=id*123 y=x*x");
|
||||
ViewStream vs = AttachStream(new DisplayableMillisecondStream(Convert.ToInt32(ticking_period_msecs.TotalMilliseconds), 10));
|
||||
vs = AttachStream(new MathStream(vs, "x=id*123 y=x*x"));
|
||||
mySetRealSource(vs);
|
||||
//vs.onChange += _on_str_update;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace bts {
|
||||
// now we creaate a TimeFilter stream to keep the table as a circular buffer of the last N days
|
||||
// passed A an argument in the constructor above
|
||||
// time_filter is a string like 7d 1h 30 m 45s
|
||||
output_stream = new TimeBasedFilterStream(output_stream, "created_at", ttl);
|
||||
output_stream = AttachStream(new TimeBasedFilterStream(output_stream, "created_at", ttl));
|
||||
mySetRealSource(output_stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class MongoCollectionStream : ViewStream, IObservable<DataPacket> {
|
||||
this.databaseName = databaseName;
|
||||
this.url = url;
|
||||
this.rowFactory = rowFactory;
|
||||
mySetRealSource(new ObservableViewStream(this));
|
||||
mySetRealSource(AttachStream(new ObservableViewStream(this)));
|
||||
}
|
||||
|
||||
MongoClient client => clientBacking ??= new(url);
|
||||
|
||||
@@ -193,9 +193,9 @@ namespace bts {
|
||||
this(connection_string, db_name, collection_name, timestamp_col, TimeBasedFilter.parse_duration(ttl_duration)) { }
|
||||
|
||||
public MongoDBFlatStream(string connection_string, string db_name, string collection_name, string timestamp_col, TimeSpan ttl_duration) {
|
||||
ViewStream rs = new MongoDBStream(connection_string, db_name, collection_name);
|
||||
rs = new KeyValueToRelationalStream(rs, "doc_id", "key", "val");
|
||||
rs = new DateStandardizationStream(rs, timestamp_col, DateConversion.ISO8601);
|
||||
ViewStream rs = AttachStream(new MongoDBStream(connection_string, db_name, collection_name));
|
||||
rs = AttachStream(new KeyValueToRelationalStream(rs, "doc_id", "key", "val"));
|
||||
rs = AttachStream(new DateStandardizationStream(rs, timestamp_col, DateConversion.ISO8601));
|
||||
//rs = new TimeBasedFilterStream(vsd, rs, timestamp_col, ttl_duration);
|
||||
mySetRealSource(rs);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace BCG
|
||||
|
||||
myInColumn = inColumn;
|
||||
myMuxedValues = (object[])muxedValues.Clone();
|
||||
mySetRealSource(new MapStream(inStream, this));
|
||||
mySetRealSource(AttachStream(new MapStream(inStream, this)));
|
||||
}
|
||||
|
||||
#region IStreamMapper Members
|
||||
|
||||
@@ -8,14 +8,14 @@ namespace BCG
|
||||
{
|
||||
public NullToConstantStream(ViewStream v, string field, object constant)
|
||||
{
|
||||
if(string.IsNullOrEmpty(field))
|
||||
mySetRealSource(new MapStream(v, new AllNullToConstantMapper(constant)));
|
||||
else
|
||||
mySetRealSource (new MapStream(v,new NullToConstantMapper(field, constant)));
|
||||
var vs = AttachStream<MapStream>(string.IsNullOrEmpty(field)
|
||||
? new(v, new AllNullToConstantMapper(constant))
|
||||
: new(v,new NullToConstantMapper(field, constant)));
|
||||
mySetRealSource(vs);
|
||||
}
|
||||
public NullToConstantStream(ViewStream v, object constant)
|
||||
{
|
||||
mySetRealSource(new MapStream(v, new AllNullToConstantMapper(constant)));
|
||||
mySetRealSource(AttachStream(new MapStream(v, new AllNullToConstantMapper(constant))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ namespace BCG
|
||||
public ChangeTableNameStream (ViewStream vs, string name)
|
||||
{
|
||||
myNewName = name;
|
||||
mySetRealSource (new MapStream (vs, this));
|
||||
mySetRealSource (AttachStream(new MapStream (vs, this)));
|
||||
}
|
||||
|
||||
#region IStreamMapper Members
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace bts {
|
||||
public NewProjectStream(ViewStream vs, string project_expression) {
|
||||
_stream = vs;
|
||||
_project_expression = project_expression;
|
||||
_stream = new MapStream(vs, this);
|
||||
_stream = AttachStream(new MapStream(vs, this));
|
||||
mySetRealSource(_stream);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BCG {
|
||||
public ProjectStream (ViewStream vs, string colExp, string tableName)
|
||||
{
|
||||
if (colExp == "!")
|
||||
mySetRealSource (new ChangeTableNameStream (vs, tableName));
|
||||
mySetRealSource (AttachStream(new ChangeTableNameStream (vs, tableName)));
|
||||
else
|
||||
{
|
||||
myVs = vs;
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace BCG
|
||||
{
|
||||
public CSVReaderStreamMapperStream(ViewStream stream, string output_schema)
|
||||
{
|
||||
mySetRealSource(new MapStream(stream, new CSVReaderStreamMapper(output_schema)));
|
||||
mySetRealSource(AttachStream(new MapStream(stream, new CSVReaderStreamMapper(output_schema))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BCG {
|
||||
public DateStandardizationStream(ViewStream vs, string colName, DateConversion conversion) {
|
||||
myConversionColName = colName;
|
||||
myConversion = conversion;
|
||||
mySetRealSource(new MapStream(vs, this));
|
||||
mySetRealSource(AttachStream(new MapStream(vs, this)));
|
||||
}
|
||||
|
||||
#region IStreamMapper Members
|
||||
@@ -135,4 +135,4 @@ namespace BCG {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace BCG
|
||||
_src = input;
|
||||
_time_stamp_field = time_stamp_field;
|
||||
_latency_field = latency_field;
|
||||
mySetRealSource(new MapStream(input, this));
|
||||
mySetRealSource(AttachStream(new MapStream(input, this)));
|
||||
}
|
||||
|
||||
#region IStreamMapper Members
|
||||
|
||||
@@ -61,7 +61,9 @@ namespace BCG {
|
||||
new ColumnInfo("id", 0, typeof(int)),
|
||||
new ColumnInfo("time", 1, typeof(string)));
|
||||
public DisplayableMillisecondStream(int intervalInMs, int sz) {
|
||||
mySetRealSource(new MapStream(new MSecondStream(intervalInMs, sz), this));
|
||||
ViewStream vs = AttachStream(new MSecondStream(intervalInMs, sz));
|
||||
vs = AttachStream(new MapStream(vs, this));
|
||||
mySetRealSource(vs);
|
||||
}
|
||||
#region IStreamMapper Members
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace BCG
|
||||
public AppendStream(ViewStream v1, ViewStream v2)
|
||||
{
|
||||
if (myUseNewAppend)
|
||||
mySetRealSource(new MutableAppendStream(v1, v2));
|
||||
mySetRealSource(AttachStream(new MutableAppendStream(v1, v2)));
|
||||
else
|
||||
{
|
||||
myLeftVs = v1;
|
||||
@@ -27,7 +27,7 @@ namespace BCG
|
||||
{
|
||||
|
||||
if (myUseNewAppend)
|
||||
mySetRealSource(new MutableAppendStream(vss));
|
||||
mySetRealSource(AttachStream(new MutableAppendStream(vss)));
|
||||
else
|
||||
{
|
||||
if (vss.Length == 1)
|
||||
@@ -36,7 +36,7 @@ namespace BCG
|
||||
{
|
||||
AppendStream rv = null;
|
||||
foreach (ViewStream s in vss)
|
||||
rv = rv == null ? new AppendStream(new ViewStream[] { s }) : new AppendStream(rv, s);
|
||||
rv = AttachStream<AppendStream>(rv is null ? new(s) : new(rv, s));
|
||||
mySetRealSource(rv);
|
||||
}
|
||||
else
|
||||
@@ -112,7 +112,9 @@ namespace BCG
|
||||
{
|
||||
public MergeStream (ViewStream v1, ViewStream v2, string[] mergeCols)
|
||||
{
|
||||
mySetRealSource (new DistinctRowStream (new AppendStream (v1, v2), mergeCols));
|
||||
ViewStream vs = AttachStream(new AppendStream (v1, v2));
|
||||
vs = AttachStream(new DistinctRowStream (vs, mergeCols));
|
||||
mySetRealSource(vs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace BCG
|
||||
{
|
||||
AppendStreamModified rv = null;
|
||||
foreach (ViewStream s in vss)
|
||||
rv = rv == null ? new AppendStreamModified (new ViewStream[] {s}) : new AppendStreamModified (rv, s);
|
||||
rv = AttachStream<AppendStreamModified>(rv is null ? new (new[] {s}) : new (rv, s));
|
||||
mySetRealSource (rv);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-13
@@ -27,20 +27,18 @@ namespace BCG {
|
||||
|
||||
public class SecurityRenkoStream : ViewStream {
|
||||
public SecurityRenkoStream(int sec_key, double brick_sz) {
|
||||
ViewStream r;
|
||||
|
||||
r = new FilterStream(new BBOStream(),
|
||||
$"sec_key={sec_key}");
|
||||
r = new MathStream(r,
|
||||
"wt_mid_price = (bid_price*bid_sz + ask_price*ask_sz)/(bid_sz+ask_sz)");
|
||||
r = new TimeSeriesStream(r);
|
||||
r = new MathStream(r,
|
||||
"sz = (bid_sz + ask_sz) * 1.0");
|
||||
r = new FilterStream(r,
|
||||
"sz > 0");
|
||||
r = new RenkoStream(r,
|
||||
ViewStream r = AttachStream(new FilterStream(new BBOStream(),
|
||||
$"sec_key={sec_key}"));
|
||||
r = AttachStream(new MathStream(r,
|
||||
"wt_mid_price = (bid_price*bid_sz + ask_price*ask_sz)/(bid_sz+ask_sz)"));
|
||||
r = AttachStream(new TimeSeriesStream(r));
|
||||
r = AttachStream(new MathStream(r,
|
||||
"sz = (bid_sz + ask_sz) * 1.0"));
|
||||
r = AttachStream(new FilterStream(r,
|
||||
"sz > 0"));
|
||||
r = AttachStream(new RenkoStream(r,
|
||||
"wt_mid_price",
|
||||
brick_sz);
|
||||
brick_sz));
|
||||
|
||||
|
||||
mySetRealSource(r);
|
||||
|
||||
+5
-3
@@ -9,7 +9,8 @@ namespace BCG {
|
||||
[DataStreamUserRespresentation("timeseriesanalysis")]
|
||||
public class TimeSeriesGroupByStream : ViewStream {
|
||||
public TimeSeriesGroupByStream(ViewStream md_str, string timebucket_col, string output_col, string operation) {
|
||||
ViewStream rs = new NonIncGroupByStream(md_str, new OHLCNonIncGroupByEvaluator(timebucket_col, output_col));
|
||||
ViewStream rs = AttachStream<NonIncGroupByStream>(
|
||||
new(md_str, new OHLCNonIncGroupByEvaluator(timebucket_col, output_col)));
|
||||
mySetRealSource(rs);
|
||||
}
|
||||
}
|
||||
@@ -123,8 +124,9 @@ namespace BCG {
|
||||
public class OHLCStream : ViewStream {
|
||||
// for ms_str expects a timeseries with a timestamp col and an output col (price col) to calculate the ohlc for
|
||||
public OHLCStream(ViewStream md_str, string timebucket_column, string output_col) {
|
||||
ViewStream rs = new TimeSeriesGroupByStream(md_str, timebucket_column, output_col, TSGroupByOperation.OHLC.ToString());
|
||||
ViewStream rs = AttachStream<TimeSeriesGroupByStream>(
|
||||
new(md_str, timebucket_column, output_col, TSGroupByOperation.OHLC.ToString()));
|
||||
mySetRealSource(rs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,9 @@ namespace BCG {
|
||||
[DataStreamUserRespresentation("deadPublisherTags")]
|
||||
public class DeadPublisherTagsStream : ViewStream {
|
||||
public DeadPublisherTagsStream() {
|
||||
ViewStream serverState = new PubSubServerStateStream();
|
||||
serverState = new FilterStream(serverState, "publishers='' and deadPublishers<>''");
|
||||
serverState = new ProjectStream(serverState, "!subscribers publishers deadPublishers");
|
||||
ViewStream serverState = AttachStream(new PubSubServerStateStream());
|
||||
serverState = AttachStream(new FilterStream(serverState, "publishers='' and deadPublishers<>''"));
|
||||
serverState = AttachStream(new ProjectStream(serverState, "!subscribers publishers deadPublishers"));
|
||||
mySetRealSource(serverState);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user