Skip to content

Commit 9542f44

Browse files
committed
Remove excessive MapTransform usage in the CalculateProvider
1 parent a0f01be commit 9542f44

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

Orm/Xtensive.Orm/Orm/Rse/Providers/Compilable/CalculateProvider.cs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
using System;
88
using Xtensive.Core;
99

10-
using Xtensive.Tuples.Transform;
11-
using Xtensive.Collections;
12-
1310
namespace Xtensive.Orm.Rse.Providers
1411
{
1512
/// <summary>
@@ -22,18 +19,12 @@ public class CalculateProvider : UnaryProvider,
2219
/// <summary>
2320
/// Gets a value indicating whether calculated columns should be inlined.
2421
/// </summary>
25-
public bool IsInlined { get; private set; }
22+
public bool IsInlined { get; }
2623

2724
/// <summary>
2825
/// Gets the calculated columns.
2926
/// </summary>
30-
public CalculatedColumn[] CalculatedColumns { get; private set; }
31-
32-
/// <summary>
33-
/// Gets header resize transform.
34-
/// </summary>
35-
public MapTransform ResizeTransform { get; private set; }
36-
27+
public CalculatedColumn[] CalculatedColumns { get; }
3728

3829
/// <inheritdoc/>
3930
protected override RecordSetHeader BuildHeader()
@@ -47,16 +38,6 @@ protected override string ParametersToString()
4738
return CalculatedColumns.ToCommaDelimitedString();
4839
}
4940

50-
/// <inheritdoc/>
51-
protected override void Initialize()
52-
{
53-
base.Initialize();
54-
var columnIndexes = new int[Header.Length];
55-
for (int i = 0; i < columnIndexes.Length; i++)
56-
columnIndexes[i] = (i < Source.Header.Length) ? i : TransformUtil.NoMapping;
57-
ResizeTransform = new MapTransform(false, Header.TupleDescriptor, columnIndexes);
58-
}
59-
6041

6142
// Constructors
6243

@@ -80,10 +61,10 @@ public CalculateProvider(CompilableProvider source, bool isInlined, params Calcu
8061
: base(ProviderType.Calculate, source)
8162
{
8263
IsInlined = isInlined;
64+
var sourceHeaderLength = Source.Header.Length;
8365
var columns = new CalculatedColumn[columnDescriptors.Length];
8466
for (int i = 0; i < columnDescriptors.Length; i++) {
85-
var col = new CalculatedColumn(columnDescriptors[i], Source.Header.Length + i);
86-
columns.SetValue(col, i);
67+
columns[i] = new CalculatedColumn(columnDescriptors[i], sourceHeaderLength + i);
8768
}
8869
CalculatedColumns = columns;
8970
Initialize();

0 commit comments

Comments
 (0)