feat: Resurrect DataStream primitives
They were originally commented out because the expression parsing utils weren't ready (now they are).
This commit is contained in:
1 parent
1dfc028554
commit
9311c27f47
29 files changed
+2737
-2647
No files matched your search
@@ -1,54 +1,54 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
// namespace BCG
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// Same as a join except can join based on
|
||||
// /// multiple columns (this abstracts what we
|
||||
// /// have been doing for ages - concatenating,
|
||||
// /// joining and then projecting the concatanted
|
||||
// /// columns out)
|
||||
// /// </summary>
|
||||
// public class MultiColumnJoinStream : ViewStream
|
||||
// {
|
||||
// public MultiColumnJoinStream(ViewStream leftStream, string leftJoinColumns, string leftProject,
|
||||
// ViewStream rightStream, string rightJoinColumns, string rightProject)
|
||||
// : this(leftStream, leftJoinColumns, leftProject,
|
||||
// rightStream, rightJoinColumns, rightProject, false)
|
||||
// { }
|
||||
namespace BCG
|
||||
{
|
||||
/// <summary>
|
||||
/// Same as a join except can join based on
|
||||
/// multiple columns (this abstracts what we
|
||||
/// have been doing for ages - concatenating,
|
||||
/// joining and then projecting the concatanted
|
||||
/// columns out)
|
||||
/// </summary>
|
||||
public class MultiColumnJoinStream : ViewStream
|
||||
{
|
||||
public MultiColumnJoinStream(ViewStream leftStream, string leftJoinColumns, string leftProject,
|
||||
ViewStream rightStream, string rightJoinColumns, string rightProject)
|
||||
: this(leftStream, leftJoinColumns, leftProject,
|
||||
rightStream, rightJoinColumns, rightProject, false)
|
||||
{ }
|
||||
|
||||
// public MultiColumnJoinStream(ViewStream leftStream, string leftJoinColumns, string leftProject,
|
||||
// ViewStream rightStream, string rightJoinColumns, string rightProject, bool leftJoin)
|
||||
// {
|
||||
// string[] leftJoinColArray = leftJoinColumns.Split(' ', ',', ';'),
|
||||
// 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,
|
||||
// rightStream, rightJoinColArray[0], rightProject) :
|
||||
// new SuperJoinStream(leftStream, leftJoinColArray[0], leftProject,
|
||||
// rightStream, rightJoinColArray[0], rightProject));
|
||||
// else
|
||||
// {
|
||||
// string leftCols = "ljc:";
|
||||
// foreach (string c in leftJoinColArray)
|
||||
// leftCols += c + " ";
|
||||
// leftCols = leftCols.Trim();
|
||||
// string rightCols = "rjc:";
|
||||
// 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");
|
||||
// mySetRealSource(res);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
public MultiColumnJoinStream(ViewStream leftStream, string leftJoinColumns, string leftProject,
|
||||
ViewStream rightStream, string rightJoinColumns, string rightProject, bool leftJoin)
|
||||
{
|
||||
string[] leftJoinColArray = leftJoinColumns.Split(' ', ',', ';'),
|
||||
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,
|
||||
rightStream, rightJoinColArray[0], rightProject) :
|
||||
new SuperJoinStream(leftStream, leftJoinColArray[0], leftProject,
|
||||
rightStream, rightJoinColArray[0], rightProject));
|
||||
else
|
||||
{
|
||||
string leftCols = "ljc:";
|
||||
foreach (string c in leftJoinColArray)
|
||||
leftCols += c + " ";
|
||||
leftCols = leftCols.Trim();
|
||||
string rightCols = "rjc:";
|
||||
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");
|
||||
mySetRealSource(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user