They were originally commented out because the expression parsing utils weren't ready (now they are).
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
|
|
using BCG.Utilities;
|
|
|
|
namespace BCG
|
|
{
|
|
public class DistinctRowEvaluator : GroupByEvaluator
|
|
{
|
|
|
|
private int myIdGenerator = 0;
|
|
public DistinctRowEvaluator (string[] columnNames) : base (null, columnNames) {}
|
|
|
|
public DistinctRowEvaluator(string colMapExpression, string[] columnNames)
|
|
: base (colMapExpression, null, columnNames) {}
|
|
|
|
|
|
public override IBlueRow evaluate (DataPacket packet)
|
|
{
|
|
myOutputTable = myOutputTable == null ? new GroupByOutputTable (packet.schema) : myOutputTable;
|
|
string hashString = GroupByStream.getRepString (packet, myGroupByCols);
|
|
if (packet.newRows.Count == 0)
|
|
//if there are no rows for this group we remove the group from the output table
|
|
myOutputTable.removeRow (hashString);
|
|
else if (myOutputTable.getRow (hashString) == null)
|
|
//a row is added for the first time (or first time after the removal of the group)
|
|
myOutputTable.addRow (
|
|
BlueDataUtility.getNewReplacedRow (
|
|
BlueDataUtility.extractRow (packet.newRows, 0),
|
|
myIdGenerator++, "id"),
|
|
hashString);
|
|
|
|
return myProject (myOutputTable.getRow (hashString));
|
|
}
|
|
}
|
|
}
|