Ejemplo n.º 1
0
        public void AddRow(string key, IReadOnlySlimRow row)
        {
            if (string.IsNullOrEmpty(key))
            {
                return;
            }

            Count++;
            if (_dictionary.TryGetValue(key, out var entry))
            {
                if (entry is List <IReadOnlySlimRow> list)
                {
                    list.Add(row);
                }
                else
                {
                    _dictionary[key] = new List <IReadOnlySlimRow>()
                    {
                        entry as IReadOnlySlimRow,
                        row,
                    };
                }
            }
            else
            {
                _dictionary[key] = row;
            }
        }
Ejemplo n.º 2
0
 public ColumnRenameException(IProcess process, IReadOnlySlimRow row, string currentName, string newName)
     : base(process, "specified target column already exists")
 {
     Data.Add("CurrentName", currentName);
     Data.Add("NewName", newName);
     Data.Add("Row", row.ToDebugString(true));
 }
Ejemplo n.º 3
0
 public override void TransformAggregate(IReadOnlySlimRow row, ContinuousAggregate aggregate)
 {
     foreach (var aggregator in Aggregators)
     {
         aggregator.Invoke(aggregate, row);
     }
 }
Ejemplo n.º 4
0
 public SlimRow(IReadOnlySlimRow initialValues)
 {
     _values = initialValues is SlimRow slimRow
         ? new Dictionary <string, object>(slimRow._values, StringComparer.OrdinalIgnoreCase)
         : initialValues is DictionaryRow dictionaryRow
             ? new Dictionary <string, object>(dictionaryRow._values, StringComparer.OrdinalIgnoreCase)
             : new Dictionary <string, object>(initialValues.Values, StringComparer.OrdinalIgnoreCase);
 }
Ejemplo n.º 5
0
        public InvalidValueException(IProcess process, IReadOnlySlimRow row, string column)
            : base(process, "invalid value found")
        {
            var value = row[column];

            Data.Add("Column", column);
            Data.Add("Value", value != null ? value.ToString() + " (" + value.GetType().GetFriendlyTypeName() + ")" : "NULL");
            Data.Add("Row", row.ToDebugString(true));
        }
Ejemplo n.º 6
0
        public void AddRow(string key, IReadOnlySlimRow row)
        {
            if (string.IsNullOrEmpty(key))
                return;

            Count++;
            _dictionary.TryGetValue(key, out var count);
            _dictionary[key] = count + 1;
        }
    public bool Equals(IReadOnlySlimRow leftRow, IReadOnlySlimRow rightRow)
    {
        if (ComparerDelegate == null)
        {
            throw new ArgumentException(nameof(ComparerDelegate) + " can not be null");
        }

        return(ComparerDelegate.Invoke(leftRow, rightRow));
    }
Ejemplo n.º 8
0
        public static ProcessExecutionException Wrap(IProcess process, IReadOnlySlimRow row, Exception ex)
        {
            if (ex is ProcessExecutionException pex && (pex.Data["Row"] is string rowString) && string.Equals(rowString, row.ToDebugString(), StringComparison.Ordinal))
            {
                return(pex);
            }

            return(new ProcessExecutionException(process, row, ex));
        }
        public string CreateRowStatement(NamedConnectionString connectionString, IReadOnlySlimRow row, WriteToTableMutator operation)
        {
            var startIndex = operation.ParameterCount;

            foreach (var column in _tableDefinition.Columns)
            {
                operation.CreateParameter(column, row[column.RowColumn]);
            }

            var statement = "(" + string.Join(", ", _tableDefinition.Columns.Select(_ => "@" + startIndex++.ToString("D", CultureInfo.InvariantCulture))) + ")";

            return(statement);
        }
Ejemplo n.º 10
0
        public IRow CreateRow(IProcess process, IReadOnlySlimRow source)
        {
            var row = (IRow)Activator.CreateInstance(RowType);

            row.Init(this, process, Interlocked.Increment(ref _nextRowUid), source.Values);
            row.Tag = source.Tag;

            foreach (var listener in Listeners)
            {
                listener.OnRowCreated(row, process);
            }

            return(row);
        }
 public static EtlException Wrap(IProcess process, IReadOnlySlimRow row, Exception ex)
 {
     if (ex is KeyGeneratorException eex)
     {
         var str = row.ToDebugString(true);
         if ((eex.Data["Row"] is string rowString) && string.Equals(rowString, str, StringComparison.Ordinal))
         {
             return(eex);
         }
         else
         {
             eex.Data["Row"] = str;
             return(eex);
         }
     }
Ejemplo n.º 12
0
        public bool Equals(IReadOnlySlimRow leftRow, IReadOnlySlimRow rightRow)
        {
            if (leftRow == rightRow)
            {
                return(true);
            }

            if (leftRow == null || rightRow == null)
            {
                return(false);
            }

            if (Columns != null)
            {
                if (ColumnsToIgnore != null)
                {
                    throw new ArgumentException(nameof(ColumnsToIgnore) + " can not be set if " + nameof(Columns) + " is set");
                }

                foreach (var column in Columns)
                {
                    if (!DefaultValueComparer.ValuesAreEqual(leftRow[column], rightRow[column]))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                var columnsToIgnore = ColumnsToIgnore != null
                    ? new HashSet <string>(ColumnsToIgnore)
                    : null;

                foreach (var kvp in leftRow.Values)
                {
                    if (columnsToIgnore?.Contains(kvp.Key) == true)
                    {
                        continue;
                    }

                    if (!DefaultValueComparer.ValuesAreEqual(kvp.Value, rightRow[kvp.Key]))
                    {
                        return(false);
                    }
                }

                foreach (var kvp in rightRow.Values)
                {
                    if (columnsToIgnore?.Contains(kvp.Key) == true)
                    {
                        continue;
                    }

                    if (!DefaultValueComparer.ValuesAreEqual(kvp.Value, leftRow[kvp.Key]))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 13
0
 public RowContainsErrorException(IProcess process, IReadOnlySlimRow row)
     : base(process, "error found in a row")
 {
     Data.Add("Row", row.ToDebugString(true));
 }
Ejemplo n.º 14
0
 public NoMatchException(IProcess process, IReadOnlySlimRow row, string key)
     : base(process, "no match")
 {
     Data.Add("Row", row.ToDebugString(true));
     Data.Add("Key", key);
 }
Ejemplo n.º 15
0
 public void AddRow(IReadOnlySlimRow row)
 {
     _queue?.Enqueue(row);
 }
 public abstract void TransformAggregate(IReadOnlySlimRow row, ContinuousAggregate aggregate);
Ejemplo n.º 17
0
 public ProcessExecutionException(IProcess process, IReadOnlySlimRow row, Exception innerException)
     : this(process, "error raised during the execution of a process", innerException)
 {
     Data.Add("Row", row.ToDebugString());
 }
Ejemplo n.º 18
0
 public JoinMatchCustomActionDelegateException(IProcess process, Exception innerException, string delegateName, IReadOnlySlimRow row, IReadOnlySlimRow match)
     : base(process, "error during the execution of a " + delegateName + " delegate", innerException)
 {
     Data.Add("Row", row.ToDebugString(true));
     Data.Add("Match", match.ToDebugString());
 }
Ejemplo n.º 19
0
 public void Copy(IReadOnlySlimRow sourceRow, List <KeyValuePair <string, object> > targetValues)
 {
     targetValues.Add(new KeyValuePair <string, object>(ToColumn, sourceRow[FromColumn]));
 }
 public DuplicateKeyException(IProcess process, IReadOnlySlimRow row, string key)
     : base(process, "duplicate keys found")
 {
     Data.Add("Key", key);
     Data.Add("Row", row.ToDebugString(true));
 }
Ejemplo n.º 21
0
 public ProcessExecutionException(IProcess process, IReadOnlySlimRow row, string message, Exception innerException)
     : base(process, message, innerException)
 {
     Data.Add("Row", row.ToDebugString());
 }
Ejemplo n.º 22
0
 public MatchException(IProcess process, IReadOnlySlimRow row)
     : base(process, "match")
 {
     Data.Add("Row", row.ToDebugString(true));
 }
Ejemplo n.º 23
0
 public InvalidValuesException(IProcess process, IReadOnlySlimRow row)
     : base(process, "invalid values found")
 {
     Data.Add("Row", row.ToDebugString(true));
 }
 public KeyGeneratorException(IProcess process, IReadOnlySlimRow row, Exception innerException)
     : base(process, "error during generating key for a row", innerException)
 {
     Data.Add("Row", row.ToDebugString(true));
 }
Ejemplo n.º 25
0
 public TooManyMatchActionDelegateException(IProcess process, IReadOnlySlimRow row, Exception innerException)
     : base(process, "error during the execution of a " + nameof(TooManyMatchAction) + "." + nameof(TooManyMatchAction.CustomAction) + " delegate", innerException)
 {
     Data.Add("Row", row.ToDebugString(true));
 }