66 lines
2.3 KiB
C#
66 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using mbts;
|
|
|
|
namespace BCG
|
|
{
|
|
public class NonIncJoinSpec
|
|
{
|
|
public ViewStream stream;
|
|
public string[] join_col_names, data_col_names, projected_col_names;
|
|
|
|
public NonIncJoinSpec() { }
|
|
|
|
public NonIncJoinSpec(ViewStream the_stream, string[] the_join_col_names, string[] the_data_col_names)
|
|
: this (the_stream, the_join_col_names, the_data_col_names, the_data_col_names)
|
|
{ }
|
|
|
|
public NonIncJoinSpec(ViewStream the_stream, string[] the_join_col_names, string[] the_data_col_names, string[] the_projected_col_names)
|
|
{
|
|
stream = the_stream;
|
|
join_col_names = the_join_col_names;
|
|
data_col_names = the_data_col_names;
|
|
projected_col_names = the_projected_col_names;
|
|
}
|
|
|
|
public static NonIncJoinSpec[] from_triplet(params Triplet<ViewStream, string, string>[] join_specs)
|
|
{
|
|
List<NonIncJoinSpec> rv = new List<NonIncJoinSpec>();
|
|
foreach (Triplet<ViewStream, string, string> r in join_specs)
|
|
{
|
|
string[] keys = String.IsNullOrEmpty (r.second) ? new string[] {} : r.second.Split(' ');
|
|
string[] visible_cols = r.third.Split(' ');
|
|
List<string> data_col_names = new List<string>(), mapped_col_names = new List<string>();
|
|
foreach (string s in visible_cols)
|
|
{
|
|
string[] toks = s.Split(':');
|
|
if (toks.Length == 1)
|
|
{
|
|
data_col_names.Add(toks[0]);
|
|
mapped_col_names.Add(toks[0]);
|
|
}
|
|
else if (toks.Length == 2)
|
|
{
|
|
data_col_names.Add(toks[0]);
|
|
mapped_col_names.Add(toks[1]);
|
|
}
|
|
}
|
|
rv.Add (new NonIncJoinSpec (r.first, keys, data_col_names.ToArray (), mapped_col_names.ToArray()));
|
|
}
|
|
return rv.ToArray ();
|
|
}
|
|
}
|
|
|
|
//[DataStreamUserRespresentation("ninctest")]
|
|
//public class NonIncJoinTestStream : ViewStream
|
|
//{
|
|
// public NonIncJoinTestStream (string key_cols, string data_cols)
|
|
// {
|
|
// NonIncJoinSpec.from_triplet(new Triplet<ViewStream, string, string>(null, key_cols, data_cols));
|
|
// }
|
|
//}
|
|
}
|