public void AdjustColumnsDropRow() { var input = WideStruct2.GetTestData() .ToStreamable() .Select(() => new WideStruct1()) .ToAtemporalObservable() .ToEnumerable() .ToList(); Assert.IsTrue(input.SequenceEqual(WideStruct1.GetTestData())); }
public void AdjustColumnsAddViaDictionaryRow() { var input = WideStruct1.GetTestData() .ToStreamable() .Select(() => new WideStruct2(), new Dictionary <string, Expression <Func <WideStruct1, object> > > { { "Key2", o => (o.Key1 == "c" ? "e" : "d") } }) .ToAtemporalObservable() .ToEnumerable() .ToList(); Assert.IsTrue(input.SequenceEqual(WideStruct2.GetTestData())); }
public void AdjustColumnsAddViaFormulaRow() { var input = WideStruct1.GetTestData() .ToStreamable() .Select( () => new WideStruct2(), o => o.Key2, o => o.Key1 == "c" ? "e" : "d") .ToAtemporalObservable() .ToEnumerable() .ToList(); Assert.IsTrue(input.SequenceEqual(WideStruct2.GetTestData())); }
public void Unpivot2AllRow() { var input = WideStruct2.GetTestData() .ToStreamable() .Unpivot( () => new UnpivotStruct2(), e => new { e.Key1, e.Key2 }, e => e.Attribute, e => e.Value) .ToAtemporalObservable() .ToEnumerable() .ToList(); var expected = new List <UnpivotStruct2> { new UnpivotStruct2 { Key1 = "a", Key2 = "d", Attribute = "i5", Value = 5 }, new UnpivotStruct2 { Key1 = "a", Key2 = "d", Attribute = "i9", Value = 9 }, new UnpivotStruct2 { Key1 = "b", Key2 = "d", Attribute = "i1", Value = 11 }, new UnpivotStruct2 { Key1 = "b", Key2 = "d", Attribute = "i14", Value = 100 }, new UnpivotStruct2 { Key1 = "b", Key2 = "d", Attribute = "i2", Value = 9 }, new UnpivotStruct2 { Key1 = "c", Key2 = "e", Attribute = "i15", Value = 0 }, new UnpivotStruct2 { Key1 = "c", Key2 = "e", Attribute = "o", Value = 9 }, }; Assert.IsTrue(input.SequenceEqual(expected)); }
public void Pivot2AllColumnarSmallBatch() { var input = new List <UnpivotStruct2N> { new UnpivotStruct2N { Key1 = "a", Key2 = "d", Attribute = "i5", Value = 5 }, new UnpivotStruct2N { Key1 = "a", Key2 = "d", Attribute = "i9", Value = 9 }, new UnpivotStruct2N { Key1 = "b", Key2 = "d", Attribute = "i1", Value = 11 }, new UnpivotStruct2N { Key1 = "b", Key2 = "d", Attribute = "i14", Value = 100 }, new UnpivotStruct2N { Key1 = "b", Key2 = "d", Attribute = "i2", Value = 9 }, new UnpivotStruct2N { Key1 = "c", Key2 = "e", Attribute = "i15", Value = 0 }, new UnpivotStruct2N { Key1 = "c", Key2 = "e", Attribute = "o", Value = 9 }, }.ToStreamable() .Pivot( () => new WideStruct2(), o => new { o.Key1, o.Key2 }, o => o.Attribute, o => o.Value, o => o.SingleOrDefault()) .ToAtemporalObservable() .ToEnumerable() .ToList(); var expected = WideStruct2.GetTestData(); Assert.IsTrue(input.OrderBy(o => o.Key1).SequenceEqual(expected)); }