protected BaseRankingFilter(IColumnIdentifier operand, ColumnType columnType, IEnumerable <IColumnAlias> aliases, IEnumerable <IColumnExpression> expressions) { this.Operand = operand; this.ColumnType = columnType; this.Aliases = aliases; this.Expressions = expressions; }
public SinglePredicateFilter(IEnumerable <IColumnAlias> aliases, IEnumerable <IColumnExpression> expressions, IColumnIdentifier operand, Func <object, bool> implementation, Func <string> describeFunction) : base(aliases, expressions) { this.operand = operand; this.implementation = implementation; this.describeFunction = describeFunction; }
public AbstractRanking(int count, IColumnIdentifier operand, ColumnType columnType, IEnumerable <IColumnAlias> aliases, IEnumerable <IColumnExpression> expressions) : base(operand, columnType, aliases, expressions) { if (count <= 0) { throw new ArgumentOutOfRangeException("The value of count must be strictly positive."); } TableLength = count; }
public void Add(IColumnIdentifier indentifier, ITransformationInfo transfo) { var transformer = factory.Instantiate(transfo); transformer.Initialize(transfo.Code); if (cacheTransformers.ContainsKey(indentifier)) { throw new NBiException($"You can't define two transformers for the same column. The column {indentifier.Label} has already another transformer specified."); } cacheTransformers.Add(indentifier, transformer); }
protected object GetValueFromRow(DataRow row, IColumnIdentifier identifier) { if (identifier is ColumnOrdinalIdentifier) { var ordinal = (identifier as ColumnOrdinalIdentifier).Ordinal; if (ordinal <= row.Table.Columns.Count) { return(row.ItemArray[ordinal]); } else { throw new ArgumentException($"The variable of the predicate is identified as '{identifier.Label}' but the column in position '{ordinal}' doesn't exist. The dataset only contains {row.Table.Columns.Count} columns."); } } var name = (identifier as ColumnNameIdentifier).Name; var alias = aliases.SingleOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); if (alias != null) { return(row.ItemArray[alias.Column]); } var expression = expressions.SingleOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); if (expression != null) { var result = EvaluateExpression(expression, row); var expColumnName = $"exp::{name}"; if (!row.Table.Columns.Contains(expColumnName)) { var newColumn = new DataColumn(expColumnName, typeof(object)); row.Table.Columns.Add(newColumn); } row[expColumnName] = result; return(result); } var column = row.Table.Columns.Cast <DataColumn>().SingleOrDefault(x => string.Equals(x.ColumnName, name, StringComparison.OrdinalIgnoreCase)); if (column != null) { return(row[column.ColumnName]); } var existingNames = row.Table.Columns.Cast <DataColumn>().Select(x => x.ColumnName) .Union(aliases.Select(x => x.Name) .Union(expressions.Select(x => x.Name))); throw new ArgumentException($"The value '{name}' is not recognized as a column position, a column name, a column alias or an expression. Possible arguments are: '{string.Join("', '", existingNames.ToArray())}'"); }
protected object GetValueFromRow(DataRow row, IColumnIdentifier identifier) { if (identifier is ColumnOrdinalIdentifier) { var ordinal = (identifier as ColumnOrdinalIdentifier).Ordinal; if (ordinal <= row.Table.Columns.Count) { return(row.ItemArray[ordinal]); } else { throw new ArgumentException($"The variable of the predicate is identified as '{identifier.Label}' but the column in position '{ordinal}' doesn't exist. The dataset only contains {row.Table.Columns.Count} columns."); } } var name = (identifier as ColumnNameIdentifier).Name; var alias = aliases?.SingleOrDefault(x => x.Name == name); if (alias != null) { return(row.ItemArray[alias.Column]); } var expression = expressions?.SingleOrDefault(x => x.Name == name); if (expression != null) { return(EvaluateExpression(expression, row)); } var column = row.Table.Columns.Cast <DataColumn>().SingleOrDefault(x => x.ColumnName == name); if (column != null) { return(row[column.ColumnName]); } throw new ArgumentException($"The value '{name}' is not recognized as a column name or a column position or a column alias or an expression."); }
public SinglePredication(IPredicate predicate, IColumnIdentifier operand) => (Predicate, Operand) = (predicate, operand);
public NewNameRenamingArgs(IColumnIdentifier originalIdentification, IScalarResolver <string> newIdentification, IMissingColumnStrategy missingColumnStrategy) => (OriginalIdentification, NewIdentification, MissingColumnStrategy) = (originalIdentification, newIdentification, missingColumnStrategy);
public DataRowScorer(IColumnIdentifier operand, IEnumerable <IColumnAlias> aliases, IEnumerable <IColumnExpression> expressions) { this.operand = operand; this.aliases = aliases; this.expressions = expressions; }
public NativeExtendEngine(ServiceLocator serviceLocator, Context context, IColumnIdentifier newColumn, string code) : base(serviceLocator, context, newColumn, code) { }
public ColumnMapping(IColumnIdentifier candidateColumn, IColumnIdentifier referenceColumn, ColumnType type) { CandidateColumn = candidateColumn; ReferenceColumn = referenceColumn; Type = type; }
public UnstackArgs(IColumnIdentifier header, IEnumerable <IColumnDefinitionLight> groupBys, IEnumerable <ColumnNameIdentifier> enforcedColumns) => (Header, GroupBys, EnforcedColumns) = (header, groupBys, enforcedColumns);
public LookupReplaceArgs(IResultSetService resultSet, ColumnMapping mapping, IColumnIdentifier replacement) : this(resultSet, mapping, replacement, new FailureMissingStrategy()) { }
public TopRanking(int count, IColumnIdentifier operand, ColumnType columnType, IEnumerable <IColumnAlias> aliases, IEnumerable <IColumnExpression> expressions) : base(count, operand, columnType, aliases, expressions) { }
public UnstackArgs(IColumnIdentifier header, IEnumerable <IColumnDefinitionLight> groupBys) : this(header, groupBys, new ColumnNameIdentifier[] { }) { }
public TopRanking(int count, IColumnIdentifier operand, ColumnType columnType) : this(count, operand, columnType, null, null) { }
public RankingArgs(RankingOption option, int count, IColumnIdentifier operand, ColumnType type) => (Option, Count, Operand, Type) = (option, count, operand, type);
public ColumnMapping(IColumnIdentifier column, ColumnType type) : this(column, column, type) { }
public static object GetValue(this DataRow row, IColumnIdentifier columnIdentifier) => columnIdentifier.GetValue(row);
public Predication(IPredicate predicate, IColumnIdentifier operand) { this.Predicate = predicate; this.Operand = operand; }
public IPredication Instantiate(IPredicate predicate, IColumnIdentifier operand) => new SinglePredication(predicate, operand);
public static DataColumn GetColumn(this DataTable table, IColumnIdentifier columnIdentifier) => columnIdentifier.GetColumn(table);
public LookupReplaceArgs(IResultSetService resultSet, ColumnMapping mapping, IColumnIdentifier replacement, IMissingStrategy missingStrategy) => (Reference, Mapping, Replacement, MissingStrategy) = (resultSet, mapping, replacement, missingStrategy);
public AbstractExtendEngine(ServiceLocator serviceLocator, Context context, IColumnIdentifier newColumn, string code) => (ServiceLocator, Context, NewColumn, Code) = (serviceLocator, context, newColumn, code);
public RankingGroupByArgs(IGroupBy groupBy, RankingOption option, int count, IColumnIdentifier operand, ColumnType type) : base(option, count, operand, type) => GroupBy = groupBy;
public ColumnAggregationArgs(IColumnIdentifier identifier, AggregationFunctionType function, ColumnType columnType, IList <IScalarResolver> parameters) : base(function, columnType, parameters) => (Identifier) = (identifier);
public AbstractRanking(IColumnIdentifier operand, ColumnType columnType, IEnumerable <IColumnAlias> aliases, IEnumerable <IColumnExpression> expressions) : this(1, operand, columnType, aliases, expressions) { }
public SinglePredicateFilter(IEnumerable <IColumnAlias> aliases, IEnumerable <IColumnExpression> expressions, IColumnIdentifier operand, Func <object, bool> executeFunction) : this(aliases, expressions, operand, executeFunction, () => "unspecified description") { }
public ContextScalarResolverArgs(Context context, IColumnIdentifier columnIdentifier) => (Context, ColumnIdentifier) = (context, columnIdentifier);
public PredicationArgs(IColumnIdentifier identifier, PredicateArgs predicate) => (Identifier, Predicate) = (identifier, predicate);