-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
push emit list through buffer (#626)
* push emit list through buffer * Fix emit output * Add test case
- Loading branch information
Showing
5 changed files
with
219 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
tests/FlowtideDotNet.AcceptanceTests/Internal/EmitLengthValidatorVisitor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
using FlowtideDotNet.Core.Optimizer; | ||
using FlowtideDotNet.Substrait.Relations; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Security.Cryptography.X509Certificates; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FlowtideDotNet.AcceptanceTests.Internal | ||
{ | ||
class EmitLengthValidatorVisitor : OptimizerBaseVisitor | ||
{ | ||
public override Relation VisitAggregateRelation(AggregateRelation aggregateRelation, object state) | ||
{ | ||
if (aggregateRelation.EmitSet && aggregateRelation.Input.EmitSet && | ||
aggregateRelation.Emit.Count > (aggregateRelation.Input.Emit.Count + aggregateRelation.Measures?.Count ?? 0)) | ||
{ | ||
Assert.Fail(); | ||
} | ||
return base.VisitAggregateRelation(aggregateRelation, state); | ||
} | ||
|
||
public override Relation VisitBufferRelation(BufferRelation bufferRelation, object state) | ||
{ | ||
if (bufferRelation.EmitSet && bufferRelation.Input.EmitSet && | ||
bufferRelation.Emit.Count > bufferRelation.Input.Emit.Count) | ||
{ | ||
Assert.Fail(); | ||
} | ||
return base.VisitBufferRelation(bufferRelation, state); | ||
} | ||
|
||
public override Relation VisitFilterRelation(FilterRelation filterRelation, object state) | ||
{ | ||
if (filterRelation.EmitSet && filterRelation.Input.EmitSet && | ||
filterRelation.Emit.Count > filterRelation.Input.Emit.Count) | ||
{ | ||
Assert.Fail(); | ||
} | ||
return base.VisitFilterRelation(filterRelation, state); | ||
} | ||
|
||
public override Relation VisitJoinRelation(JoinRelation joinRelation, object state) | ||
{ | ||
if (joinRelation.OutputLength > joinRelation.Left.OutputLength + joinRelation.Right.OutputLength) | ||
{ | ||
Assert.Fail($"Join output length {joinRelation.OutputLength} bigger than input left: {joinRelation.Left.OutputLength} right {joinRelation.Right.OutputLength}"); | ||
} | ||
return base.VisitJoinRelation(joinRelation, state); | ||
} | ||
|
||
public override Relation VisitMergeJoinRelation(MergeJoinRelation mergeJoinRelation, object state) | ||
{ | ||
if (mergeJoinRelation.OutputLength > mergeJoinRelation.Left.OutputLength + mergeJoinRelation.Right.OutputLength) | ||
{ | ||
Assert.Fail(); | ||
} | ||
return base.VisitMergeJoinRelation(mergeJoinRelation, state); | ||
} | ||
|
||
public override Relation VisitNormalizationRelation(NormalizationRelation normalizationRelation, object state) | ||
{ | ||
if (normalizationRelation.OutputLength > normalizationRelation.Input.OutputLength) | ||
{ | ||
Assert.Fail(); | ||
} | ||
return base.VisitNormalizationRelation(normalizationRelation, state); | ||
} | ||
|
||
public override Relation VisitProjectRelation(ProjectRelation projectRelation, object state) | ||
{ | ||
if (projectRelation.OutputLength > (projectRelation.Input.OutputLength + projectRelation.Expressions.Count)) | ||
{ | ||
if (projectRelation.EmitSet) | ||
{ | ||
if (projectRelation.Emit.Distinct().Count() > (projectRelation.OutputLength + projectRelation.Expressions.Count)) | ||
{ | ||
Assert.Fail(); | ||
} | ||
} | ||
else | ||
{ | ||
Assert.Fail(); | ||
} | ||
} | ||
return base.VisitProjectRelation(projectRelation, state); | ||
} | ||
|
||
public override Relation VisitSetRelation(SetRelation setRelation, object state) | ||
{ | ||
if (setRelation.Inputs.Any(x => setRelation.OutputLength > x.OutputLength)) | ||
{ | ||
Assert.Fail(); | ||
} | ||
return base.VisitSetRelation(setRelation, state); | ||
} | ||
|
||
public override Relation VisitSortRelation(SortRelation sortRelation, object state) | ||
{ | ||
if (sortRelation.OutputLength > sortRelation.Input.OutputLength) | ||
{ | ||
Assert.Fail(); | ||
} | ||
return base.VisitSortRelation(sortRelation, state); | ||
} | ||
|
||
public override Relation VisitTableFunctionRelation(TableFunctionRelation tableFunctionRelation, object state) | ||
{ | ||
if (tableFunctionRelation.OutputLength > tableFunctionRelation.Input?.OutputLength) | ||
{ | ||
Assert.Fail(); | ||
} | ||
return base.VisitTableFunctionRelation(tableFunctionRelation, state); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89b480f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.InnerJoin
561913660
ns (± 8885168.59868799
)588638700
ns (± 9231369.002121696
)0.95
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.LeftJoin
633086910
ns (± 28179291.329566035
)632393477.7777778
ns (± 23156158.76418074
)1.00
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.ProjectionAndNormalization
206965510
ns (± 11974743.987005875
)171268600
ns (± 6644227.006958748
)1.21
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.SumAggregation
220732430
ns (± 15248542.067999667
)190822830
ns (± 6415026.852121856
)1.16
FlowtideDotNet.Benchmarks.Stream.StreamBenchmark.ListAggWithMapAggregation
2355444120
ns (± 117635795.91867246
)2656394200
ns (± 136074715.58524996
)0.89
This comment was automatically generated by workflow using github-action-benchmark.