Files
spark/src/DataStreamSuite/DataStream/Primitives/Join/JoinStream.cs
T
2023-09-04 16:25:40 -04:00

166 lines
6.3 KiB
C#

// using System;
// using System.Data;
// using System.Collections;
// using System.Text.RegularExpressions;
// using BCG.Utilities;
// using BCG.Utilities.General;
// namespace BCG
// {
// public class JoinStream : ViewStream
// {
// protected InternalJoinStream myIjs;
// protected ProjectStream myPs;
// protected ColumnMap myLeftCm, myRightCm;
// protected bool myIsProject = true;
// private bool myUseSuperJoin = DataStreamLoadFileConfig.instance.useNewJoin;
// protected JoinStream () {}
// public JoinStream (ViewStream v1, string joinCol1, ColumnMap cm1,
// ViewStream v2, string joinCol2, ColumnMap cm2)
// {
// 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;
// mySetRealSource(rs);
// }
// else
// {
// myLeftCm = cm1;
// myRightCm = cm2;
// //myIjs = new InternalJoinStream (v1, joinCol1, v2, joinCol2);
// myIjs = myConstructInternalJoinStream(v1, joinCol1, v2, joinCol2);
// }
// }
// public JoinStream (ViewStream v1, string joinCol1, string cmExp1,
// ViewStream v2, string joinCol2, string cmExp2)
// :
// this (
// v1,
// joinCol1,
// (cmExp1 == null ? new ColumnMap("!"):new ColumnMap(cmExp1)),
// v2,
// joinCol2,
// (cmExp2 == null ? new ColumnMap("!"):new ColumnMap(cmExp2)))
// {}
// public JoinStream (ViewStream v1, string joinCol1, string cmExp1,
// ViewStream v2, string joinCol2)
// :
// this (v1,joinCol1, new ColumnMap(cmExp1), v2, joinCol2)
// {}
// public JoinStream (ViewStream v1, string joinCol1,
// ViewStream v2, string joinCol2, string cmExp2)
// :
// this (v1,joinCol1, v2, joinCol2, new ColumnMap(cmExp2))
// {}
// public JoinStream (ViewStream v1, string joinCol1, ViewStream v2, string joinCol2)
// {
// if (myUseSuperJoin)
// {
// ViewStream rs = this is LeftJoinStream ?
// new SuperLeftJoinStream(v1, joinCol1, v2, joinCol2) as ViewStream :
// new SuperJoinStream(v1, joinCol1, v2, joinCol2) as ViewStream;
// mySetRealSource(rs);
// }
// else
// {
// //myIjs = new InternalJoinStream (v1, joinCol1, v2, joinCol2);
// myIjs = myConstructInternalJoinStream(v1, joinCol1, v2, joinCol2);
// myIsProject = false;
// }
// }
// public JoinStream (ViewStream v1, string joinCol1, ColumnMap cm1, ViewStream v2, string joinCol2)
// {
// myLeftCm = cm1;
// myRightCm = new ColumnMap ("!");
// //myIjs = new InternalJoinStream (v1, joinCol1, v2, joinCol2);
// myIjs = myConstructInternalJoinStream (v1, joinCol1, v2, joinCol2);
// }
// public JoinStream (ViewStream v1, string joinCol1, ViewStream v2, string joinCol2, ColumnMap cm2)
// {
// myLeftCm = new ColumnMap ("!");
// myRightCm = cm2;
// //myIjs = new InternalJoinStream (v1, joinCol1, v2, joinCol2);
// myIjs = myConstructInternalJoinStream (v1, joinCol1, v2, joinCol2);
// }
// protected virtual InternalJoinStream myConstructInternalJoinStream (
// ViewStream vs1,
// string joinCol1,
// ViewStream vs2,
// string joinCol2)
// {
// return new InternalJoinStream (vs1, joinCol1, vs2, joinCol2);
// }
// protected void myInternalJoinChangeHandler (object o)
// {
// if (myIsProject)
// {
// if (myPs == null)
// {
// JoinNameResolver resolver = new JoinNameResolver ((JoinTableSchema)myIjs.schema, myIjs.getSchema (true), myLeftCm.columnExpression,
// myIjs.getSchema (false), myRightCm.columnExpression);
// IDictionary map = resolver.getMap ();
// map["id"] = "id";
// myPs = new ProjectStream (myIjs, map);
// myPs.onChange += new DataStream.ChangeDelegate (myProjectChangeHandler);
// return;
// }
// else
// BlueEventLog.logAssert (false, "This call back should not have been called");
// }
// else
// myFireEvent ((o as ICloneable).Clone());
// }
// private void myProjectChangeHandler (object o)
// {
// if (myIjs.myOnChangeDelegate.GetInvocationList().Length > 1)
// myIjs.onChange -= new DataStream.ChangeDelegate (myInternalJoinChangeHandler);
// myFireEvent ((o as ICloneable).Clone());
// }
// protected override void myOnFirstSubscriber ()
// {
// myIjs.onChange += new DataStream.ChangeDelegate (myInternalJoinChangeHandler);
// }
// protected override void myOnLastSubscriber ()
// {
// // how does this relate to the -= in myProjectChangeHandler?
// myIjs.onChange -= new DataStream.ChangeDelegate (myInternalJoinChangeHandler);
// // if there is a project after the ijs we need to
// // unsubscribe to it otherwise references will be kept and
// // a memory leak will occur
// if (myPs != null)
// myPs.onChange -= new DataStream.ChangeDelegate (myProjectChangeHandler);
// myPs = null;
// }
// /**************************************TEST METHOD(S)*********************************************/
// /// <summary>
// /// Used for testing purposes only. This enables the test to work without a DataSource (PubServer,
// /// BaseServer etc), by directly calling the test method and passing data
// /// </summary>
// /// <param name="leftPacket"></param>
// /// <param name="rightPacket"></param>
// public void test (DataPacket dp, bool isLeft) {myIjs.test (dp, isLeft);}
// /***********************************************************************************************/
// }
// }