From df1661bcaee481ddd115267dd7e7eeeb549b2fba Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 6 Nov 2019 14:54:38 -0800 Subject: [PATCH 01/53] Change namespace to Microsoft.Data.Analysis (#2773) * Update namespace to Microsoft.Data.Analysis * Remove "DataFrame" from the test project name --- .../ArrowStringDataFrameColumn.cs | 543 ++ .../ColumnArithmeticTemplate.ttinclude | 283 + .../DataFrame.Arrow.cs | 173 + .../DataFrame.BinaryOperations.cs | 511 ++ .../DataFrame.BinaryOperations.tt | 97 + .../DataFrame.BinaryOperators.cs | 363 ++ .../DataFrame.BinaryOperators.tt | 46 + .../DataFrame.IDataView.cs | 140 + src/Microsoft.Data.Analysis/DataFrame.IO.cs | 283 + src/Microsoft.Data.Analysis/DataFrame.Join.cs | 361 ++ src/Microsoft.Data.Analysis/DataFrame.cs | 565 ++ .../DataFrameBuffer.cs | 97 + .../DataFrameColumn.BinaryOperations.cs | 177 + .../DataFrameColumn.BinaryOperations.tt | 49 + .../DataFrameColumn.BinaryOperators.cs | 343 ++ .../DataFrameColumn.BinaryOperators.tt | 52 + .../DataFrameColumn.Computations.cs | 176 + .../DataFrameColumn.Computations.tt | 44 + .../DataFrameColumn.cs | 472 ++ .../DataFrameColumnCollection.cs | 160 + .../DecimalConverter.cs | 173 + .../DoubleConverter.cs | 165 + src/Microsoft.Data.Analysis/GroupBy.cs | 468 ++ .../Microsoft.Data.Analysis.csproj | 162 + ...imitiveColumnContainer.BinaryOperations.cs | 194 + ...imitiveColumnContainer.BinaryOperations.tt | 47 + .../PrimitiveColumnContainer.cs | 626 ++ ...imitiveDataFrameColumn.BinaryOperations.cs | 2472 ++++++++ ...imitiveDataFrameColumn.BinaryOperations.tt | 338 ++ .../PrimitiveDataFrameColumn.Computations.cs | 129 + .../PrimitiveDataFrameColumn.Computations.tt | 63 + .../PrimitiveDataFrameColumn.Sort.cs | 101 + .../PrimitiveDataFrameColumn.cs | 678 +++ .../PrimitiveDataFrameColumnArithmetic.cs | 5342 ++++++++++++++++ .../PrimitiveDataFrameColumnArithmetic.tt | 91 + .../PrimitiveDataFrameColumnComputations.cs | 5359 +++++++++++++++++ .../PrimitiveDataFrameColumnComputations.tt | 268 + .../ReadOnlyDataFrameBuffer.cs | 88 + .../StringDataFrameColumn.BinaryOperations.cs | 143 + .../StringDataFrameColumn.cs | 471 ++ .../strings.Designer.cs | 225 + src/Microsoft.Data.Analysis/strings.resx | 174 + .../ArrayComparer.cs | 182 + .../ArrowIntegrationTests.cs | 158 + .../BufferTests.cs | 279 + .../DataFrame.IOTests.cs | 62 + .../DataFrameTests.IDataView.cs | 228 + .../DataFrameTests.cs | 1787 ++++++ .../Microsoft.Data.Analysis.Tests.csproj | 18 + 49 files changed, 25426 insertions(+) create mode 100644 src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude create mode 100644 src/Microsoft.Data.Analysis/DataFrame.Arrow.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.tt create mode 100644 src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt create mode 100644 src/Microsoft.Data.Analysis/DataFrame.IDataView.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrame.IO.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrame.Join.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrame.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrameBuffer.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt create mode 100644 src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt create mode 100644 src/Microsoft.Data.Analysis/DataFrameColumn.Computations.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrameColumn.Computations.tt create mode 100644 src/Microsoft.Data.Analysis/DataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs create mode 100644 src/Microsoft.Data.Analysis/DecimalConverter.cs create mode 100644 src/Microsoft.Data.Analysis/DoubleConverter.cs create mode 100644 src/Microsoft.Data.Analysis/GroupBy.cs create mode 100644 src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj create mode 100644 src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.tt create mode 100644 src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.tt create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Sort.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.tt create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnComputations.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnComputations.tt create mode 100644 src/Microsoft.Data.Analysis/ReadOnlyDataFrameBuffer.cs create mode 100644 src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs create mode 100644 src/Microsoft.Data.Analysis/StringDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/strings.Designer.cs create mode 100644 src/Microsoft.Data.Analysis/strings.resx create mode 100644 tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs create mode 100644 tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs create mode 100644 tests/Microsoft.Data.Analysis.Tests/BufferTests.cs create mode 100644 tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs create mode 100644 tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs create mode 100644 tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs create mode 100644 tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj diff --git a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs new file mode 100644 index 0000000000..17a38102a2 --- /dev/null +++ b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs @@ -0,0 +1,543 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Text; +using Apache.Arrow; +using Apache.Arrow.Types; +using Microsoft.ML; +using Microsoft.ML.Data; + +namespace Microsoft.Data.Analysis +{ + /// + /// An immutable column to hold Arrow style strings + /// + public partial class ArrowStringDataFrameColumn : DataFrameColumn, IEnumerable + { + private IList> _dataBuffers; + private IList> _offsetsBuffers; + private IList> _nullBitMapBuffers; + + public ArrowStringDataFrameColumn(string name) : base(name, 0, typeof(string)) + { + _dataBuffers = new List>(); + _offsetsBuffers = new List>(); + _nullBitMapBuffers = new List>(); + } + + public ArrowStringDataFrameColumn(string name, ReadOnlyMemory values, ReadOnlyMemory offsets, ReadOnlyMemory nullBits, int length, int nullCount) : base(name, length, typeof(string)) + { + ReadOnlyDataFrameBuffer dataBuffer = new ReadOnlyDataFrameBuffer(values, values.Length); + ReadOnlyDataFrameBuffer offsetBuffer = new ReadOnlyDataFrameBuffer(offsets, length + 1); + ReadOnlyDataFrameBuffer nullBitMapBuffer = new ReadOnlyDataFrameBuffer(nullBits, nullBits.Length); + + if (length + 1 != offsetBuffer.Length) + throw new ArgumentException(nameof(offsetBuffer)); + + _dataBuffers = new List>(); + _offsetsBuffers = new List>(); + _nullBitMapBuffers = new List>(); + + _dataBuffers.Add(dataBuffer); + _offsetsBuffers.Add(offsetBuffer); + _nullBitMapBuffers.Add(nullBitMapBuffer); + + _nullCount = nullCount; + + } + + private long _nullCount; + public override long NullCount => _nullCount; + + public bool IsValid(long index) => NullCount == 0 || GetValidityBit(index); + + public bool GetValidityBit(long index) + { + if ((ulong)index > (ulong)Length) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + // First find the right bitMapBuffer + int bitMapIndex = GetBufferIndexContainingRowIndex(index, out int indexInBuffer); + Debug.Assert(_nullBitMapBuffers.Count > bitMapIndex); + ReadOnlyDataFrameBuffer bitMapBuffer = _nullBitMapBuffers[bitMapIndex]; + int bitMapBufferIndex = (int)((uint)index / 8); + Debug.Assert(bitMapBuffer.Length > bitMapBufferIndex); + byte curBitMap = bitMapBuffer[bitMapBufferIndex]; + return ((curBitMap >> (indexInBuffer & 7)) & 1) != 0; + } + + private void SetValidityBit(long index, bool value) + { + if ((ulong)index > (ulong)Length) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + // First find the right bitMapBuffer + int bitMapIndex = GetBufferIndexContainingRowIndex(index, out int indexInBuffer); + Debug.Assert(_nullBitMapBuffers.Count > bitMapIndex); + DataFrameBuffer bitMapBuffer = (DataFrameBuffer)_nullBitMapBuffers[bitMapIndex]; + + // Set the bit + int bitMapBufferIndex = (int)((uint)indexInBuffer / 8); + Debug.Assert(bitMapBuffer.Length >= bitMapBufferIndex); + if (bitMapBuffer.Length == bitMapBufferIndex) + bitMapBuffer.Append(0); + byte curBitMap = bitMapBuffer[bitMapBufferIndex]; + byte newBitMap; + if (value) + { + newBitMap = (byte)(curBitMap | (byte)(1 << (indexInBuffer & 7))); //bit hack for index % 8 + if (((curBitMap >> (indexInBuffer & 7)) & 1) == 0 && indexInBuffer < Length - 1 && NullCount > 0) + { + // Old value was null. + _nullCount--; + } + } + else + { + if (((curBitMap >> (indexInBuffer & 7)) & 1) == 1 && indexInBuffer < Length) + { + // old value was NOT null and new value is null + _nullCount++; + } + else if (indexInBuffer == Length - 1) + { + // New entry from an append + _nullCount++; + } + newBitMap = (byte)(curBitMap & (byte)~(1 << (int)((uint)indexInBuffer & 7))); + } + bitMapBuffer[bitMapBufferIndex] = newBitMap; + } + + /// + /// Returns an enumerable of immutable buffers representing the underlying values in the Apache Arrow format + /// + /// Null values are encoded in the buffers returned by GetReadOnlyNullBitmapBuffers in the Apache Arrow format + /// The offsets buffers returned by GetReadOnlyOffsetBuffers can be used to delineate each value + /// IEnumerable> + public IEnumerable> GetReadOnlyDataBuffers() + { + for (int i = 0; i < _dataBuffers.Count; i++) + { + ReadOnlyDataFrameBuffer buffer = _dataBuffers[i]; + yield return buffer.RawReadOnlyMemory; + } + } + + /// + /// Returns an enumerable of immutable ReadOnlyMemory buffers representing null values in the Apache Arrow format + /// + /// Each ReadOnlyMemory encodes the indices of null values in its corresponding Data buffer + /// IEnumerable> + public IEnumerable> GetReadOnlyNullBitMapBuffers() + { + for (int i = 0; i < _nullBitMapBuffers.Count; i++) + { + ReadOnlyDataFrameBuffer buffer = _nullBitMapBuffers[i]; + yield return buffer.RawReadOnlyMemory; + } + } + + /// + /// Returns an enumerable of immutable ReadOnlyMemory representing offsets into its corresponding Data buffer. + /// The Apache Arrow format specifies how the offset buffer encodes the length of each value in the Data buffer + /// + /// IEnumerable> + public IEnumerable> GetReadOnlyOffsetsBuffers() + { + for (int i = 0; i < _offsetsBuffers.Count; i++) + { + ReadOnlyDataFrameBuffer buffer = _offsetsBuffers[i]; + yield return buffer.ReadOnlyMemory; + } + } + + // This is an immutable column, however this method exists to support Clone(). Keep this method private + // Appending a default string is equivalent to appending null. It increases the NullCount and sets a null bitmap bit + // Appending an empty string is valid. It does NOT affect the NullCount. It instead adds a new offset entry + private void Append(ReadOnlySpan value) + { + if (_dataBuffers.Count == 0) + { + _dataBuffers.Add(new DataFrameBuffer()); + _nullBitMapBuffers.Add(new DataFrameBuffer()); + _offsetsBuffers.Add(new DataFrameBuffer()); + } + DataFrameBuffer mutableOffsetsBuffer = (DataFrameBuffer)_offsetsBuffers[_offsetsBuffers.Count - 1]; + if (mutableOffsetsBuffer.Length == 0) + { + mutableOffsetsBuffer.Append(0); + } + Length++; + if (value == default) + { + mutableOffsetsBuffer.Append(mutableOffsetsBuffer[mutableOffsetsBuffer.Length - 1]); + } + else + { + DataFrameBuffer mutableDataBuffer = (DataFrameBuffer)_dataBuffers[_dataBuffers.Count - 1]; + if (mutableDataBuffer.Length == ReadOnlyDataFrameBuffer.MaxCapacity) + { + mutableDataBuffer = new DataFrameBuffer(); + _dataBuffers.Add(mutableDataBuffer); + _nullBitMapBuffers.Add(new DataFrameBuffer()); + mutableOffsetsBuffer = new DataFrameBuffer(); + _offsetsBuffers.Add(mutableOffsetsBuffer); + mutableOffsetsBuffer.Append(0); + } + mutableDataBuffer.EnsureCapacity(value.Length); + value.CopyTo(mutableDataBuffer.RawSpan.Slice(mutableDataBuffer.Length)); + mutableDataBuffer.Length += value.Length; + mutableOffsetsBuffer.Append(mutableOffsetsBuffer[mutableOffsetsBuffer.Length - 1] + value.Length); + } + SetValidityBit(Length - 1, value != default); + + } + + private int GetBufferIndexContainingRowIndex(long rowIndex, out int indexInBuffer) + { + if (rowIndex >= Length) + { + throw new ArgumentOutOfRangeException(Strings.ColumnIndexOutOfRange, nameof(rowIndex)); + } + + // Since the strings here could be of variable length, scan linearly + int curArrayIndex = 0; + int numBuffers = _offsetsBuffers.Count; + while (curArrayIndex < numBuffers && rowIndex > _offsetsBuffers[curArrayIndex].Length - 1) + { + rowIndex -= _offsetsBuffers[curArrayIndex].Length - 1; + curArrayIndex++; + } + indexInBuffer = (int)rowIndex; + return curArrayIndex; + } + + private ReadOnlySpan GetBytes(long index) + { + int offsetsBufferIndex = GetBufferIndexContainingRowIndex(index, out int indexInBuffer); + ReadOnlySpan offsetBufferSpan = _offsetsBuffers[offsetsBufferIndex].ReadOnlySpan; + int currentOffset = offsetBufferSpan[indexInBuffer]; + int nextOffset = offsetBufferSpan[indexInBuffer + 1]; + int numberOfBytes = nextOffset - currentOffset; + return _dataBuffers[offsetsBufferIndex].ReadOnlySpan.Slice(currentOffset, numberOfBytes); + } + + protected override object GetValue(long rowIndex) => GetValueImplementation(rowIndex); + + private string GetValueImplementation(long rowIndex) + { + if (!IsValid(rowIndex)) + { + return null; + } + var bytes = GetBytes(rowIndex); + unsafe + { + fixed (byte* data = &MemoryMarshal.GetReference(bytes)) + return Encoding.UTF8.GetString(data, bytes.Length); + } + } + + protected override IReadOnlyList GetValues(long startIndex, int length) + { + var ret = new List(); + while (ret.Count < length) + { + ret.Add(GetValueImplementation(startIndex++)); + } + return ret; + } + + protected override void SetValue(long rowIndex, object value) => throw new NotSupportedException(Strings.ImmutableColumn); + + public new string this[long rowIndex] + { + get => GetValueImplementation(rowIndex); + set => throw new NotSupportedException(Strings.ImmutableColumn); + } + + public new List this[long startIndex, int length] + { + get + { + var ret = new List(); + while (ret.Count < length) + { + ret.Add(GetValueImplementation(startIndex++)); + } + return ret; + } + } + + public IEnumerator GetEnumerator() + { + for (long i = 0; i < Length; i++) + { + yield return this[i]; + } + } + + protected override IEnumerator GetEnumeratorCore() => GetEnumerator(); + + protected internal override Field GetArrowField() => new Field(Name, StringType.Default, NullCount != 0); + + protected internal override int GetMaxRecordBatchLength(long startIndex) + { + if (Length == 0) + return 0; + int offsetsBufferIndex = GetBufferIndexContainingRowIndex(startIndex, out int indexInBuffer); + Debug.Assert(indexInBuffer <= Int32.MaxValue); + return _offsetsBuffers[offsetsBufferIndex].Length - indexInBuffer; + } + + private int GetNullCount(long startIndex, int numberOfRows) + { + int nullCount = 0; + for (long i = startIndex; i < numberOfRows; i++) + { + if (!IsValid(i)) + nullCount++; + } + return nullCount; + } + + protected internal override Apache.Arrow.Array ToArrowArray(long startIndex, int numberOfRows) + { + if (numberOfRows == 0) + return new StringArray(numberOfRows, ArrowBuffer.Empty, ArrowBuffer.Empty, ArrowBuffer.Empty); + int offsetsBufferIndex = GetBufferIndexContainingRowIndex(startIndex, out int indexInBuffer); + if (numberOfRows != 0 && numberOfRows > _offsetsBuffers[offsetsBufferIndex].Length - 1 - indexInBuffer) + { + throw new ArgumentException(Strings.SpansMultipleBuffers, nameof(numberOfRows)); + } + ArrowBuffer dataBuffer = new ArrowBuffer(_dataBuffers[offsetsBufferIndex].ReadOnlyBuffer); + ArrowBuffer offsetsBuffer = new ArrowBuffer(_offsetsBuffers[offsetsBufferIndex].ReadOnlyBuffer); + ArrowBuffer nullBuffer = new ArrowBuffer(_nullBitMapBuffers[offsetsBufferIndex].ReadOnlyBuffer); + int nullCount = GetNullCount(indexInBuffer, numberOfRows); + return new StringArray(numberOfRows, offsetsBuffer, dataBuffer, nullBuffer, nullCount, indexInBuffer); + } + + public override DataFrameColumn Sort(bool ascending = true) => throw new NotSupportedException(); + + public override DataFrameColumn Clone(DataFrameColumn mapIndices = null, bool invertMapIndices = false, long numberOfNullsToAppend = 0) + { + ArrowStringDataFrameColumn clone; + if (!(mapIndices is null)) + { + Type dataType = mapIndices.DataType; + if (dataType != typeof(long) && dataType != typeof(int) && dataType != typeof(bool)) + throw new ArgumentException(String.Format(Strings.MultipleMismatchedValueType, typeof(long), typeof(int), typeof(bool)), nameof(mapIndices)); + if (mapIndices.DataType == typeof(long)) + clone = Clone(mapIndices as PrimitiveDataFrameColumn, invertMapIndices); + else if (dataType == typeof(int)) + clone = Clone(mapIndices as PrimitiveDataFrameColumn, invertMapIndices); + else + clone = Clone(mapIndices as PrimitiveDataFrameColumn); + } + else + { + clone = Clone(); + } + for (long i = 0; i < numberOfNullsToAppend; i++) + { + clone.Append(default); + } + return clone; + } + + private ArrowStringDataFrameColumn Clone(PrimitiveDataFrameColumn boolColumn) + { + if (boolColumn.Length > Length) + throw new ArgumentException(Strings.MapIndicesExceedsColumnLenth, nameof(boolColumn)); + ArrowStringDataFrameColumn ret = new ArrowStringDataFrameColumn(Name); + for (long i = 0; i < boolColumn.Length; i++) + { + bool? value = boolColumn[i]; + if (value == true) + ret.Append(IsValid(i) ? GetBytes(i) : default(ReadOnlySpan)); + } + return ret; + } + + private ArrowStringDataFrameColumn CloneImplementation(PrimitiveDataFrameColumn mapIndices, bool invertMapIndices = false) + where U : unmanaged + { + ArrowStringDataFrameColumn ret = new ArrowStringDataFrameColumn(Name); + mapIndices.ApplyElementwise((U? mapIndex, long rowIndex) => + { + if (mapIndex == null) + { + ret.Append(default); + return mapIndex; + } + if (invertMapIndices) + { + long index = mapIndices.Length - 1 - rowIndex; + ret.Append(IsValid(index) ? GetBytes(index) : default(ReadOnlySpan)); + } + else + { + ret.Append(IsValid(rowIndex) ? GetBytes(rowIndex) : default(ReadOnlySpan)); + } + return mapIndex; + }); + return ret; + } + + private ArrowStringDataFrameColumn Clone(PrimitiveDataFrameColumn mapIndices = null, bool invertMapIndex = false) + { + if (mapIndices is null) + { + ArrowStringDataFrameColumn ret = new ArrowStringDataFrameColumn(Name); + for (long i = 0; i < Length; i++) + { + ret.Append(IsValid(i) ? GetBytes(i) : default(ReadOnlySpan)); + } + return ret; + } + else + return CloneImplementation(mapIndices, invertMapIndex); + } + + private ArrowStringDataFrameColumn Clone(PrimitiveDataFrameColumn mapIndices, bool invertMapIndex = false) + { + return CloneImplementation(mapIndices, invertMapIndex); + } + + public override DataFrame ValueCounts() + { + Dictionary> groupedValues = GroupColumnValues(); + return StringDataFrameColumn.ValueCountsImplementation(groupedValues); + } + + public override GroupBy GroupBy(int columnIndex, DataFrame parent) + { + Dictionary> dictionary = GroupColumnValues(); + return new GroupBy(parent, columnIndex, dictionary); + } + + public override Dictionary> GroupColumnValues() + { + if (typeof(TKey) == typeof(string)) + { + Dictionary> multimap = new Dictionary>(EqualityComparer.Default); + for (long i = 0; i < Length; i++) + { + string str = this[i] ?? "__null__"; + bool containsKey = multimap.TryGetValue(str, out ICollection values); + if (containsKey) + { + values.Add(i); + } + else + { + multimap.Add(str, new List() { i }); + } + } + return multimap as Dictionary>; + } + else + { + throw new NotSupportedException(nameof(TKey)); + } + } + + public override DataFrameColumn FillNulls(object value, bool inPlace = false) => throw new NotSupportedException(); + + public override DataFrameColumn Clip(U lower, U upper, bool inPlace = false) => throw new NotSupportedException(); + + public override DataFrameColumn Filter(U lower, U upper) => throw new NotSupportedException(); + + protected internal override void AddDataViewColumn(DataViewSchema.Builder builder) + { + builder.AddColumn(Name, TextDataViewType.Instance); + } + + protected internal override Delegate GetDataViewGetter(DataViewRowCursor cursor) + { + return CreateValueGetterDelegate(cursor); + } + + private ValueGetter> CreateValueGetterDelegate(DataViewRowCursor cursor) => + (ref ReadOnlyMemory value) => value = this[cursor.Position].AsMemory(); + + /// + /// Returns a boolean column that is the result of an elementwise equality comparison of each value in the column with + /// + public PrimitiveDataFrameColumn ElementwiseEquals(string value) + { + ReadOnlySpan bytes = value != null ? Encoding.UTF8.GetBytes(value) : default(ReadOnlySpan); + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name, Length); + if (value == null) + { + for (long i = 0; i < Length; i++) + { + ret[i] = !IsValid(i); + } + } + else + { + for (long i = 0; i < Length; i++) + { + var strBytes = GetBytes(i); + ret[i] = strBytes.SequenceEqual(bytes); + } + } + return ret; + } + + public override PrimitiveDataFrameColumn ElementwiseEquals(T value) + { + return ElementwiseEquals(value.ToString()); + } + + public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn column) + { + return StringDataFrameColumn.ElementwiseEqualsImplementation(this, column); + } + + /// + /// Returns a boolean column that is the result of an elementwise not-equal comparison of each value in the column with + /// + public PrimitiveDataFrameColumn ElementwiseNotEquals(string value) + { + ReadOnlySpan bytes = value != null ? Encoding.UTF8.GetBytes(value) : default(ReadOnlySpan); + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name, Length); + if (value == null) + { + for (long i = 0; i < Length; i++) + { + ret[i] = IsValid(i); + } + } + else + { + for (long i = 0; i < Length; i++) + { + var strBytes = GetBytes(i); + ret[i] = !strBytes.SequenceEqual(bytes); + } + } + return ret; + } + + public override PrimitiveDataFrameColumn ElementwiseNotEquals(T value) + { + return ElementwiseNotEquals(value.ToString()); + } + + public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) + { + return StringDataFrameColumn.ElementwiseNotEqualsImplementation(this, column); + } + } +} diff --git a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude new file mode 100644 index 0000000000..5176fb3680 --- /dev/null +++ b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude @@ -0,0 +1,283 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#+ + public class TypeConfiguration + { + public TypeConfiguration(string typeName, string classPrefix = null, string oneLiteral = "1", string zeroLiteral = "0", bool supportsNumeric = true, bool supportsBitwise = true, IEnumerable unsupportedMethods = null) + { + TypeName = typeName; + ClassPrefix = classPrefix ?? char.ToUpper(typeName[0]) + typeName.Substring(1); + OneLiteral = oneLiteral; + ZeroLiteral = zeroLiteral; + SupportsNumeric = supportsNumeric; + SupportsBitwise = supportsBitwise; + UnsupportedMethods = new HashSet(unsupportedMethods ?? Enumerable.Empty()); + } + + public string TypeName { get; } + public string ClassPrefix { get; } + public string OneLiteral { get; } + public string ZeroLiteral { get; } + + public bool SupportsNumeric { get; } + public bool SupportsBitwise { get; } + public ISet UnsupportedMethods { get; } + } + + public string GenerateInPlaceStatement(string trueCondition, string falseCondition) + { + return $"inPlace ? {trueCondition} : {falseCondition}"; + } + + public string GenerateIfStatementHeader(TypeConfiguration type) + { + string keyword = (type == typeConfiguration[0]) ? "if" : "else if"; + return $"{keyword} (typeof(T) == typeof({type.TypeName}))"; + } + + public TypeConfiguration[] typeConfiguration = new [] + { + new TypeConfiguration("bool", oneLiteral:"true", zeroLiteral:"false", supportsNumeric: false, unsupportedMethods: new[] {"LeftShift", "RightShift"}), + new TypeConfiguration("byte", unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("char", oneLiteral:"(char)1", zeroLiteral:"(char)0", unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("decimal", supportsBitwise: false, unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("double", oneLiteral:"1.0", supportsBitwise: false, unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("float", oneLiteral:"1.0f", supportsBitwise: false, unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("int", unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("long", unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("sbyte", classPrefix:"SByte", unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("short", unsupportedMethods: new[] {"All", "Any"}), + new TypeConfiguration("uint", classPrefix:"UInt", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}), + new TypeConfiguration("ulong", classPrefix:"ULong", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}), + new TypeConfiguration("ushort", classPrefix:"UShort", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}) + }; + + public enum MethodType + { + Unary, + UnaryInPlace, + BinaryScalar, + BinaryInt, + Binary, + Comparison, + ComparisonScalar, + Contraction, + ElementwiseComputation, + Reduction + } + + public MethodConfiguration[] computationMethodConfiguration = new [] + { + new MethodConfiguration("Abs", MethodType.ElementwiseComputation, "Math.Abs", isNumeric: true, methodComments: "Updates each numeric element with its absolute numeric value"), + new MethodConfiguration("All", MethodType.Reduction, "", isBitwise: true, methodComments: "Returns whether all the elements are True"), + new MethodConfiguration("Any", MethodType.Reduction, "", isBitwise: true, methodComments: "Returns whether any element is True"), + new MethodConfiguration("CumulativeMax", MethodType.ElementwiseComputation, "", isNumeric:true, methodComments: "Updates each element with its cumulative maximum"), + new MethodConfiguration("CumulativeMax", MethodType.ElementwiseComputation, "", isNumeric:true, supportsRowSubsets: true, methodComments: "Updates column values at rowIndices with its cumulative rowIndices maximum"), + new MethodConfiguration("CumulativeMin", MethodType.ElementwiseComputation, "", isNumeric:true, methodComments: "Updates each element with its cumulative minimum"), + new MethodConfiguration("CumulativeMin", MethodType.ElementwiseComputation, "", isNumeric:true, supportsRowSubsets: true, methodComments: "Updates column values at rowIndices with its cumulative rowIndices minimum"), + new MethodConfiguration("CumulativeProduct", MethodType.ElementwiseComputation, "", isNumeric:true, methodComments: "Updates each element with its cumulative product"), + new MethodConfiguration("CumulativeProduct", MethodType.ElementwiseComputation, "", isNumeric:true, supportsRowSubsets: true, methodComments: "Updates column values at rowIndices with its cumulative rowIndices product"), + new MethodConfiguration("CumulativeSum", MethodType.ElementwiseComputation, "", isNumeric:true, methodComments: "Updates each element with its cumulative sum"), + new MethodConfiguration("CumulativeSum", MethodType.ElementwiseComputation, "", isNumeric:true, supportsRowSubsets: true, methodComments: "Updates column values at rowIndices with its cumulative rowIndices sum"), + new MethodConfiguration("Max", MethodType.Reduction, "", isNumeric:true, hasReturnValue:true, methodComments: "Returns the maximum of the values in the column"), + new MethodConfiguration("Max", MethodType.Reduction, "", isNumeric:true, hasReturnValue:true, supportsRowSubsets: true, methodComments: "Returns the maximum of the values at rowIndices"), + new MethodConfiguration("Min", MethodType.Reduction, "", isNumeric:true, hasReturnValue:true, methodComments: "Returns the minimum of the values in the column"), + new MethodConfiguration("Min", MethodType.Reduction, "", isNumeric:true, hasReturnValue:true, supportsRowSubsets: true, methodComments: "Returns the minimum of the values at the rowIndices"), + new MethodConfiguration("Product", MethodType.Reduction, "*", isNumeric:true, hasReturnValue:true, methodComments: "Returns the product of the values in the column"), + new MethodConfiguration("Product", MethodType.Reduction, "*", isNumeric:true, hasReturnValue:true, supportsRowSubsets: true, methodComments: "Returns the product of the values at the rowIndices"), + new MethodConfiguration("Sum", MethodType.Reduction, "+", isNumeric:true, hasReturnValue:true, methodComments: "Returns the sum of the values in the column"), + new MethodConfiguration("Sum", MethodType.Reduction, "+", isNumeric:true, hasReturnValue:true, supportsRowSubsets: true, methodComments: "Returns the sum of the values at the rowIndices"), + new MethodConfiguration("Round", MethodType.ElementwiseComputation, "Math.Round", isNumeric:true, methodComments: "Calls Math.Round on each value in a column"), + }; + + public MethodConfiguration[] methodConfiguration = new [] + { + new MethodConfiguration("Add", MethodType.Binary, "+", isNumeric:true), + new MethodConfiguration("Add", MethodType.BinaryScalar, "+", isNumeric:true), + new MethodConfiguration("Subtract", MethodType.Binary, "-", isNumeric:true), + new MethodConfiguration("Subtract", MethodType.BinaryScalar, "-", isNumeric:true), + new MethodConfiguration("Multiply", MethodType.Binary, "*", isNumeric:true), // element-wise product, not matrix product + new MethodConfiguration("Multiply", MethodType.BinaryScalar, "*", isNumeric:true), + new MethodConfiguration("Divide", MethodType.Binary, "/", isNumeric:true), + new MethodConfiguration("Divide", MethodType.BinaryScalar, "/", isNumeric:true), + new MethodConfiguration("Modulo", MethodType.Binary, "%", isNumeric:true), + new MethodConfiguration("Modulo", MethodType.BinaryScalar, "%", isNumeric:true), + new MethodConfiguration("And", MethodType.Binary, "&", isBitwise: true), + new MethodConfiguration("And", MethodType.BinaryScalar, "&", isBitwise: true), + new MethodConfiguration("Or", MethodType.Binary, "|", isBitwise: true), + new MethodConfiguration("Or", MethodType.BinaryScalar, "|", isBitwise: true), + new MethodConfiguration("Xor", MethodType.Binary, "^", isBitwise: true), + new MethodConfiguration("Xor", MethodType.BinaryScalar, "^", isBitwise: true), + new MethodConfiguration("LeftShift", MethodType.BinaryInt, "<<", isBitwise: true), + new MethodConfiguration("RightShift", MethodType.BinaryInt, ">>", isBitwise: true), + + new MethodConfiguration("ElementwiseEquals", MethodType.Comparison, "=="), + new MethodConfiguration("ElementwiseEquals", MethodType.ComparisonScalar, "=="), + new MethodConfiguration("ElementwiseNotEquals", MethodType.Comparison, "!="), + new MethodConfiguration("ElementwiseNotEquals", MethodType.ComparisonScalar, "!="), + new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.Comparison, ">=", isNumeric:true), + new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.ComparisonScalar, ">=", isNumeric:true), + new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.Comparison, "<=", isNumeric:true), + new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.ComparisonScalar, "<=", isNumeric:true), + new MethodConfiguration("ElementwiseGreaterThan", MethodType.Comparison, ">", isNumeric:true), + new MethodConfiguration("ElementwiseGreaterThan", MethodType.ComparisonScalar, ">", isNumeric:true), + new MethodConfiguration("ElementwiseLessThan", MethodType.Comparison, "<", isNumeric:true), + new MethodConfiguration("ElementwiseLessThan", MethodType.ComparisonScalar, "<", isNumeric:true), + }; + + public class MethodConfiguration + { + public MethodConfiguration(string methodName, MethodType methodType, string op = null, bool isNumeric = false, bool isBitwise = false, bool hasReturnValue = false, bool supportsRowSubsets = false, string methodComments = null) + { + MethodName = methodName; + MethodType = methodType; + Operator = op; + IsNumeric = isNumeric; + IsBitwise = isBitwise; + HasReturnValue = hasReturnValue; + SupportsRowSubsets = supportsRowSubsets; + MethodComments = methodComments; + } + + public string ResultName => "result"; + + public string Op1Name + { + get + { + switch (MethodType) + { + case MethodType.Unary: + case MethodType.UnaryInPlace: + case MethodType.BinaryScalar: + case MethodType.BinaryInt: + case MethodType.ComparisonScalar: + case MethodType.ElementwiseComputation: + case MethodType.Reduction: + return "column"; + case MethodType.Binary: + case MethodType.Comparison: + case MethodType.Contraction: + return "left"; + default: + throw new ArgumentException(); + }; + } + } + + public string Op2Name + { + get + { + switch (MethodType) + { + case MethodType.BinaryScalar: + case MethodType.ComparisonScalar: + return "scalar"; + case MethodType.BinaryInt: + return "value"; + case MethodType.Binary: + case MethodType.Comparison: + case MethodType.Contraction: + return "right"; + case MethodType.Unary: + case MethodType.UnaryInPlace: + default: + throw new ArgumentException(); + }; + } + } + + public string MethodName { get; } + public MethodType MethodType { get; } + public string Operator { get; } + public string MethodComments { get; } + + public string GetMethodSignature(string columnType, string genericType) + { + var arguments = GetMethodArguments(columnType, genericType); + return $"void {MethodName}({arguments})"; + } + + public string GetSingleArgumentMethodSignature(string columnType, string genericType) + { + var arguments = GetSingleParameterMethodArguments(columnType, genericType); + return $"PrimitiveColumnContainer {MethodName}({arguments})"; + } + + public string GetComputationOrReductionMethodSignature(string columnType, string genericType) + { + var arguments = GetMethodArguments(columnType, genericType); + switch (MethodType) + { + case MethodType.ElementwiseComputation: + return $"{columnType}<{genericType}> {MethodName}({arguments})"; + case MethodType.Reduction: + return $"{genericType} {MethodName}({arguments})"; + default: + throw new ArgumentException(); + } + } + + public string GetMethodArguments(string dataFrameType, string genericType) + { + switch (MethodType) + { + case MethodType.Unary: + case MethodType.UnaryInPlace: + return $"{dataFrameType}<{genericType}> {Op1Name}"; + case MethodType.BinaryScalar: + return $"{dataFrameType}<{genericType}> {Op1Name}, {genericType} {Op2Name}"; + case MethodType.ComparisonScalar: + return $"{dataFrameType}<{genericType}> {Op1Name}, {genericType} {Op2Name}, {dataFrameType} ret"; + case MethodType.BinaryInt: + return $"{dataFrameType}<{genericType}> {Op1Name}, int {Op2Name}"; + case MethodType.Binary: + return $"{dataFrameType}<{genericType}> {Op1Name}, {dataFrameType}<{genericType}> {Op2Name}"; + case MethodType.Comparison: + return $"{dataFrameType}<{genericType}> {Op1Name}, {dataFrameType}<{genericType}> {Op2Name}, {dataFrameType} ret"; + case MethodType.Contraction: + return $"{dataFrameType}<{genericType}> {Op1Name}, {dataFrameType}<{genericType}> {Op2Name}, int[] leftAxes, int[] rightAxes"; + case MethodType.ElementwiseComputation: + case MethodType.Reduction: + return $""; + default: + throw new ArgumentException(); + } + } + + public string GetSingleParameterMethodArguments(string dataFrameType, string genericType) + { + switch (MethodType) + { + case MethodType.Unary: + case MethodType.UnaryInPlace: + throw new ArgumentException(); + return $"{dataFrameType}<{genericType}> {Op1Name}"; + case MethodType.BinaryScalar: + return $"{genericType} {Op2Name}"; + case MethodType.ComparisonScalar: + return $"{genericType} {Op2Name}, {dataFrameType} ret"; + case MethodType.BinaryInt: + return $"int {Op2Name}"; + case MethodType.Binary: + return $"{dataFrameType}<{genericType}> {Op2Name}"; + case MethodType.Comparison: + return $"{dataFrameType}<{genericType}> {Op2Name}, {dataFrameType} ret"; + case MethodType.Contraction: + throw new ArgumentException(); + return $"{dataFrameType}<{genericType}> {Op1Name}, {dataFrameType}<{genericType}> {Op2Name}, int[] leftAxes, int[] rightAxes"; + default: + throw new ArgumentException(); + } + } + + public bool IsNumeric { get; } + public bool IsBitwise { get; } + public bool HasReturnValue { get; } + public bool SupportsRowSubsets { get; } + } +#> diff --git a/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs b/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs new file mode 100644 index 0000000000..dda54b6cea --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs @@ -0,0 +1,173 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using System.Threading.Tasks; +using Apache.Arrow; +using Apache.Arrow.Types; + +namespace Microsoft.Data.Analysis +{ + public partial class DataFrame + { + /// + /// Wraps a around an Arrow without copying data + /// + /// + /// + public static DataFrame FromArrowRecordBatch(RecordBatch recordBatch) + { + DataFrame ret = new DataFrame(); + Apache.Arrow.Schema arrowSchema = recordBatch.Schema; + int fieldIndex = 0; + IEnumerable arrowArrays = recordBatch.Arrays; + foreach (IArrowArray arrowArray in arrowArrays) + { + Field field = arrowSchema.GetFieldByIndex(fieldIndex); + IArrowType fieldType = field.DataType; + DataFrameColumn dataFrameColumn = null; + switch (fieldType.TypeId) + { + case ArrowTypeId.Boolean: + BooleanArray arrowBooleanArray = (BooleanArray)arrowArray; + ReadOnlyMemory valueBuffer = arrowBooleanArray.ValueBuffer.Memory; + ReadOnlyMemory nullBitMapBuffer = arrowBooleanArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, valueBuffer, nullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Double: + PrimitiveArray arrowDoubleArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory doubleValueBuffer = arrowDoubleArray.ValueBuffer.Memory; + ReadOnlyMemory doubleNullBitMapBuffer = arrowDoubleArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, doubleValueBuffer, doubleNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Float: + PrimitiveArray arrowFloatArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory floatValueBuffer = arrowFloatArray.ValueBuffer.Memory; + ReadOnlyMemory floatNullBitMapBuffer = arrowFloatArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, floatValueBuffer, floatNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Int8: + PrimitiveArray arrowsbyteArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory sbyteValueBuffer = arrowsbyteArray.ValueBuffer.Memory; + ReadOnlyMemory sbyteNullBitMapBuffer = arrowsbyteArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, sbyteValueBuffer, sbyteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Int16: + PrimitiveArray arrowshortArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory shortValueBuffer = arrowshortArray.ValueBuffer.Memory; + ReadOnlyMemory shortNullBitMapBuffer = arrowshortArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, shortValueBuffer, shortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Int32: + PrimitiveArray arrowIntArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory intValueBuffer = arrowIntArray.ValueBuffer.Memory; + ReadOnlyMemory intNullBitMapBuffer = arrowIntArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, intValueBuffer, intNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Int64: + PrimitiveArray arrowLongArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory longValueBuffer = arrowLongArray.ValueBuffer.Memory; + ReadOnlyMemory longNullBitMapBuffer = arrowLongArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, longValueBuffer, longNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.String: + StringArray stringArray = (StringArray)arrowArray; + ReadOnlyMemory dataMemory = stringArray.ValueBuffer.Memory; + ReadOnlyMemory offsetsMemory = stringArray.ValueOffsetsBuffer.Memory; + ReadOnlyMemory nullMemory = stringArray.NullBitmapBuffer.Memory; + dataFrameColumn = new ArrowStringDataFrameColumn(field.Name, dataMemory, offsetsMemory, nullMemory, stringArray.Length, stringArray.NullCount); + break; + case ArrowTypeId.UInt8: + PrimitiveArray arrowbyteArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory byteValueBuffer = arrowbyteArray.ValueBuffer.Memory; + ReadOnlyMemory byteNullBitMapBuffer = arrowbyteArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, byteValueBuffer, byteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.UInt16: + PrimitiveArray arrowUshortArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory ushortValueBuffer = arrowUshortArray.ValueBuffer.Memory; + ReadOnlyMemory ushortNullBitMapBuffer = arrowUshortArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, ushortValueBuffer, ushortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.UInt32: + PrimitiveArray arrowUintArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory uintValueBuffer = arrowUintArray.ValueBuffer.Memory; + ReadOnlyMemory uintNullBitMapBuffer = arrowUintArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, uintValueBuffer, uintNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.UInt64: + PrimitiveArray arrowUlongArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory ulongValueBuffer = arrowUlongArray.ValueBuffer.Memory; + ReadOnlyMemory ulongNullBitMapBuffer = arrowUlongArray.NullBitmapBuffer.Memory; + dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, ulongValueBuffer, ulongNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Decimal: + case ArrowTypeId.Binary: + case ArrowTypeId.Date32: + case ArrowTypeId.Date64: + case ArrowTypeId.Dictionary: + case ArrowTypeId.FixedSizedBinary: + case ArrowTypeId.HalfFloat: + case ArrowTypeId.Interval: + case ArrowTypeId.List: + case ArrowTypeId.Map: + case ArrowTypeId.Null: + case ArrowTypeId.Struct: + case ArrowTypeId.Time32: + case ArrowTypeId.Time64: + default: + throw new NotImplementedException(nameof(fieldType.Name)); + } + ret.Columns.Insert(ret.Columns.Count, dataFrameColumn); + fieldIndex++; + } + return ret; + } + + /// + /// Returns an without copying data + /// + public IEnumerable ToArrowRecordBatches() + { + Apache.Arrow.Schema.Builder schemaBuilder = new Apache.Arrow.Schema.Builder(); + + int columnCount = Columns.Count; + for (int i = 0; i < columnCount; i++) + { + DataFrameColumn column = Columns[i]; + Field field = column.GetArrowField(); + schemaBuilder.Field(field); + } + + Schema schema = schemaBuilder.Build(); + List arrays = new List(); + + int recordBatchLength = Int32.MaxValue; + int numberOfRowsInThisRecordBatch = (int)Math.Min(recordBatchLength, RowCount); + long numberOfRowsProcessed = 0; + + // Sometimes .NET for Spark passes in DataFrames with no rows. In those cases, we just return a RecordBatch with the right Schema and no rows + do + { + for (int i = 0; i < columnCount; i++) + { + DataFrameColumn column = Columns[i]; + numberOfRowsInThisRecordBatch = (int)Math.Min(numberOfRowsInThisRecordBatch, column.GetMaxRecordBatchLength(numberOfRowsProcessed)); + } + for (int i = 0; i < columnCount; i++) + { + DataFrameColumn column = Columns[i]; + arrays.Add(column.ToArrowArray(numberOfRowsProcessed, numberOfRowsInThisRecordBatch)); + } + numberOfRowsProcessed += numberOfRowsInThisRecordBatch; + yield return new RecordBatch(schema, arrays, numberOfRowsInThisRecordBatch); + } while (numberOfRowsProcessed < RowCount); + } + + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs new file mode 100644 index 0000000000..0a0119dc2b --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs @@ -0,0 +1,511 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameBinaryOperations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class DataFrame + { + #region Binary Operations + + public DataFrame Add(IReadOnlyList values, bool inPlace = false) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Add(values[i], inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Add(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Add(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Subtract(IReadOnlyList values, bool inPlace = false) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Subtract(values[i], inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Subtract(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Subtract(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Multiply(IReadOnlyList values, bool inPlace = false) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Multiply(values[i], inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Multiply(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Multiply(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Divide(IReadOnlyList values, bool inPlace = false) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Divide(values[i], inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Divide(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Divide(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Modulo(IReadOnlyList values, bool inPlace = false) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Modulo(values[i], inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Modulo(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Modulo(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame And(IReadOnlyList values, bool inPlace = false) + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.And(values[i], inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame And(bool value, bool inPlace = false) + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.And(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Or(IReadOnlyList values, bool inPlace = false) + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Or(values[i], inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Or(bool value, bool inPlace = false) + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Or(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Xor(IReadOnlyList values, bool inPlace = false) + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Xor(values[i], inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame Xor(bool value, bool inPlace = false) + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Xor(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame LeftShift(int value, bool inPlace = false) + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.LeftShift(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame RightShift(int value, bool inPlace = false) + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.RightShift(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseEquals(IReadOnlyList values) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseEquals(values[i]); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseEquals(T value) + where T : unmanaged + { + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseEquals(value); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseNotEquals(IReadOnlyList values) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseNotEquals(values[i]); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseNotEquals(T value) + where T : unmanaged + { + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseNotEquals(value); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseGreaterThanOrEqual(IReadOnlyList values) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseGreaterThanOrEqual(values[i]); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseGreaterThanOrEqual(T value) + where T : unmanaged + { + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseGreaterThanOrEqual(value); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseLessThanOrEqual(IReadOnlyList values) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseLessThanOrEqual(values[i]); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseLessThanOrEqual(T value) + where T : unmanaged + { + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseLessThanOrEqual(value); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseGreaterThan(IReadOnlyList values) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseGreaterThan(values[i]); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseGreaterThan(T value) + where T : unmanaged + { + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseGreaterThan(value); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseLessThan(IReadOnlyList values) + where T : unmanaged + { + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseLessThan(values[i]); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + public DataFrame ElementwiseLessThan(T value) + where T : unmanaged + { + DataFrame retDataFrame = new DataFrame(); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ElementwiseLessThan(value); + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + #endregion + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.tt b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.tt new file mode 100644 index 0000000000..40f0e008b1 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.tt @@ -0,0 +1,97 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameBinaryOperations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class DataFrame + { + #region Binary Operations + +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.BinaryScalar) { #> +<# if (method.IsBitwise == true) { #> + public DataFrame <#=method.MethodName#>(bool value, bool inPlace = false) +<# } else { #> + public DataFrame <#=method.MethodName#>(T value, bool inPlace = false) + where T : unmanaged +<# } #> +<# } #> +<# if (method.MethodType == MethodType.ComparisonScalar) { #> + public DataFrame <#=method.MethodName#>(T value) + where T : unmanaged +<# } #> +<# if (method.MethodType == MethodType.Binary) {#> +<# if (method.IsBitwise == true) { #> + public DataFrame <#=method.MethodName#>(IReadOnlyList values, bool inPlace = false) +<# } else { #> + public DataFrame <#=method.MethodName#>(IReadOnlyList values, bool inPlace = false) + where T : unmanaged +<# } #> +<# } #> +<# if (method.MethodType == MethodType.Comparison) {#> + public DataFrame <#=method.MethodName#>(IReadOnlyList values) + where T : unmanaged +<# } #> +<# if (method.MethodType == MethodType.BinaryInt ) {#> + public DataFrame <#=method.MethodName#>(int value, bool inPlace = false) +<# } #> + { +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.BinaryInt) {#> +<# } else { #> + if (values.Count != Columns.Count) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + } +<# } #> +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.Binary || method.MethodType == MethodType.BinaryInt) {#> + DataFrame retDataFrame = inPlace ? this : new DataFrame(); +<# } else { #> + DataFrame retDataFrame = new DataFrame(); +<# } #> + +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.Binary || method.MethodType == MethodType.BinaryInt) {#> + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; +<# } else { #> + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; +<# } #> +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.BinaryInt) {#> + DataFrameColumn newColumn = baseColumn.<#=method.MethodName#>(value, inPlace); +<# } else if (method.MethodType == MethodType.Binary) { #> + DataFrameColumn newColumn = baseColumn.<#=method.MethodName#>(values[i], inPlace); +<# } else if (method.MethodType == MethodType.ComparisonScalar) { #> + DataFrameColumn newColumn = baseColumn.<#=method.MethodName#>(value); +<# } else { #> + DataFrameColumn newColumn = baseColumn.<#=method.MethodName#>(values[i]); +<# } #> +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.Binary || method.MethodType == MethodType.BinaryInt) {#> + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); +<# } else { #> + retDataFrame.Columns.Insert(i, newColumn); +<# } #> + } + return retDataFrame; + } +<# } #> + #endregion + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs new file mode 100644 index 0000000000..aa6a810c98 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs @@ -0,0 +1,363 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameBinaryOperators.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class DataFrame + { + public static DataFrame operator +(DataFrame df, bool value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, byte value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, char value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, decimal value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, double value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, float value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, int value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, long value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, sbyte value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, short value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, uint value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, ulong value) + { + return df.Add(value); + } + + public static DataFrame operator +(DataFrame df, ushort value) + { + return df.Add(value); + } + + public static DataFrame operator -(DataFrame df, bool value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, byte value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, char value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, decimal value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, double value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, float value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, int value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, long value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, sbyte value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, short value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, uint value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, ulong value) + { + return df.Subtract(value); + } + + public static DataFrame operator -(DataFrame df, ushort value) + { + return df.Subtract(value); + } + + public static DataFrame operator *(DataFrame df, bool value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, byte value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, char value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, decimal value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, double value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, float value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, int value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, long value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, sbyte value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, short value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, uint value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, ulong value) + { + return df.Multiply(value); + } + + public static DataFrame operator *(DataFrame df, ushort value) + { + return df.Multiply(value); + } + + public static DataFrame operator /(DataFrame df, bool value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, byte value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, char value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, decimal value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, double value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, float value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, int value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, long value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, sbyte value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, short value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, uint value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, ulong value) + { + return df.Divide(value); + } + + public static DataFrame operator /(DataFrame df, ushort value) + { + return df.Divide(value); + } + + public static DataFrame operator %(DataFrame df, bool value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, byte value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, char value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, decimal value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, double value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, float value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, int value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, long value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, sbyte value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, short value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, uint value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, ulong value) + { + return df.Modulo(value); + } + + public static DataFrame operator %(DataFrame df, ushort value) + { + return df.Modulo(value); + } + + public static DataFrame operator &(DataFrame df, bool value) + { + return df.And(value); + } + public static DataFrame operator |(DataFrame df, bool value) + { + return df.Or(value); + } + public static DataFrame operator ^(DataFrame df, bool value) + { + return df.Xor(value); + } + public static DataFrame operator <<(DataFrame df, int value) + { + return df.LeftShift(value); + } + + public static DataFrame operator >>(DataFrame df, int value) + { + return df.RightShift(value); + } + + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt new file mode 100644 index 0000000000..169b90f328 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt @@ -0,0 +1,46 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameBinaryOperators.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class DataFrame + { +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.BinaryScalar) { #> +<# if (method.IsBitwise == true) { #> + public static DataFrame operator <#=method.Operator#>(DataFrame df, bool value) + { + return df.<#=method.MethodName#>(value); + } +<# } else { #> +<# foreach (TypeConfiguration type in typeConfiguration) { #> + public static DataFrame operator <#=method.Operator#>(DataFrame df, <#=type.TypeName#> value) + { + return df.<#=method.MethodName#>(value); + } + +<# } #> +<# } #> +<# } else if (method.MethodType == MethodType.BinaryInt) {#> + public static DataFrame operator <#=method.Operator#>(DataFrame df, int value) + { + return df.<#=method.MethodName#>(value); + } + +<# } #> +<# } #> + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrame.IDataView.cs b/src/Microsoft.Data.Analysis/DataFrame.IDataView.cs new file mode 100644 index 0000000000..e7ee8fc572 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.IDataView.cs @@ -0,0 +1,140 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.ML; +using Microsoft.ML.Data; + +namespace Microsoft.Data.Analysis +{ + public partial class DataFrame : IDataView + { + // TODO: support shuffling + bool IDataView.CanShuffle => false; + + private DataViewSchema _schema; + private DataViewSchema DataViewSchema + { + get + { + if (_schema != null) + { + return _schema; + } + + var schemaBuilder = new DataViewSchema.Builder(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = Columns[i]; + baseColumn.AddDataViewColumn(schemaBuilder); + } + _schema = schemaBuilder.ToSchema(); + return _schema; + } + } + + DataViewSchema IDataView.Schema => DataViewSchema; + + long? IDataView.GetRowCount() => RowCount; + + private DataViewRowCursor GetRowCursorCore(IEnumerable columnsNeeded) + { + var activeColumns = new bool[DataViewSchema.Count]; + foreach (DataViewSchema.Column column in columnsNeeded) + { + if (column.Index < activeColumns.Length) + { + activeColumns[column.Index] = true; + } + } + + return new RowCursor(this, activeColumns); + } + DataViewRowCursor IDataView.GetRowCursor(IEnumerable columnsNeeded, Random rand) + { + return GetRowCursorCore(columnsNeeded); + } + + DataViewRowCursor[] IDataView.GetRowCursorSet(IEnumerable columnsNeeded, int n, Random rand) + { + // TODO: change to support parallel cursors + return new DataViewRowCursor[] { GetRowCursorCore(columnsNeeded) }; + } + + private sealed class RowCursor : DataViewRowCursor + { + private bool _disposed; + private long _position; + private readonly DataFrame _dataFrame; + private readonly Delegate[] _getters; + + public RowCursor(DataFrame dataFrame, bool[] activeColumns) + { + Debug.Assert(dataFrame != null); + Debug.Assert(activeColumns != null); + + _position = -1; + _dataFrame = dataFrame; + _getters = new Delegate[Schema.Count]; + for (int i = 0; i < _getters.Length; i++) + { + if (!activeColumns[i]) + continue; + _getters[i] = CreateGetterDelegate(i); + Debug.Assert(_getters[i] != null); + } + } + + public override long Position => _position; + public override long Batch => 0; + public override DataViewSchema Schema => _dataFrame.DataViewSchema; + + protected override void Dispose(bool disposing) + { + if (_disposed) + return; + if (disposing) + { + _position = -1; + } + _disposed = true; + base.Dispose(disposing); + } + + private Delegate CreateGetterDelegate(int col) + { + DataFrameColumn column = _dataFrame.Columns[col]; + return column.GetDataViewGetter(this); + } + + public override ValueGetter GetGetter(DataViewSchema.Column column) + { + if (!IsColumnActive(column)) + throw new ArgumentOutOfRangeException(nameof(column)); + + return (ValueGetter)_getters[column.Index]; + } + + public override ValueGetter GetIdGetter() + { + return (ref DataViewRowId value) => value = new DataViewRowId((ulong)_position, 0); + } + + public override bool IsColumnActive(DataViewSchema.Column column) + { + return _getters[column.Index] != null; + } + + public override bool MoveNext() + { + if (_disposed) + return false; + _position++; + return _position < _dataFrame.RowCount; + } + } + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs new file mode 100644 index 0000000000..b228e2a92c --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -0,0 +1,283 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + + public partial class DataFrame + { + private static Type GuessKind(int col, List read) + { + Type res = typeof(string); + int nbline = 0; + foreach (var line in read) + { + if (col >= line.Length) + throw new FormatException(string.Format(Strings.LessColumnsThatExpected, nbline + 1)); + + string val = line[col]; + bool boolParse = bool.TryParse(val, out bool boolResult); + if (boolParse) + { + res = DetermineType(nbline == 0, typeof(bool), res); + ++nbline; + continue; + } + else + { + if (string.IsNullOrEmpty(val)) + { + res = DetermineType(nbline == 0, typeof(bool), res); + continue; + } + } + bool floatParse = float.TryParse(val, out float floatResult); + if (floatParse) + { + res = DetermineType(nbline == 0, typeof(float), res); + ++nbline; + continue; + } + else + { + if (string.IsNullOrEmpty(val)) + { + res = DetermineType(nbline == 0, typeof(float), res); + continue; + } + } + res = DetermineType(nbline == 0, typeof(string), res); + ++nbline; + } + return res; + } + + private static Type DetermineType(bool first, Type suggested, Type previous) + { + if (first) + return suggested; + else + return MaxKind(suggested, previous); + } + + private static Type MaxKind(Type a, Type b) + { + if (a == typeof(string) || b == typeof(string)) + return typeof(string); + if (a == typeof(float) || b == typeof(float)) + return typeof(float); + if (a == typeof(bool) || b == typeof(bool)) + return typeof(bool); + return typeof(string); + } + + /// + /// Reads a text file as a DataFrame. + /// Follows pandas API. + /// + /// filename + /// column separator + /// has a header or not + /// column names (can be empty) + /// column types (can be empty) + /// number of rows to read + /// number of rows used to guess types + /// add one column with the row index + /// DataFrame + public static DataFrame LoadCsv(string filename, + char separator = ',', bool header = true, + string[] columnNames = null, Type[] dataTypes = null, + int numRows = -1, int guessRows = 10, + bool addIndexColumn = false) + { + using (Stream fileStream = new FileStream(filename, FileMode.Open)) + { + return LoadCsv(fileStream, + separator: separator, header: header, columnNames: columnNames, dataTypes: dataTypes, numberOfRowsToRead: numRows, + guessRows: guessRows, addIndexColumn: addIndexColumn); + } + } + + /// + /// Reads a seekable stream of CSV data into a DataFrame. + /// Follows pandas API. + /// + /// stream of CSV data to be read in + /// column separator + /// has a header or not + /// column names (can be empty) + /// column types (can be empty) + /// number of rows to read not including the header(if present) + /// number of rows used to guess types + /// add one column with the row index + /// DataFrame + public static DataFrame LoadCsv(Stream csvStream, + char separator = ',', bool header = true, + string[] columnNames = null, Type[] dataTypes = null, + long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false) + { + if (!csvStream.CanSeek) + throw new ArgumentException(Strings.NonSeekableStream, nameof(csvStream)); + + var linesForGuessType = new List(); + long rowline = 0; + int numberOfColumns = 0; + + if (header == true && numberOfRowsToRead != -1) + numberOfRowsToRead++; + + List columns; + long streamStart = csvStream.Position; + // First pass: schema and number of rows. + using (var streamReader = new StreamReader(csvStream, encoding: null, detectEncodingFromByteOrderMarks: true, bufferSize: -1, leaveOpen: true)) + { + string line = streamReader.ReadLine(); + while (line != null) + { + if ((numberOfRowsToRead == -1) || rowline < numberOfRowsToRead) + { + if (linesForGuessType.Count < guessRows) + { + var spl = line.Split(separator); + if (header && rowline == 0) + { + if (columnNames == null) + columnNames = spl; + } + else + { + linesForGuessType.Add(spl); + numberOfColumns = Math.Max(numberOfColumns, spl.Length); + } + } + } + ++rowline; + if (rowline == numberOfRowsToRead) + break; + line = streamReader.ReadLine(); + } + + if (linesForGuessType.Count == 0) + throw new FormatException(Strings.EmptyFile); + + columns = new List(numberOfColumns); + + // Guesses types and adds columns. + for (int i = 0; i < numberOfColumns; ++i) + { + Type kind = GuessKind(i, linesForGuessType); + if (kind == typeof(bool)) + { + DataFrameColumn boolColumn = new PrimitiveDataFrameColumn(columnNames == null ? "Column" + i.ToString() : columnNames[i], header == true ? rowline - 1 : rowline); + columns.Add(boolColumn); + } + else if (kind == typeof(float)) + { + DataFrameColumn floatColumn = new PrimitiveDataFrameColumn(columnNames == null ? "Column" + i.ToString() : columnNames[i], header == true ? rowline - 1 : rowline); + columns.Add(floatColumn); + } + else if (kind == typeof(string)) + { + DataFrameColumn stringColumn = new StringDataFrameColumn(columnNames == null ? "Column" + i.ToString() : columnNames[i], header == true ? rowline - 1 : rowline); + columns.Add(stringColumn); + } + else + throw new NotSupportedException(nameof(kind)); + } + + line = null; + streamReader.DiscardBufferedData(); + streamReader.BaseStream.Seek(streamStart, SeekOrigin.Begin); + + // Fills values. + line = streamReader.ReadLine(); + rowline = 0; + while (line != null && (numberOfRowsToRead == -1 || rowline < numberOfRowsToRead)) + { + var spl = line.Split(separator); + if (header && rowline == 0) + { + // Skips. + } + else + { + AppendRow(columns, header == true ? rowline - 1 : rowline, spl); + } + ++rowline; + line = streamReader.ReadLine(); + } + + if (addIndexColumn) + { + PrimitiveDataFrameColumn indexColumn = new PrimitiveDataFrameColumn("IndexColumn", columns[0].Length); + for (int i = 0; i < columns[0].Length; i++) + { + indexColumn[i] = i; + } + columns.Insert(0, indexColumn); + } + } + return new DataFrame(columns); + } + + private static void AppendRow(List columns, long rowIndex, string[] values) + { + for (int i = 0; i < columns.Count; i++) + { + DataFrameColumn column = columns[i]; + string val = values[i]; + Type dType = column.DataType; + if (dType == typeof(bool)) + { + bool boolParse = bool.TryParse(val, out bool boolResult); + if (boolParse) + { + column[rowIndex] = boolResult; + continue; + } + else + { + if (string.IsNullOrEmpty(val)) + { + column[rowIndex] = null; + continue; + } + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(bool)), nameof(val)); + } + } + else if (dType == typeof(float)) + { + bool floatParse = float.TryParse(val, out float floatResult); + if (floatParse) + { + column[rowIndex] = floatResult; + continue; + } + else + { + if (string.IsNullOrEmpty(val)) + { + column[rowIndex] = null; + continue; + } + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(float)), nameof(val)); + } + } + else if (dType == typeof(string)) + { + column[rowIndex] = values[i]; + } + else + { + throw new NotImplementedException(); + } + } + } + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrame.Join.cs b/src/Microsoft.Data.Analysis/DataFrame.Join.cs new file mode 100644 index 0000000000..609eac102c --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.Join.cs @@ -0,0 +1,361 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public enum JoinAlgorithm + { + Left, + Right, + FullOuter, + Inner + } + + /// + /// A DataFrame to support indexing, binary operations, sorting, selection and other APIs. This will eventually also expose an IDataView for ML.NET + /// + public partial class DataFrame + { + + private void SetSuffixForDuplicatedColumnNames(DataFrame dataFrame, DataFrameColumn column, string leftSuffix, string rightSuffix) + { + int index = dataFrame._columnCollection.IndexOf(column.Name); + while (index != -1) + { + // Pre-existing column. Change name + DataFrameColumn existingColumn = dataFrame.Columns[index]; + dataFrame._columnCollection.SetColumnName(existingColumn, existingColumn.Name + leftSuffix); + column.SetName(column.Name + rightSuffix); + index = dataFrame._columnCollection.IndexOf(column.Name); + } + } + + public DataFrame Join(DataFrame other, string leftSuffix = "_left", string rightSuffix = "_right", JoinAlgorithm joinAlgorithm = JoinAlgorithm.Left) + { + DataFrame ret = new DataFrame(); + if (joinAlgorithm == JoinAlgorithm.Left) + { + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn newColumn = Columns[i].Clone(); + ret.Columns.Insert(ret.Columns.Count, newColumn); + } + long minLength = Math.Min(RowCount, other.RowCount); + PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("mapIndices", minLength); + for (long i = 0; i < minLength; i++) + { + mapIndices[i] = i; + } + for (int i = 0; i < other.Columns.Count; i++) + { + DataFrameColumn newColumn; + if (other.RowCount < RowCount) + { + newColumn = other.Columns[i].Clone(numberOfNullsToAppend: RowCount - other.RowCount); + } + else + { + newColumn = other.Columns[i].Clone(mapIndices); + } + SetSuffixForDuplicatedColumnNames(ret, newColumn, leftSuffix, rightSuffix); + ret.Columns.Insert(ret.Columns.Count, newColumn); + } + } + else if (joinAlgorithm == JoinAlgorithm.Right) + { + long minLength = Math.Min(RowCount, other.RowCount); + PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("mapIndices", minLength); + for (long i = 0; i < minLength; i++) + { + mapIndices[i] = i; + } + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn newColumn; + if (RowCount < other.RowCount) + { + newColumn = Columns[i].Clone(numberOfNullsToAppend: other.RowCount - RowCount); + } + else + { + newColumn = Columns[i].Clone(mapIndices); + } + ret.Columns.Insert(ret.Columns.Count, newColumn); + } + for (int i = 0; i < other.Columns.Count; i++) + { + DataFrameColumn newColumn = other.Columns[i].Clone(); + SetSuffixForDuplicatedColumnNames(ret, newColumn, leftSuffix, rightSuffix); + ret.Columns.Insert(ret.Columns.Count, newColumn); + } + } + else if (joinAlgorithm == JoinAlgorithm.FullOuter) + { + long newRowCount = Math.Max(RowCount, other.RowCount); + long numberOfNulls = newRowCount - RowCount; + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn newColumn = Columns[i].Clone(numberOfNullsToAppend: numberOfNulls); + ret.Columns.Insert(ret.Columns.Count, newColumn); + } + numberOfNulls = newRowCount - other.RowCount; + for (int i = 0; i < other.Columns.Count; i++) + { + DataFrameColumn newColumn = other.Columns[i].Clone(numberOfNullsToAppend: numberOfNulls); + SetSuffixForDuplicatedColumnNames(ret, newColumn, leftSuffix, rightSuffix); + ret.Columns.Insert(ret.Columns.Count, newColumn); + } + } + else if (joinAlgorithm == JoinAlgorithm.Inner) + { + long newRowCount = Math.Min(RowCount, other.RowCount); + PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("mapIndices", newRowCount); + for (long i = 0; i < newRowCount; i++) + { + mapIndices[i] = i; + } + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn newColumn = Columns[i].Clone(mapIndices); + ret.Columns.Insert(ret.Columns.Count, newColumn); + } + for (int i = 0; i < other.Columns.Count; i++) + { + DataFrameColumn newColumn = other.Columns[i].Clone(mapIndices); + SetSuffixForDuplicatedColumnNames(ret, newColumn, leftSuffix, rightSuffix); + ret.Columns.Insert(ret.Columns.Count, newColumn); + } + } + return ret; + } + + // TODO: Merge API with an "On" parameter that merges on a column common to 2 dataframes + + /// + /// Merge DataFrames with a database style join + /// + /// + /// + /// + /// + /// + /// + /// + public DataFrame Merge(DataFrame other, string leftJoinColumn, string rightJoinColumn, string leftSuffix = "_left", string rightSuffix = "_right", JoinAlgorithm joinAlgorithm = JoinAlgorithm.Left) + { + // A simple hash join + DataFrame ret = new DataFrame(); + DataFrame leftDataFrame = this; + DataFrame rightDataFrame = other; + + // The final table size is not known until runtime + long rowNumber = 0; + PrimitiveDataFrameColumn leftRowIndices = new PrimitiveDataFrameColumn("LeftIndices"); + PrimitiveDataFrameColumn rightRowIndices = new PrimitiveDataFrameColumn("RightIndices"); + if (joinAlgorithm == JoinAlgorithm.Left) + { + // First hash other dataframe on the rightJoinColumn + DataFrameColumn otherColumn = other[rightJoinColumn]; + Dictionary> multimap = otherColumn.GroupColumnValues(); + + // Go over the records in this dataframe and match with the dictionary + DataFrameColumn thisColumn = this[leftJoinColumn]; + + for (long i = 0; i < thisColumn.Length; i++) + { + var thisColumnValue = thisColumn[i]; + TKey thisColumnValueOrDefault = (TKey)(thisColumnValue == null ? default(TKey) : thisColumnValue); + if (multimap.TryGetValue(thisColumnValueOrDefault, out ICollection rowNumbers)) + { + foreach (long row in rowNumbers) + { + if (thisColumnValue == null) + { + // Match only with nulls in otherColumn + if (otherColumn[row] == null) + { + leftRowIndices.Append(i); + rightRowIndices.Append(row); + } + } + else + { + // Cannot match nulls in otherColumn + if (otherColumn[row] != null) + { + leftRowIndices.Append(i); + rightRowIndices.Append(row); + } + } + } + } + else + { + leftRowIndices.Append(i); + rightRowIndices.Append(null); + } + } + } + else if (joinAlgorithm == JoinAlgorithm.Right) + { + DataFrameColumn thisColumn = this[leftJoinColumn]; + Dictionary> multimap = thisColumn.GroupColumnValues(); + + DataFrameColumn otherColumn = other[rightJoinColumn]; + for (long i = 0; i < otherColumn.Length; i++) + { + var otherColumnValue = otherColumn[i]; + TKey otherColumnValueOrDefault = (TKey)(otherColumnValue == null ? default(TKey) : otherColumnValue); + if (multimap.TryGetValue(otherColumnValueOrDefault, out ICollection rowNumbers)) + { + foreach (long row in rowNumbers) + { + if (otherColumnValue == null) + { + if (thisColumn[row] == null) + { + leftRowIndices.Append(row); + rightRowIndices.Append(i); + } + } + else + { + if (thisColumn[row] != null) + { + leftRowIndices.Append(row); + rightRowIndices.Append(i); + } + } + } + } + else + { + leftRowIndices.Append(null); + rightRowIndices.Append(i); + } + } + } + else if (joinAlgorithm == JoinAlgorithm.Inner) + { + // Hash the column with the smaller RowCount + long leftRowCount = RowCount; + long rightRowCount = other.RowCount; + DataFrame longerDataFrame = leftRowCount <= rightRowCount ? other : this; + DataFrame shorterDataFrame = ReferenceEquals(longerDataFrame, this) ? other : this; + DataFrameColumn hashColumn = (leftRowCount <= rightRowCount) ? this[leftJoinColumn] : other[rightJoinColumn]; + DataFrameColumn otherColumn = ReferenceEquals(hashColumn, this[leftJoinColumn]) ? other[rightJoinColumn] : this[leftJoinColumn]; + Dictionary> multimap = hashColumn.GroupColumnValues(); + + for (long i = 0; i < otherColumn.Length; i++) + { + var otherColumnValue = otherColumn[i]; + TKey otherColumnValueOrDefault = (TKey)(otherColumnValue == null ? default(TKey) : otherColumnValue); + if (multimap.TryGetValue(otherColumnValueOrDefault, out ICollection rowNumbers)) + { + foreach (long row in rowNumbers) + { + if (otherColumnValue == null) + { + if (hashColumn[row] == null) + { + leftRowIndices.Append(row); + rightRowIndices.Append(i); + } + } + else + { + if (hashColumn[row] != null) + { + leftRowIndices.Append(row); + rightRowIndices.Append(i); + } + } + } + } + } + leftDataFrame = shorterDataFrame; + rightDataFrame = longerDataFrame; + } + else if (joinAlgorithm == JoinAlgorithm.FullOuter) + { + DataFrameColumn otherColumn = other[rightJoinColumn]; + Dictionary> multimap = otherColumn.GroupColumnValues(); + Dictionary intersection = new Dictionary(EqualityComparer.Default); + + // Go over the records in this dataframe and match with the dictionary + DataFrameColumn thisColumn = this[leftJoinColumn]; + + for (long i = 0; i < thisColumn.Length; i++) + { + var thisColumnValue = thisColumn[i]; + TKey thisColumnValueOrDefault = (TKey)(thisColumnValue == null ? default(TKey) : thisColumnValue); + if (multimap.TryGetValue(thisColumnValueOrDefault, out ICollection rowNumbers)) + { + foreach (long row in rowNumbers) + { + if (thisColumnValue == null) + { + // Has to match only with nulls in otherColumn + if (otherColumn[row] == null) + { + leftRowIndices.Append(i); + rightRowIndices.Append(row); + if (!intersection.ContainsKey(thisColumnValueOrDefault)) + { + intersection.Add(thisColumnValueOrDefault, rowNumber); + } + } + } + else + { + // Cannot match to nulls in otherColumn + if (otherColumn[row] != null) + { + leftRowIndices.Append(i); + rightRowIndices.Append(row); + if (!intersection.ContainsKey(thisColumnValueOrDefault)) + { + intersection.Add(thisColumnValueOrDefault, rowNumber); + } + } + } + } + } + else + { + leftRowIndices.Append(i); + rightRowIndices.Append(null); + } + } + for (long i = 0; i < otherColumn.Length; i++) + { + TKey value = (TKey)(otherColumn[i] ?? default(TKey)); + if (!intersection.ContainsKey(value)) + { + leftRowIndices.Append(null); + rightRowIndices.Append(i); + } + } + } + else + throw new NotImplementedException(nameof(joinAlgorithm)); + + for (int i = 0; i < leftDataFrame.Columns.Count; i++) + { + ret.Columns.Insert(i, leftDataFrame.Columns[i].Clone(leftRowIndices)); + } + for (int i = 0; i < rightDataFrame.Columns.Count; i++) + { + DataFrameColumn column = rightDataFrame.Columns[i].Clone(rightRowIndices); + SetSuffixForDuplicatedColumnNames(ret, column, leftSuffix, rightSuffix); + ret.Columns.Insert(ret.Columns.Count, column); + } + return ret; + } + + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs new file mode 100644 index 0000000000..6751b4edaa --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -0,0 +1,565 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + + /// + /// Options for DropNull(). + /// + public enum DropNullOptions + { + /// + /// "Any" drops a row if any of the row values are null. + /// + Any, + /// + /// "All" drops a row when all of the row values are null. + /// + All + } + + /// + /// A DataFrame to support indexing, binary operations, sorting, selection and other APIs. This will eventually also expose an IDataView for ML.NET + /// + public partial class DataFrame + { + private readonly DataFrameColumnCollection _columnCollection; + public DataFrame() + { + _columnCollection = new DataFrameColumnCollection(OnColumnsChanged); + } + + public DataFrame(IList columns) + { + _columnCollection = new DataFrameColumnCollection(columns, OnColumnsChanged); + } + + public long RowCount => _columnCollection.RowCount; + + public DataFrameColumnCollection Columns => _columnCollection; + + internal IReadOnlyList GetColumnNames() => _columnCollection.GetColumnNames(); + + #region Operators + public object this[long rowIndex, int columnIndex] + { + get => _columnCollection[columnIndex][rowIndex]; + set => _columnCollection[columnIndex][rowIndex] = value; + } + + public IList this[long rowIndex] + { + get + { + return _columnCollection.GetRow(rowIndex); + } + //TODO?: set? + } + + /// + /// Returns a new DataFrame using the boolean values in + /// + /// A column of booleans + public DataFrame Filter(PrimitiveDataFrameColumn filter) => Clone(filter); + + /// + /// Returns a new DataFrame using the row indices in + /// + /// A column of row indices + public DataFrame Filter(PrimitiveDataFrameColumn rowIndices) => Clone(rowIndices); + + /// + /// Returns a new DataFrame using the row indices in + /// + /// A column of row indices + public DataFrame Filter(PrimitiveDataFrameColumn rowIndices) => Clone(rowIndices); + + /// + /// Returns a new DataFrame using the boolean values in filter + /// + /// A column of booleans + public DataFrame this[PrimitiveDataFrameColumn filter] => Filter(filter); + + /// + /// Returns a new DataFrame using the row indices in + /// + /// A column of row indices + public DataFrame this[PrimitiveDataFrameColumn rowIndices] => Filter(rowIndices); + + /// + /// Returns a new DataFrame using the row indices in + /// + /// A column of row indices + public DataFrame this[PrimitiveDataFrameColumn rowIndices] => Filter(rowIndices); + + /// + /// Returns a new DataFrame using the row indices in + /// + public DataFrame this[IEnumerable rowIndices] + { + get + { + PrimitiveDataFrameColumn filterColumn = new PrimitiveDataFrameColumn("Filter", rowIndices); + return Clone(filterColumn); + } + } + + /// + /// Returns a new DataFrame using the row indices in + /// + public DataFrame this[IEnumerable rowIndices] + { + get + { + PrimitiveDataFrameColumn filterColumn = new PrimitiveDataFrameColumn("Filter", rowIndices); + return Clone(filterColumn); + } + } + + /// + /// Returns a new DataFrame using the boolean values in + /// + public DataFrame this[IEnumerable boolFilter] + { + get + { + PrimitiveDataFrameColumn filterColumn = new PrimitiveDataFrameColumn("Filter", boolFilter); + return Clone(filterColumn); + } + } + + public DataFrameColumn this[string columnName] + { + get + { + int columnIndex = _columnCollection.IndexOf(columnName); + if (columnIndex == -1) + throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName)); + return _columnCollection[columnIndex]; + } + set + { + int columnIndex = _columnCollection.IndexOf(columnName); + DataFrameColumn newColumn = value; + newColumn.SetName(columnName); + if (columnIndex == -1) + { + _columnCollection.Insert(Columns.Count, newColumn); + } + else + { + _columnCollection[columnIndex] = newColumn; + } + } + } + + /// + /// Returns the first rows + /// + /// + public DataFrame Head(int numberOfRows) + { + return Clone(new PrimitiveDataFrameColumn("Filter", Enumerable.Range(0, numberOfRows))); + } + + /// + /// Returns the last rows + /// + /// + public DataFrame Tail(int numberOfRows) + { + PrimitiveDataFrameColumn filter = new PrimitiveDataFrameColumn("Filter", numberOfRows); + for (long i = RowCount - numberOfRows; i < RowCount; i++) + { + filter[i - (RowCount - numberOfRows)] = i; + } + return Clone(filter); + } + // TODO: Add strongly typed versions of these APIs + #endregion + + /// + /// Returns a full copy + /// + public DataFrame Clone() + { + return Clone(mapIndices: null, invertMapIndices: false); + } + + private DataFrame Clone(DataFrameColumn mapIndices = null, bool invertMapIndices = false) + { + List newColumns = new List(Columns.Count); + for (int i = 0; i < Columns.Count; i++) + { + newColumns.Add(Columns[i].Clone(mapIndices, invertMapIndices)); + } + return new DataFrame(newColumns); + } + + /// + /// Generates descriptive statistics that summarize each numeric column + /// + public DataFrame Description() + { + DataFrame ret = new DataFrame(); + if (Columns.Count == 0) + return ret; + int i = 0; + while (!Columns[i].HasDescription()) + { + i++; + } + ret = Columns[i].Description(); + i++; + for (; i < Columns.Count; i++) + { + DataFrameColumn column = Columns[i]; + if (!column.HasDescription()) + { + continue; + } + DataFrame columnDescription = column.Description(); + ret = ret.Merge(columnDescription, "Description", "Description", "_left", "_right", JoinAlgorithm.Inner); + int leftMergeColumn = ret._columnCollection.IndexOf("Description" + "_left"); + int rightMergeColumn = ret._columnCollection.IndexOf("Description" + "_right"); + if (leftMergeColumn != -1 && rightMergeColumn != -1) + { + ret.Columns.Remove("Description" + "_right"); + ret._columnCollection.SetColumnName(ret["Description_left"], "Description"); + } + } + return ret; + } + + + public DataFrame Sort(string columnName, bool ascending = true) + { + DataFrameColumn column = this[columnName]; + DataFrameColumn sortIndices = column.GetAscendingSortIndices(); + List newColumns = new List(Columns.Count); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn oldColumn = Columns[i]; + DataFrameColumn newColumn = oldColumn.Clone(sortIndices, !ascending, oldColumn.NullCount); + Debug.Assert(newColumn.NullCount == oldColumn.NullCount); + newColumns.Add(newColumn); + } + return new DataFrame(newColumns); + } + + /// + /// Clips values beyond the specified thresholds on numeric columns + /// + /// + /// Minimum value. All values below this threshold will be set to it + /// Maximum value. All values above this threshold will be set to it + public DataFrame Clip(U lower, U upper, bool inPlace = false) + { + DataFrame ret = inPlace ? this : Clone(); + + for (int i = 0; i < ret.Columns.Count; i++) + { + DataFrameColumn column = ret.Columns[i]; + if (column.IsNumericColumn()) + column.Clip(lower, upper, inPlace: true); + } + return ret; + } + + /// + /// Adds a prefix to the column names + /// + public DataFrame AddPrefix(string prefix, bool inPlace = false) + { + DataFrame df = inPlace ? this : Clone(); + for (int i = 0; i < df.Columns.Count; i++) + { + DataFrameColumn column = df.Columns[i]; + df._columnCollection.SetColumnName(column, prefix + column.Name); + df.OnColumnsChanged(); + } + return df; + } + + /// + /// Adds a suffix to the column names + /// + public DataFrame AddSuffix(string suffix, bool inPlace = false) + { + DataFrame df = inPlace ? this : Clone(); + for (int i = 0; i < df.Columns.Count; i++) + { + DataFrameColumn column = df.Columns[i]; + df._columnCollection.SetColumnName(column, column.Name + suffix); + df.OnColumnsChanged(); + } + return df; + } + + /// + /// Returns a random sample of rows + /// + /// Number of rows in the returned DataFrame + public DataFrame Sample(int numberOfRows) + { + Random rand = new Random(); + PrimitiveDataFrameColumn indices = new PrimitiveDataFrameColumn("Indices", numberOfRows); + int randMaxValue = (int)Math.Min(Int32.MaxValue, RowCount); + for (long i = 0; i < numberOfRows; i++) + { + indices[i] = rand.Next(randMaxValue); + } + + return Clone(indices); + } + + public GroupBy GroupBy(string columnName) + { + int columnIndex = _columnCollection.IndexOf(columnName); + if (columnIndex == -1) + throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName)); + + DataFrameColumn column = _columnCollection[columnIndex]; + return column.GroupBy(columnIndex, this); + } + + // In GroupBy and ReadCsv calls, columns get resized. We need to set the RowCount to reflect the true Length of the DataFrame. This does internal validation + internal void SetTableRowCount(long rowCount) + { + // Even if current RowCount == rowCount, do the validation + for (int i = 0; i < Columns.Count; i++) + { + if (Columns[i].Length != rowCount) + throw new ArgumentException(String.Format("{0} {1}", Strings.MismatchedRowCount, Columns[i].Name)); + } + _columnCollection.RowCount = rowCount; + } + + /// + /// Returns a DataFrame with no missing values + /// + /// + public DataFrame DropNulls(DropNullOptions options = DropNullOptions.Any) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn filter = new PrimitiveDataFrameColumn("Filter"); + if (options == DropNullOptions.Any) + { + filter.AppendMany(true, RowCount); + + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn column = Columns[i]; + filter.ApplyElementwise((bool? value, long index) => + { + return value.Value && (column[index] == null ? false : true); + }); + } + } + else + { + filter.AppendMany(false, RowCount); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn column = Columns[i]; + filter.ApplyElementwise((bool? value, long index) => + { + return value.Value || (column[index] == null ? false : true); + }); + } + } + return this[filter]; + } + + public DataFrame FillNulls(object value, bool inPlace = false) + { + DataFrame ret = inPlace ? this : Clone(); + for (int i = 0; i < ret.Columns.Count; i++) + { + ret.Columns[i].FillNulls(value, inPlace: true); + } + return ret; + } + + public DataFrame FillNulls(IList values, bool inPlace = false) + { + if (values.Count != Columns.Count) + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(values)); + + DataFrame ret = inPlace ? this : Clone(); + for (int i = 0; i < ret.Columns.Count; i++) + { + Columns[i].FillNulls(values[i], inPlace: true); + } + return ret; + } + + private void ResizeByOneAndAppend(DataFrameColumn column, object value) + { + long length = column.Length; + column.Resize(length + 1); + column[length] = value; + } + + /// + /// Appends a row inplace to the DataFrame + /// + /// If a column's value doesn't match its column's data type, a conversion will be attempted + /// If is null, a null value is appended to each column + /// + public void Append(IEnumerable row = null) + { + IEnumerator columnEnumerator = Columns.GetEnumerator(); + bool columnMoveNext = columnEnumerator.MoveNext(); + if (row != null) + { + // Go through row first to make sure there are no data type incompatibilities + IEnumerator rowEnumerator = row.GetEnumerator(); + bool rowMoveNext = rowEnumerator.MoveNext(); + List cachedObjectConversions = new List(); + while (columnMoveNext && rowMoveNext) + { + DataFrameColumn column = columnEnumerator.Current; + object value = rowEnumerator.Current; + if (value != null) + { + value = Convert.ChangeType(value, column.DataType); + if (value is null) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, column.DataType), value.GetType().ToString()); + } + } + cachedObjectConversions.Add(value); + columnMoveNext = columnEnumerator.MoveNext(); + rowMoveNext = rowEnumerator.MoveNext(); + } + if (rowMoveNext) + { + throw new ArgumentException(string.Format(Strings.ExceedsNumberOfColumns, Columns.Count), nameof(row)); + } + columnEnumerator.Reset(); + columnMoveNext = columnEnumerator.MoveNext(); + rowEnumerator.Reset(); + rowMoveNext = rowEnumerator.MoveNext(); + int cacheIndex = 0; + while (columnMoveNext && rowMoveNext) + { + DataFrameColumn column = columnEnumerator.Current; + object value = cachedObjectConversions[cacheIndex]; + ResizeByOneAndAppend(column, value); + columnMoveNext = columnEnumerator.MoveNext(); + rowMoveNext = rowEnumerator.MoveNext(); + cacheIndex++; + } + } + while (columnMoveNext) + { + // Fill the remaining columns with null + DataFrameColumn column = columnEnumerator.Current; + ResizeByOneAndAppend(column, null); + columnMoveNext = columnEnumerator.MoveNext(); + } + Columns.RowCount++; + } + + /// + /// Appends a row inplace by enumerating column names and values from + /// + /// If a column's value doesn't match its column's data type, a conversion will be attempted + /// + public void Append(IEnumerable> row) + { + if (row == null) + { + throw new ArgumentNullException(nameof(row)); + } + + List cachedObjectConversions = new List(); + foreach (KeyValuePair columnAndValue in row) + { + string columnName = columnAndValue.Key; + int index = Columns.IndexOf(columnName); + if (index == -1) + { + throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName)); + } + + DataFrameColumn column = Columns[index]; + object value = columnAndValue.Value; + if (value != null) + { + value = Convert.ChangeType(value, column.DataType); + if (value is null) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, column.DataType), value.GetType().ToString()); + } + } + cachedObjectConversions.Add(value); + } + + int cacheIndex = 0; + foreach (KeyValuePair columnAndValue in row) + { + string columnName = columnAndValue.Key; + int index = Columns.IndexOf(columnName); + + DataFrameColumn column = Columns[index]; + object value = cachedObjectConversions[cacheIndex]; + ResizeByOneAndAppend(column, value); + cacheIndex++; + } + + foreach (DataFrameColumn column in Columns) + { + if (column.Length == RowCount) + { + ResizeByOneAndAppend(column, null); + } + } + Columns.RowCount++; + } + + /// + /// Invalidates any cached data after a column has changed. + /// + private void OnColumnsChanged() + { + _schema = null; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + int longestColumnName = 0; + for (int i = 0; i < Columns.Count; i++) + { + longestColumnName = Math.Max(longestColumnName, Columns[i].Name.Length); + } + for (int i = 0; i < Columns.Count; i++) + { + // Left align by 10 + sb.Append(string.Format(Columns[i].Name.PadRight(longestColumnName))); + } + sb.AppendLine(); + long numberOfRows = Math.Min(RowCount, 25); + for (int i = 0; i < numberOfRows; i++) + { + IList row = this[i]; + foreach (object obj in row) + { + sb.Append((obj ?? "null").ToString().PadRight(longestColumnName)); + } + sb.AppendLine(); + } + return sb.ToString(); + } + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameBuffer.cs b/src/Microsoft.Data.Analysis/DataFrameBuffer.cs new file mode 100644 index 0000000000..44a8d3faaa --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameBuffer.cs @@ -0,0 +1,97 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Data.Analysis +{ + /// + /// A basic mutable store to hold values in a DataFrame column. Supports wrapping with an ArrowBuffer + /// + /// + internal class DataFrameBuffer : ReadOnlyDataFrameBuffer + where T : struct + { + private Memory _memory; + + public override ReadOnlyMemory ReadOnlyBuffer => _memory; + + public Memory Buffer + { + get => _memory; + } + + public Span Span + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => (MemoryMarshal.Cast(Buffer.Span)).Slice(0, Length); + } + + public Span RawSpan + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => MemoryMarshal.Cast(Buffer.Span); + } + + public DataFrameBuffer(int numberOfValues = 8) : base(numberOfValues) { } + + internal DataFrameBuffer(ReadOnlyMemory buffer, int length) : base(buffer, length) + { + _memory = new byte[buffer.Length]; + buffer.CopyTo(_memory); + } + + public void Append(T value) + { + if (Length == MaxCapacity) + { + throw new ArgumentException("Current buffer is full", nameof(value)); + } + EnsureCapacity(1); + if (Length < MaxCapacity) + ++Length; + Span[Length - 1] = value; + } + + public void EnsureCapacity(int numberOfValues) + { + long newLength = Length + (long)numberOfValues; + if (newLength > MaxCapacity) + { + throw new ArgumentException("Current buffer is full", nameof(numberOfValues)); + } + + if (newLength > Capacity) + { + var newCapacity = Math.Max(newLength * Size, ReadOnlyBuffer.Length * 2); + var memory = new Memory(new byte[newCapacity]); + _memory.CopyTo(memory); + _memory = memory; + } + } + + internal override T this[int index] + { + set + { + if (index > Length) + throw new ArgumentOutOfRangeException(nameof(index)); + RawSpan[index] = value; + } + } + + internal static DataFrameBuffer GetMutableBuffer(ReadOnlyDataFrameBuffer buffer) + { + DataFrameBuffer mutableBuffer = buffer as DataFrameBuffer; + if (mutableBuffer == null) + { + mutableBuffer = new DataFrameBuffer(buffer.ReadOnlyBuffer, buffer.Length); + mutableBuffer.Length = buffer.Length; + } + return mutableBuffer; + } + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs new file mode 100644 index 0000000000..3cbc978458 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs @@ -0,0 +1,177 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public abstract partial class DataFrameColumn + { + public virtual DataFrameColumn Add(DataFrameColumn column, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Add(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Subtract(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Multiply(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Divide(DataFrameColumn column, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Divide(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Modulo(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn And(DataFrameColumn column, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn And(bool value, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Or(DataFrameColumn column, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn Or(bool value, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn Xor(DataFrameColumn column, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn Xor(bool value, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn LeftShift(int value, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual DataFrameColumn RightShift(int value, bool inPlace = false) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn column) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseEquals(T value) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseNotEquals(T value) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(DataFrameColumn column) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(T value) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFrameColumn column) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(T value) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameColumn column) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseGreaterThan(T value) + where T : unmanaged + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColumn column) + { + throw new NotImplementedException(); + } + + public virtual PrimitiveDataFrameColumn ElementwiseLessThan(T value) + where T : unmanaged + { + throw new NotImplementedException(); + } + + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt new file mode 100644 index 0000000000..23ecfc3df4 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt @@ -0,0 +1,49 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude"#> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public abstract partial class DataFrameColumn + { +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.BinaryScalar) { #> +<# if (method.IsBitwise == true) { #> + public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(bool value, bool inPlace = false) +<# } else { #> + public virtual DataFrameColumn <#=method.MethodName#>(T value, bool inPlace = false) + where T : unmanaged +<# } #> +<# } #> +<# if (method.MethodType == MethodType.ComparisonScalar) { #> + public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(T value) + where T : unmanaged +<# } #> +<# if (method.MethodType == MethodType.Binary) {#> + public virtual DataFrameColumn <#=method.MethodName#>(DataFrameColumn column, bool inPlace = false) +<# } #> +<# if (method.MethodType == MethodType.Comparison) {#> + public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(DataFrameColumn column) +<# } #> +<# if (method.MethodType == MethodType.BinaryInt ) {#> + public virtual DataFrameColumn <#=method.MethodName#>(int value, bool inPlace = false) +<# } #> + { + throw new NotImplementedException(); + } + +<# } #> + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs new file mode 100644 index 0000000000..df945ce975 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs @@ -0,0 +1,343 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperators.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public abstract partial class DataFrameColumn + { + public static DataFrameColumn operator +(DataFrameColumn left, DataFrameColumn right) + { + return left.Add(right); + } + + public static DataFrameColumn operator +(DataFrameColumn column, bool value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, byte value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, char value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, decimal value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, double value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, float value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, int value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, long value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, sbyte value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, short value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, uint value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, ulong value) + { + return column.Add(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, ushort value) + { + return column.Add(value); + } + + public static DataFrameColumn operator -(DataFrameColumn left, DataFrameColumn right) + { + return left.Subtract(right); + } + + public static DataFrameColumn operator -(DataFrameColumn column, bool value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, byte value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, char value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, decimal value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, double value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, float value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, int value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, long value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, sbyte value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, short value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, uint value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, ulong value) + { + return column.Subtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, ushort value) + { + return column.Subtract(value); + } + + public static DataFrameColumn operator *(DataFrameColumn left, DataFrameColumn right) + { + return left.Multiply(right); + } + + public static DataFrameColumn operator *(DataFrameColumn column, bool value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, byte value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, char value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, decimal value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, double value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, float value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, int value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, long value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, sbyte value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, short value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, uint value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, ulong value) + { + return column.Multiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, ushort value) + { + return column.Multiply(value); + } + + public static DataFrameColumn operator /(DataFrameColumn left, DataFrameColumn right) + { + return left.Divide(right); + } + + public static DataFrameColumn operator /(DataFrameColumn column, bool value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, byte value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, char value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, decimal value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, double value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, float value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, int value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, long value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, sbyte value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, short value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, uint value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, ulong value) + { + return column.Divide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, ushort value) + { + return column.Divide(value); + } + + public static DataFrameColumn operator %(DataFrameColumn left, DataFrameColumn right) + { + return left.Modulo(right); + } + + public static DataFrameColumn operator %(DataFrameColumn column, bool value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, byte value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, char value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, decimal value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, double value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, float value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, int value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, long value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, sbyte value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, short value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, uint value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, ulong value) + { + return column.Modulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, ushort value) + { + return column.Modulo(value); + } + + public static DataFrameColumn operator &(DataFrameColumn left, DataFrameColumn right) + { + return left.And(right); + } + + public static DataFrameColumn operator &(DataFrameColumn column, bool value) + { + return column.And(value); + } + public static DataFrameColumn operator |(DataFrameColumn left, DataFrameColumn right) + { + return left.Or(right); + } + + public static DataFrameColumn operator |(DataFrameColumn column, bool value) + { + return column.Or(value); + } + public static DataFrameColumn operator ^(DataFrameColumn left, DataFrameColumn right) + { + return left.Xor(right); + } + + public static DataFrameColumn operator ^(DataFrameColumn column, bool value) + { + return column.Xor(value); + } + public static DataFrameColumn operator <<(DataFrameColumn column, int value) + { + return column.LeftShift(value); + } + + public static DataFrameColumn operator >>(DataFrameColumn column, int value) + { + return column.RightShift(value); + } + + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt new file mode 100644 index 0000000000..ccd54b0fc9 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt @@ -0,0 +1,52 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperators.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public abstract partial class DataFrameColumn + { +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.BinaryScalar) { #> +<# if (method.IsBitwise == true) { #> + public static DataFrameColumn operator <#=method.Operator#>(DataFrameColumn column, bool value) + { + return column.<#=method.MethodName#>(value); + } +<# } else { #> +<# foreach (TypeConfiguration type in typeConfiguration) { #> + public static DataFrameColumn operator <#=method.Operator#>(DataFrameColumn column, <#=type.TypeName#> value) + { + return column.<#=method.MethodName#>(value); + } +<# } #> + +<# } #> +<# } else if (method.MethodType == MethodType.BinaryInt) {#> + public static DataFrameColumn operator <#=method.Operator#>(DataFrameColumn column, int value) + { + return column.<#=method.MethodName#>(value); + } + +<# } else if (method.MethodType == MethodType.Binary) { #> + public static DataFrameColumn operator <#=method.Operator#>(DataFrameColumn left, DataFrameColumn right) + { + return left.<#=method.MethodName#>(right); + } + +<# } #> +<# } #> + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.Computations.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.Computations.cs new file mode 100644 index 0000000000..fedfb36325 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.Computations.cs @@ -0,0 +1,176 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.Computations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public abstract partial class DataFrameColumn + { + /// + /// Updates each numeric element with its absolute numeric value + /// + public virtual DataFrameColumn Abs(bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Returns whether all the elements are True + /// + public virtual bool All() + { + throw new NotImplementedException(); + } + + /// + /// Returns whether any element is True + /// + public virtual bool Any() + { + throw new NotImplementedException(); + } + + /// + /// Updates each element with its cumulative maximum + /// + public virtual DataFrameColumn CumulativeMax(bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Updates column values at rowIndices with its cumulative rowIndices maximum + /// + public virtual DataFrameColumn CumulativeMax(IEnumerable rowIndices, bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Updates each element with its cumulative minimum + /// + public virtual DataFrameColumn CumulativeMin(bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Updates column values at rowIndices with its cumulative rowIndices minimum + /// + public virtual DataFrameColumn CumulativeMin(IEnumerable rowIndices, bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Updates each element with its cumulative product + /// + public virtual DataFrameColumn CumulativeProduct(bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Updates column values at rowIndices with its cumulative rowIndices product + /// + public virtual DataFrameColumn CumulativeProduct(IEnumerable rowIndices, bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Updates each element with its cumulative sum + /// + public virtual DataFrameColumn CumulativeSum(bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Updates column values at rowIndices with its cumulative rowIndices sum + /// + public virtual DataFrameColumn CumulativeSum(IEnumerable rowIndices, bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Returns the maximum of the values in the column + /// + public virtual object Max() + { + throw new NotImplementedException(); + } + + /// + /// Returns the maximum of the values at rowIndices + /// + public virtual object Max(IEnumerable rowIndices) + { + throw new NotImplementedException(); + } + + /// + /// Returns the minimum of the values in the column + /// + public virtual object Min() + { + throw new NotImplementedException(); + } + + /// + /// Returns the minimum of the values at the rowIndices + /// + public virtual object Min(IEnumerable rowIndices) + { + throw new NotImplementedException(); + } + + /// + /// Returns the product of the values in the column + /// + public virtual object Product() + { + throw new NotImplementedException(); + } + + /// + /// Returns the product of the values at the rowIndices + /// + public virtual object Product(IEnumerable rowIndices) + { + throw new NotImplementedException(); + } + + /// + /// Returns the sum of the values in the column + /// + public virtual object Sum() + { + throw new NotImplementedException(); + } + + /// + /// Returns the sum of the values at the rowIndices + /// + public virtual object Sum(IEnumerable rowIndices) + { + throw new NotImplementedException(); + } + + /// + /// Calls Math.Round on each value in a column + /// + public virtual DataFrameColumn Round(bool inPlace = false) + { + throw new NotImplementedException(); + } + + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.Computations.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.Computations.tt new file mode 100644 index 0000000000..ebe4785ae7 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.Computations.tt @@ -0,0 +1,44 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude"#> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.Computations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public abstract partial class DataFrameColumn + { +<# foreach (MethodConfiguration compMethod in computationMethodConfiguration) { #> + /// + /// <#=compMethod.MethodComments#> + /// +<# if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false && compMethod.SupportsRowSubsets == true) {#> + public virtual DataFrameColumn <#=compMethod.MethodName#>(IEnumerable rowIndices, bool inPlace = false) +<# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false) {#> + public virtual DataFrameColumn <#=compMethod.MethodName#>(bool inPlace = false) +<# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == true) {#> + public virtual object <#=compMethod.MethodName#>() +<# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true && compMethod.SupportsRowSubsets == true) { #> + public virtual object <#=compMethod.MethodName#>(IEnumerable rowIndices) +<# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true) { #> + public virtual object <#=compMethod.MethodName#>() +<# } else { #> + public virtual bool <#=compMethod.MethodName#>() +<# } #> + { + throw new NotImplementedException(); + } + +<# } #> + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.cs new file mode 100644 index 0000000000..a5d3abe5a2 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.cs @@ -0,0 +1,472 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Apache.Arrow; +using Microsoft.ML; + +namespace Microsoft.Data.Analysis +{ + /// + /// The base column type. All APIs should be defined here first + /// + public abstract partial class DataFrameColumn : IEnumerable + { + public DataFrameColumn(string name, long length, Type type) + { + Length = length; + _name = name; + DataType = type; + } + + private long _length; + public long Length + { + get => _length; + protected set + { + if (value < 0) + throw new ArgumentOutOfRangeException(); + _length = value; + } + } + + public abstract long NullCount + { + get; + } + + private string _name; + public string Name => _name; + + public void SetName(string newName, DataFrame dataFrame = null) + { + if (!(dataFrame is null)) + { + dataFrame.Columns.SetColumnName(this, newName); + } + _name = newName; + } + + public Type DataType { get; } + + public object this[long rowIndex] + { + get => GetValue(rowIndex); + set => SetValue(rowIndex, value); + } + + protected abstract object GetValue(long rowIndex); + protected abstract IReadOnlyList GetValues(long startIndex, int length); + + protected abstract void SetValue(long rowIndex, object value); + + public IReadOnlyList this[long startIndex, int length] + { + get => GetValues(startIndex, length); + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumeratorCore(); + + protected abstract IEnumerator GetEnumeratorCore(); + + /// + /// Called internally from Append, Merge and GroupBy. Resizes the column to the specified length to allow setting values by indexing + /// + /// The new length of the column + protected internal virtual void Resize(long length) => throw new NotImplementedException(); + + /// + /// Clone column to produce a copy potentially changing the order by supplying mapIndices and an invert flag + /// + /// + /// + /// + public virtual DataFrameColumn Clone(DataFrameColumn mapIndices = null, bool invertMapIndices = false, long numberOfNullsToAppend = 0) => CloneImplementation(mapIndices, invertMapIndices, numberOfNullsToAppend); + + protected virtual DataFrameColumn CloneImplementation(DataFrameColumn mapIndices, bool invertMapIndices, long numberOfNullsToAppend) => throw new NotImplementedException(); + + /// + /// Returns a copy of this column sorted by its values + /// + /// + public virtual DataFrameColumn Sort(bool ascending = true) + { + PrimitiveDataFrameColumn sortIndices = GetAscendingSortIndices(); + return Clone(sortIndices, !ascending, NullCount); + } + + public virtual Dictionary> GroupColumnValues() => throw new NotImplementedException(); + + /// + /// Returns a DataFrame containing counts of unique values + /// + public virtual DataFrame ValueCounts() => throw new NotImplementedException(); + + public virtual GroupBy GroupBy(int columnIndex, DataFrame parent) => throw new NotImplementedException(); + + /// + /// Returns a new column with nulls replaced by value + /// + /// Tries to convert value to the column's DataType + /// + public virtual DataFrameColumn FillNulls(object value, bool inPlace = false) => FillNullsImplementation(value, inPlace); + + protected virtual DataFrameColumn FillNullsImplementation(object value, bool inPlace) => throw new NotImplementedException(); + + // Arrow related APIs + protected internal virtual Field GetArrowField() => throw new NotImplementedException(); + /// + /// Returns the max number of values that are contiguous in memory + /// + protected internal virtual int GetMaxRecordBatchLength(long startIndex) => 0; + protected internal virtual Apache.Arrow.Array ToArrowArray(long startIndex, int numberOfRows) => throw new NotImplementedException(); + + /// + /// Creates a that will return the value of the column for the row + /// the cursor is referencing. + /// + /// + /// The row cursor which has the current position. + /// + protected internal virtual Delegate GetDataViewGetter(DataViewRowCursor cursor) => throw new NotImplementedException(); + + /// + /// Adds a new to the specified builder for the current column. + /// + /// + /// The builder to which to add the schema column. + /// + protected internal virtual void AddDataViewColumn(DataViewSchema.Builder builder) => throw new NotImplementedException(); + + /// + /// Clips values beyond the specified thresholds + /// + /// + /// Minimum value. All values below this threshold will be set to it + /// Maximum value. All values above this threshold will be set to it + public virtual DataFrameColumn Clip(U lower, U upper, bool inPlace = false) => ClipImplementation(lower, upper, inPlace); + + protected virtual DataFrameColumn ClipImplementation(U lower, U upper, bool inPlace) => throw new NotImplementedException(); + + /// + /// Returns a new column filtered by the lower and upper bounds + /// + /// + /// + /// + public virtual DataFrameColumn Filter(U lower, U upper) => FilterImplementation(lower, upper); + + protected virtual DataFrameColumn FilterImplementation(U lower, U upper) => throw new NotImplementedException(); + + /// + /// Determines if the column is of a numeric type + /// + public virtual bool IsNumericColumn() => false; + + /// + /// Returns the mean of the values in the column. Throws if this is not a numeric column + /// + public virtual double Mean() => throw new NotImplementedException(); + + /// + /// Returns the median of the values in the column. Throws if this is not a numeric column + /// + public virtual double Median() => throw new NotImplementedException(); + + /// + /// Used to exclude columns from the Description method + /// + public virtual bool HasDescription() => false; + + /// + /// Returns a DataFrame with statistics that describe the column + /// + public virtual DataFrame Description() => throw new NotImplementedException(); + + internal virtual PrimitiveDataFrameColumn GetAscendingSortIndices() => throw new NotImplementedException(); + + internal delegate long GetBufferSortIndex(int bufferIndex, int sortIndex); + internal delegate ValueTuple GetValueAndBufferSortIndexAtBuffer(int bufferIndex, int valueIndex); + internal delegate int GetBufferLengthAtIndex(int bufferIndex); + internal void PopulateColumnSortIndicesWithHeap(SortedDictionary>> heapOfValueAndListOfTupleOfSortAndBufferIndex, + PrimitiveDataFrameColumn columnSortIndices, + GetBufferSortIndex getBufferSortIndex, + GetValueAndBufferSortIndexAtBuffer getValueAndBufferSortIndexAtBuffer, + GetBufferLengthAtIndex getBufferLengthAtIndex) + { + while (heapOfValueAndListOfTupleOfSortAndBufferIndex.Count > 0) + { + KeyValuePair>> minElement = heapOfValueAndListOfTupleOfSortAndBufferIndex.ElementAt(0); + List> tuplesOfSortAndBufferIndex = minElement.Value; + (int sortIndex, int bufferIndex) sortAndBufferIndex; + if (tuplesOfSortAndBufferIndex.Count == 1) + { + heapOfValueAndListOfTupleOfSortAndBufferIndex.Remove(minElement.Key); + sortAndBufferIndex = tuplesOfSortAndBufferIndex[0]; + } + else + { + sortAndBufferIndex = tuplesOfSortAndBufferIndex[tuplesOfSortAndBufferIndex.Count - 1]; + tuplesOfSortAndBufferIndex.RemoveAt(tuplesOfSortAndBufferIndex.Count - 1); + } + int sortIndex = sortAndBufferIndex.sortIndex; + int bufferIndex = sortAndBufferIndex.bufferIndex; + long bufferSortIndex = getBufferSortIndex(bufferIndex, sortIndex); + columnSortIndices.Append(bufferSortIndex); + if (sortIndex + 1 < getBufferLengthAtIndex(bufferIndex)) + { + int nextSortIndex = sortIndex + 1; + (T value, int bufferSortIndex) nextValueAndBufferSortIndex = getValueAndBufferSortIndexAtBuffer(bufferIndex, nextSortIndex); + T nextValue = nextValueAndBufferSortIndex.value; + if (nextValue != null) + { + heapOfValueAndListOfTupleOfSortAndBufferIndex.Add(nextValue, new List>() { (nextValueAndBufferSortIndex.bufferSortIndex, bufferIndex) }); + } + } + } + + } + internal static int FloorLog2PlusOne(int n) + { + Debug.Assert(n >= 2); + int result = 2; + n >>= 2; + while (n > 0) + { + ++result; + n >>= 1; + } + return result; + } + + internal static void IntrospectiveSort( + ReadOnlySpan span, + int length, + Span sortIndices, + IComparer comparer) + { + var depthLimit = 2 * FloorLog2PlusOne(length); + IntroSortRecursive(span, 0, length - 1, depthLimit, sortIndices, comparer); + } + + internal static void IntroSortRecursive( + ReadOnlySpan span, + int lo, int hi, int depthLimit, + Span sortIndices, + IComparer comparer) + { + Debug.Assert(comparer != null); + Debug.Assert(lo >= 0); + + while (hi > lo) + { + int partitionSize = hi - lo + 1; + if (partitionSize <= 16) + { + if (partitionSize == 1) + { + return; + } + if (partitionSize == 2) + { + Sort2(span, lo, hi, sortIndices, comparer); + return; + } + if (partitionSize == 3) + { + Sort3(span, lo, hi - 1, hi, sortIndices, comparer); + return; + } + + InsertionSort(span, lo, hi, sortIndices, comparer); + return; + } + + if (depthLimit == 0) + { + HeapSort(span, lo, hi, sortIndices, comparer); + return; + } + depthLimit--; + + // We should never reach here, unless > 3 elements due to partition size + int p = PickPivotAndPartition(span, lo, hi, sortIndices, comparer); + // Note we've already partitioned around the pivot and do not have to move the pivot again. + IntroSortRecursive(span, p + 1, hi, depthLimit, sortIndices, comparer); + hi = p - 1; + } + } + + private static int PickPivotAndPartition( + ReadOnlySpan span, int lo, int hi, + Span sortIndices, + TComparer comparer) + where TComparer : IComparer + { + Debug.Assert(comparer != null); + Debug.Assert(lo >= 0); + Debug.Assert(hi > lo); + + // median-of-three + int middle = (int)(((uint)hi + (uint)lo) >> 1); + + // Sort lo, mid and hi appropriately, then pick mid as the pivot. + Sort3(span, lo, middle, hi, sortIndices, comparer); + + TKey pivot = span[sortIndices[middle]]; + + int left = lo; + int right = hi - 1; + // We already partitioned lo and hi and put the pivot in hi - 1. + Swap(ref sortIndices[middle], ref sortIndices[right]); + + while (left < right) + { + while (left < (hi - 1) && comparer.Compare(span[sortIndices[++left]], pivot) < 0) + ; + // Check if bad comparable/comparer + if (left == (hi - 1) && comparer.Compare(span[sortIndices[left]], pivot) < 0) + throw new ArgumentException("Bad comparer"); + + while (right > lo && comparer.Compare(pivot, span[sortIndices[--right]]) < 0) + ; + // Check if bad comparable/comparer + if (right == lo && comparer.Compare(pivot, span[sortIndices[right]]) < 0) + throw new ArgumentException("Bad comparer"); + + if (left >= right) + break; + + Swap(ref sortIndices[left], ref sortIndices[right]); + } + // Put pivot in the right location. + right = hi - 1; + if (left != right) + { + Swap(ref sortIndices[left], ref sortIndices[right]); + } + return left; + } + + internal static void Swap(ref TKey a, ref TKey b) + { + TKey temp = a; + a = b; + b = temp; + } + + private static void HeapSort( + ReadOnlySpan span, int lo, int hi, + Span sortIndices, + TComparer comparer) + where TComparer : IComparer + { + Debug.Assert(comparer != null); + Debug.Assert(lo >= 0); + Debug.Assert(hi > lo); + + int n = hi - lo + 1; + for (int i = n / 2; i >= 1; --i) + { + DownHeap(span, i, n, lo, sortIndices, comparer); + } + for (int i = n; i > 1; --i) + { + Swap(ref sortIndices[lo], ref sortIndices[lo + i - 1]); + DownHeap(span, 1, i - 1, lo, sortIndices, comparer); + } + } + + private static void DownHeap( + ReadOnlySpan span, int i, int n, int lo, + Span sortIndices, + TComparer comparer) + where TComparer : IComparer + { + // Max Heap + Debug.Assert(comparer != null); + Debug.Assert(lo >= 0); + + int di = sortIndices[lo - 1 + i]; + TKey d = span[di]; + var nHalf = n / 2; + while (i <= nHalf) + { + int child = i << 1; + + if (child < n && + comparer.Compare(span[sortIndices[lo + child - 1]], span[sortIndices[lo + child]]) < 0) + { + ++child; + } + + if (!(comparer.Compare(d, span[sortIndices[lo + child - 1]]) < 0)) + break; + + sortIndices[lo + i - 1] = sortIndices[lo + child - 1]; + + i = child; + } + sortIndices[lo + i - 1] = di; + } + + private static void InsertionSort( + ReadOnlySpan span, int lo, int hi, + Span sortIndices, + TComparer comparer) + where TComparer : IComparer + { + Debug.Assert(lo >= 0); + Debug.Assert(hi >= lo); + + for (int i = lo; i < hi; ++i) + { + int j = i; + var t = span[sortIndices[j + 1]]; + var ti = sortIndices[j + 1]; + if (j >= lo && comparer.Compare(t, span[sortIndices[j]]) < 0) + { + do + { + sortIndices[j + 1] = sortIndices[j]; + --j; + } + while (j >= lo && comparer.Compare(t, span[sortIndices[j]]) < 0); + + sortIndices[j + 1] = ti; + } + } + } + + private static void Sort3( + ReadOnlySpan span, int i, int j, int k, + Span sortIndices, + TComparer comparer) + where TComparer : IComparer + { + Sort2(span, i, j, sortIndices, comparer); + Sort2(span, i, k, sortIndices, comparer); + Sort2(span, j, k, sortIndices, comparer); + } + + private static void Sort2( + ReadOnlySpan span, int i, int j, + Span sortIndices, + IComparer comparer) + { + Debug.Assert(i != j); + if (comparer.Compare(span[sortIndices[i]], span[sortIndices[j]]) > 0) + { + int temp = sortIndices[i]; + sortIndices[i] = sortIndices[j]; + sortIndices[j] = temp; + } + } + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs new file mode 100644 index 0000000000..9454b675f9 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs @@ -0,0 +1,160 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Microsoft.Data.Analysis +{ + /// + /// A DataFrameColumnCollection is just a container that holds a number of DataFrameColumn instances. + /// + public class DataFrameColumnCollection : Collection + { + private Action ColumnsChanged; + + private List _columnNames = new List(); + + private Dictionary _columnNameToIndexDictionary = new Dictionary(StringComparer.Ordinal); + + internal long RowCount { get; set; } + + internal DataFrameColumnCollection(Action columnsChanged) : base() + { + ColumnsChanged = columnsChanged; + } + + internal DataFrameColumnCollection(IList columns, Action columnsChanged) : base() + { + columns = columns ?? throw new ArgumentNullException(nameof(columns)); + ColumnsChanged = columnsChanged; + for (int i = 0; i < columns.Count; i++) + { + Add(columns[i]); + } + } + + internal IReadOnlyList GetColumnNames() + { + var ret = new List(Count); + for (int i = 0; i < Count; i++) + { + ret.Add(this[i].Name); + } + return ret; + } + + internal IList GetRow(long rowIndex) + { + var ret = new List(); + for (int i = 0; i < Count; i++) + { + ret.Add(this[i][rowIndex]); + } + return ret; + } + + public void SetColumnName(DataFrameColumn column, string newName) + { + string currentName = column.Name; + int currentIndex = _columnNameToIndexDictionary[currentName]; + column.SetName(newName); + _columnNames[currentIndex] = newName; + _columnNameToIndexDictionary.Remove(currentName); + _columnNameToIndexDictionary.Add(newName, currentIndex); + ColumnsChanged?.Invoke(); + } + + public void Insert(int columnIndex, IEnumerable column, string columnName) + where T : unmanaged + { + DataFrameColumn newColumn = new PrimitiveDataFrameColumn(columnName, column); + Insert(columnIndex, newColumn); // calls InsertItem internally + } + + protected override void InsertItem(int columnIndex, DataFrameColumn column) + { + column = column ?? throw new ArgumentNullException(nameof(column)); + if (RowCount > 0 && column.Length != RowCount) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + if (_columnNameToIndexDictionary.ContainsKey(column.Name)) + { + throw new ArgumentException(string.Format(Strings.DuplicateColumnName, column.Name), nameof(column)); + } + RowCount = column.Length; + _columnNames.Insert(columnIndex, column.Name); + _columnNameToIndexDictionary[column.Name] = columnIndex; + for (int i = columnIndex + 1; i < Count; i++) + { + _columnNameToIndexDictionary[_columnNames[i]]++; + } + base.InsertItem(columnIndex, column); + ColumnsChanged?.Invoke(); + } + + protected override void SetItem(int columnIndex, DataFrameColumn column) + { + column = column ?? throw new ArgumentNullException(nameof(column)); + if (RowCount > 0 && column.Length != RowCount) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + bool existingColumn = _columnNameToIndexDictionary.TryGetValue(column.Name, out int existingColumnIndex); + if (existingColumn && existingColumnIndex != columnIndex) + { + throw new ArgumentException(string.Format(Strings.DuplicateColumnName, column.Name), nameof(column)); + } + _columnNameToIndexDictionary.Remove(_columnNames[columnIndex]); + _columnNames[columnIndex] = column.Name; + _columnNameToIndexDictionary[column.Name] = columnIndex; + base.SetItem(columnIndex, column); + ColumnsChanged?.Invoke(); + } + + protected override void RemoveItem(int columnIndex) + { + _columnNameToIndexDictionary.Remove(_columnNames[columnIndex]); + for (int i = columnIndex + 1; i < Count; i++) + { + _columnNameToIndexDictionary[_columnNames[i]]--; + } + _columnNames.RemoveAt(columnIndex); + base.RemoveItem(columnIndex); + ColumnsChanged?.Invoke(); + } + + public void Remove(string columnName) + { + int columnIndex = IndexOf(columnName); + if (columnIndex != -1) + { + RemoveAt(columnIndex); // calls RemoveItem internally + } + } + + /// + /// Searches for a with the specified and returns the zero-based index of the first occurrence if found. Returns -1 otherwise + /// + /// + public int IndexOf(string columnName) + { + if (_columnNameToIndexDictionary.TryGetValue(columnName, out int columnIndex)) + { + return columnIndex; + } + return -1; + } + + protected override void ClearItems() + { + base.ClearItems(); + ColumnsChanged?.Invoke(); + _columnNames.Clear(); + _columnNameToIndexDictionary.Clear(); + } + } +} diff --git a/src/Microsoft.Data.Analysis/DecimalConverter.cs b/src/Microsoft.Data.Analysis/DecimalConverter.cs new file mode 100644 index 0000000000..741ebf634e --- /dev/null +++ b/src/Microsoft.Data.Analysis/DecimalConverter.cs @@ -0,0 +1,173 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + internal interface IDecimalConverter + where T : struct + { + decimal GetDecimal(T value); + } + internal static class DecimalConverter + where T : struct + { + public static IDecimalConverter Instance { get; } = DecimalConverter.GetDecimalConverter(); + } + internal static class DecimalConverter + { + public static IDecimalConverter GetDecimalConverter() + where T : struct + { + if (typeof(T) == typeof(bool)) + { + throw new NotImplementedException(); + } + else if (typeof(T) == typeof(byte)) + { + return (IDecimalConverter)new ByteDecimalConverter(); + } + else if (typeof(T) == typeof(char)) + { + return (IDecimalConverter)new CharDecimalConverter(); + } + else if (typeof(T) == typeof(decimal)) + { + return (IDecimalConverter)new DecimalDecimalConverter(); + } + else if (typeof(T) == typeof(double)) + { + return (IDecimalConverter)new DoubleDecimalConverter(); + } + else if (typeof(T) == typeof(float)) + { + return (IDecimalConverter)new FloatDecimalConverter(); + } + else if (typeof(T) == typeof(int)) + { + return (IDecimalConverter)new IntDecimalConverter(); + } + else if (typeof(T) == typeof(long)) + { + return (IDecimalConverter)new LongDecimalConverter(); + } + else if (typeof(T) == typeof(sbyte)) + { + return (IDecimalConverter)new SByteDecimalConverter(); + } + else if (typeof(T) == typeof(short)) + { + return (IDecimalConverter)new ShortDecimalConverter(); + } + else if (typeof(T) == typeof(uint)) + { + return (IDecimalConverter)new UIntDecimalConverter(); + } + else if (typeof(T) == typeof(ulong)) + { + return (IDecimalConverter)new ULongDecimalConverter(); + } + else if (typeof(T) == typeof(ushort)) + { + return (IDecimalConverter)new UShortDecimalConverter(); + } + throw new NotSupportedException(); + } + } + + internal class ByteDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(byte value) + { + return value; + } + } + + internal class CharDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(char value) + { + return value; + } + } + + internal class DecimalDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(decimal value) + { + return value; + } + } + + internal class DoubleDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(double value) + { + return (decimal)value; + } + } + + internal class FloatDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(float value) + { + return (decimal)value; + } + } + + internal class IntDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(int value) + { + return value; + } + } + + internal class LongDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(long value) + { + return value; + } + } + + internal class SByteDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(sbyte value) + { + return value; + } + } + + internal class ShortDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(short value) + { + return value; + } + } + + internal class UIntDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(uint value) + { + return value; + } + } + + internal class ULongDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(ulong value) + { + return value; + } + } + + internal class UShortDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(ushort value) + { + return value; + } + } +} diff --git a/src/Microsoft.Data.Analysis/DoubleConverter.cs b/src/Microsoft.Data.Analysis/DoubleConverter.cs new file mode 100644 index 0000000000..b5539013cd --- /dev/null +++ b/src/Microsoft.Data.Analysis/DoubleConverter.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + internal interface IDoubleConverter + where T : struct + { + double GetDouble(T value); + } + internal static class DoubleConverter + where T : struct + { + public static IDoubleConverter Instance { get; } = DoubleConverter.GetDoubleConverter(); + } + internal static class DoubleConverter + { + public static IDoubleConverter GetDoubleConverter() + where T : struct + { + if (typeof(T) == typeof(bool)) + { + throw new NotImplementedException(); + } + else if (typeof(T) == typeof(byte)) + { + return (IDoubleConverter)new ByteDoubleConverter(); + } + else if (typeof(T) == typeof(char)) + { + return (IDoubleConverter)new CharDoubleConverter(); + } + else if (typeof(T) == typeof(decimal)) + { + throw new NotImplementedException(); + } + else if (typeof(T) == typeof(double)) + { + return (IDoubleConverter)new DoubleDoubleConverter(); + } + else if (typeof(T) == typeof(float)) + { + return (IDoubleConverter)new FloatDoubleConverter(); + } + else if (typeof(T) == typeof(int)) + { + return (IDoubleConverter)new IntDoubleConverter(); + } + else if (typeof(T) == typeof(long)) + { + return (IDoubleConverter)new LongDoubleConverter(); + } + else if (typeof(T) == typeof(sbyte)) + { + return (IDoubleConverter)new SByteDoubleConverter(); + } + else if (typeof(T) == typeof(short)) + { + return (IDoubleConverter)new ShortDoubleConverter(); + } + else if (typeof(T) == typeof(uint)) + { + return (IDoubleConverter)new UIntDoubleConverter(); + } + else if (typeof(T) == typeof(ulong)) + { + return (IDoubleConverter)new ULongDoubleConverter(); + } + else if (typeof(T) == typeof(ushort)) + { + return (IDoubleConverter)new UShortDoubleConverter(); + } + throw new NotSupportedException(); + } + } + + internal class ByteDoubleConverter : IDoubleConverter + { + public double GetDouble(byte value) + { + return value; + } + } + + internal class CharDoubleConverter : IDoubleConverter + { + public double GetDouble(char value) + { + return value; + } + } + + internal class DoubleDoubleConverter : IDoubleConverter + { + public double GetDouble(double value) + { + return value; + } + } + + internal class FloatDoubleConverter : IDoubleConverter + { + public double GetDouble(float value) + { + return value; + } + } + + internal class IntDoubleConverter : IDoubleConverter + { + public double GetDouble(int value) + { + return value; + } + } + + internal class LongDoubleConverter : IDoubleConverter + { + public double GetDouble(long value) + { + return value; + } + } + + internal class SByteDoubleConverter : IDoubleConverter + { + public double GetDouble(sbyte value) + { + return value; + } + } + + internal class ShortDoubleConverter : IDoubleConverter + { + public double GetDouble(short value) + { + return value; + } + } + + internal class UIntDoubleConverter : IDoubleConverter + { + public double GetDouble(uint value) + { + return value; + } + } + + internal class ULongDoubleConverter : IDoubleConverter + { + public double GetDouble(ulong value) + { + return value; + } + } + + internal class UShortDoubleConverter : IDoubleConverter + { + public double GetDouble(ushort value) + { + return value; + } + } +} diff --git a/src/Microsoft.Data.Analysis/GroupBy.cs b/src/Microsoft.Data.Analysis/GroupBy.cs new file mode 100644 index 0000000000..f6e1d0ecd3 --- /dev/null +++ b/src/Microsoft.Data.Analysis/GroupBy.cs @@ -0,0 +1,468 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + /// + /// A GroupBy class that is typically the result of a DataFrame.GroupBy call. + /// It holds information to perform typical aggregation ops on it. + /// + public abstract class GroupBy + { + /// + /// Compute the number of non-null values in each group + /// + /// + public abstract DataFrame Count(params string[] columnNames); + + /// + /// Return the first value in each group + /// + /// + public abstract DataFrame First(params string[] columnNames); + + /// + /// Returns the first numberOfRows rows of each group + /// + /// + /// + public abstract DataFrame Head(int numberOfRows); + + /// + /// Returns the last numberOfRows rows of each group + /// + /// + /// + public abstract DataFrame Tail(int numberOfRows); + + /// + /// Compute the max of group values + /// + /// The columns to find the max of. A default value finds the max of all columns + public abstract DataFrame Max(params string[] columnNames); + + /// + /// Compute the min of group values + /// + /// The columns to find the min of. A default value finds the min of all columns + public abstract DataFrame Min(params string[] columnNames); + + /// + /// Compute the product of group values + /// + /// The columns to find the product of. A default value finds the product of all columns + public abstract DataFrame Product(params string[] columnNames); + + /// + /// Compute the sum of group values + /// + /// The columns to sum. A Default value sums up all columns + public abstract DataFrame Sum(params string[] columnNames); + + /// + /// Compute the mean of group values + /// + /// The columns to find the mean of. A Default value finds the mean of all columns + public abstract DataFrame Mean(params string[] columnNames); + } + + public class GroupBy : GroupBy + { + private int _groupByColumnIndex; + private IDictionary> _keyToRowIndicesMap; + private DataFrame _dataFrame; + + public GroupBy(DataFrame dataFrame, int groupByColumnIndex, IDictionary> keyToRowIndices) + { + if (dataFrame.Columns.Count < groupByColumnIndex || groupByColumnIndex < 0) + throw new ArgumentException(nameof(groupByColumnIndex)); + _groupByColumnIndex = groupByColumnIndex; + _keyToRowIndicesMap = keyToRowIndices ?? throw new ArgumentException(nameof(keyToRowIndices)); + _dataFrame = dataFrame ?? throw new ArgumentException(nameof(dataFrame)); + } + + private delegate void ColumnDelegate(int columnIndex, long rowIndex, ICollection rows, TKey key, bool firstGroup); + private delegate void GroupByColumnDelegate(long rowNumber, TKey key); + private void EnumerateColumnsWithRows(GroupByColumnDelegate groupByColumnDelegate, ColumnDelegate columnDelegate, params string[] columnNames) + { + long rowNumber = 0; + bool firstGroup = true; + foreach (KeyValuePair> pairs in _keyToRowIndicesMap) + { + groupByColumnDelegate(rowNumber, pairs.Key); + ICollection rows = pairs.Value; + IEnumerable columns = columnNames; + if (columnNames == null || columnNames.Length == 0) + columns = _dataFrame.GetColumnNames(); + // Assuming that the dataframe has not been modified after the groupby call + foreach (string columnName in columns) + { + int columnIndex = _dataFrame.Columns.IndexOf(columnName); + columnDelegate(columnIndex, rowNumber, rows, pairs.Key, firstGroup); + } + firstGroup = false; + rowNumber++; + } + + } + + public override DataFrame Count(params string[] columnNames) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + firstColumn.Resize(rowIndex + 1); + firstColumn[rowIndex] = key; + }); + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + if (columnIndex == _groupByColumnIndex) + return; + DataFrameColumn column = _dataFrame.Columns[columnIndex]; + long count = 0; + foreach (long row in rowEnumerable) + { + if (column[row] != null) + count++; + } + DataFrameColumn retColumn; + if (firstGroup) + { + retColumn = new PrimitiveDataFrameColumn(column.Name); + ret.Columns.Insert(ret.Columns.Count, retColumn); + } + else + { + // Assuming non duplicate column names + retColumn = ret[column.Name]; + } + retColumn.Resize(rowIndex + 1); + retColumn[rowIndex] = count; + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate, columnNames); + ret.SetTableRowCount(firstColumn.Length); + + return ret; + } + + public override DataFrame First(params string[] columnNames) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + firstColumn.Resize(rowIndex + 1); + firstColumn[rowIndex] = key; + }); + + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + if (columnIndex == _groupByColumnIndex) + return; + DataFrameColumn column = _dataFrame.Columns[columnIndex]; + foreach (long row in rowEnumerable) + { + DataFrameColumn retColumn; + if (firstGroup) + { + retColumn = column.Clone(empty); + ret.Columns.Insert(ret.Columns.Count, retColumn); + } + else + { + // Assuming non duplicate column names + retColumn = ret[column.Name]; + } + retColumn.Resize(rowIndex + 1); + retColumn[rowIndex] = column[row]; + break; + } + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate, columnNames); + ret.SetTableRowCount(firstColumn.Length); + return ret; + } + + public override DataFrame Head(int numberOfRows) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + }); + + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + if (columnIndex == _groupByColumnIndex) + return; + DataFrameColumn column = _dataFrame.Columns[columnIndex]; + long count = 0; + bool firstRow = true; + foreach (long row in rowEnumerable) + { + if (count < numberOfRows) + { + DataFrameColumn retColumn; + if (firstGroup && firstRow) + { + firstRow = false; + retColumn = column.Clone(empty); + ret.Columns.Insert(ret.Columns.Count, retColumn); + } + else + { + // Assuming non duplicate column names + retColumn = ret[column.Name]; + } + long retColumnLength = retColumn.Length; + retColumn.Resize(retColumnLength + 1); + retColumn[retColumnLength] = column[row]; + if (firstColumn.Length <= retColumnLength) + { + firstColumn.Resize(retColumnLength + 1); + } + firstColumn[retColumnLength] = key; + count++; + } + if (count == numberOfRows) + break; + } + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate); + ret.SetTableRowCount(firstColumn.Length); + return ret; + } + + public override DataFrame Tail(int numberOfRows) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + }); + + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + if (columnIndex == _groupByColumnIndex) + return; + DataFrameColumn column = _dataFrame.Columns[columnIndex]; + long count = 0; + bool firstRow = true; + ICollection values = _keyToRowIndicesMap[key]; + int numberOfValues = values.Count; + foreach (long row in rowEnumerable) + { + if (count >= numberOfValues - numberOfRows) + { + DataFrameColumn retColumn; + if (firstGroup && firstRow) + { + firstRow = false; + retColumn = column.Clone(empty); + ret.Columns.Insert(ret.Columns.Count, retColumn); + } + else + { + // Assuming non duplicate column names + retColumn = ret[column.Name]; + } + long retColumnLength = retColumn.Length; + if (firstColumn.Length <= retColumnLength) + { + firstColumn.Resize(retColumnLength + 1); + firstColumn[retColumnLength] = key; + } + retColumn.Resize(retColumnLength + 1); + retColumn[retColumnLength] = column[row]; + } + count++; + } + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate); + ret.SetTableRowCount(firstColumn.Length); + return ret; + } + + private DataFrameColumn ResizeAndInsertColumn(int columnIndex, long rowIndex, bool firstGroup, DataFrame ret, PrimitiveDataFrameColumn empty, Func getColumn = null) + { + if (columnIndex == _groupByColumnIndex) + return null; + DataFrameColumn column = _dataFrame.Columns[columnIndex]; + DataFrameColumn retColumn; + if (firstGroup) + { + retColumn = getColumn == null ? column.Clone(empty) : getColumn(column.Name); + ret.Columns.Insert(ret.Columns.Count, retColumn); + } + else + { + // Assuming unique column names + retColumn = ret[column.Name]; + } + retColumn.Resize(rowIndex + 1); + return retColumn; + } + + public override DataFrame Max(params string[] columnNames) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + firstColumn.Resize(rowIndex + 1); + firstColumn[rowIndex] = key; + }); + + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + DataFrameColumn retColumn = ResizeAndInsertColumn(columnIndex, rowIndex, firstGroup, ret, empty); + + if (!(retColumn is null)) + { + retColumn[rowIndex] = _dataFrame.Columns[columnIndex].Max(rowEnumerable); + } + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate, columnNames); + ret.SetTableRowCount(firstColumn.Length); + + return ret; + } + + public override DataFrame Min(params string[] columnNames) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + firstColumn.Resize(rowIndex + 1); + firstColumn[rowIndex] = key; + }); + + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + DataFrameColumn retColumn = ResizeAndInsertColumn(columnIndex, rowIndex, firstGroup, ret, empty); + + if (!(retColumn is null)) + { + retColumn[rowIndex] = _dataFrame.Columns[columnIndex].Min(rowEnumerable); + } + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate, columnNames); + ret.SetTableRowCount(firstColumn.Length); + + return ret; + } + + public override DataFrame Product(params string[] columnNames) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + firstColumn.Resize(rowIndex + 1); + firstColumn[rowIndex] = key; + }); + + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + DataFrameColumn retColumn = ResizeAndInsertColumn(columnIndex, rowIndex, firstGroup, ret, empty); + + if (!(retColumn is null)) + { + retColumn[rowIndex] = _dataFrame.Columns[columnIndex].Product(rowEnumerable); + } + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate, columnNames); + ret.SetTableRowCount(firstColumn.Length); + + return ret; + } + + public override DataFrame Sum(params string[] columnNames) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + firstColumn.Resize(rowIndex + 1); + firstColumn[rowIndex] = key; + }); + + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + DataFrameColumn retColumn = ResizeAndInsertColumn(columnIndex, rowIndex, firstGroup, ret, empty); + + if (!(retColumn is null)) + { + retColumn[rowIndex] = _dataFrame.Columns[columnIndex].Sum(rowEnumerable); + } + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate, columnNames); + ret.SetTableRowCount(firstColumn.Length); + + return ret; + } + + public override DataFrame Mean(params string[] columnNames) + { + DataFrame ret = new DataFrame(); + PrimitiveDataFrameColumn empty = new PrimitiveDataFrameColumn("Empty"); + DataFrameColumn firstColumn = _dataFrame.Columns[_groupByColumnIndex].Clone(empty); + ret.Columns.Insert(ret.Columns.Count, firstColumn); + GroupByColumnDelegate groupByColumnDelegate = new GroupByColumnDelegate((long rowIndex, TKey key) => + { + firstColumn.Resize(rowIndex + 1); + firstColumn[rowIndex] = key; + }); + + + ColumnDelegate columnDelegate = new ColumnDelegate((int columnIndex, long rowIndex, ICollection rowEnumerable, TKey key, bool firstGroup) => + { + DataFrameColumn retColumn = ResizeAndInsertColumn(columnIndex, rowIndex, firstGroup, ret, empty, (name) => new PrimitiveDataFrameColumn(name)); + + if (!(retColumn is null)) + { + retColumn[rowIndex] = (double)Convert.ChangeType(_dataFrame.Columns[columnIndex].Sum(rowEnumerable), typeof(double)) / rowEnumerable.Count; + } + }); + + EnumerateColumnsWithRows(groupByColumnDelegate, columnDelegate, columnNames); + ret.SetTableRowCount(firstColumn.Length); + + return ret; + } + + } +} diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj new file mode 100644 index 0000000000..f902aaffd5 --- /dev/null +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -0,0 +1,162 @@ + + + + netstandard2.0 + 7.3 + true + + + + + + + + + + + + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperations.cs + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperators.cs + + + TextTemplatingFileGenerator + DataFrameColumn.Computations.cs + + + TextTemplatingFileGenerator + DataFrame.BinaryOperations.cs + + + TextTemplatingFileGenerator + DataFrame.BinaryOperators.cs + + + TextTemplatingFileGenerator + DataFrameBinaryOperators.cs + + + TextTemplatingFileGenerator + ColumnArithmeticTemplate.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperations.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.Computations.cs + + + TextTemplatingFileGenerator + PrimitiveColumnArithmetic.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumnComputations.cs + + + TextTemplatingFileGenerator + PrimitiveColumnContainer.BinaryOperations.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumnArithmetic.cs + + + TextTemplatingFileGenerator + PrimitiveColumnContainer.BinaryOperations.cs + + + + + + + + + + True + True + DataFrameColumn.BinaryOperations.tt + + + True + True + DataFrameColumn.BinaryOperators.tt + + + True + True + DataFrameColumn.Computations.tt + + + True + True + DataFrame.BinaryOperations.tt + + + True + True + DataFrame.BinaryOperators.tt + + + True + True + DataFrameBinaryOperators.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperations.tt + + + True + True + PrimitiveDataFrameColumn.Computations.tt + + + True + True + PrimitiveColumnArithmetic.tt + + + True + True + PrimitiveDataFrameColumnComputations.tt + + + True + True + PrimitiveColumnContainer.BinaryOperations.tt + + + True + True + PrimitiveDataFrameColumnArithmetic.tt + + + True + True + PrimitiveColumnContainer.BinaryOperations.tt + + + True + True + Strings.resx + + + + + + ResXFileCodeGenerator + Strings.Designer.cs + Microsoft.Data + + + + diff --git a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.cs new file mode 100644 index 0000000000..63cb1c5d08 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.cs @@ -0,0 +1,194 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveColumnContainer.BinaryOperations.tt. Do not modify directly + +namespace Microsoft.Data.Analysis +{ + internal partial class PrimitiveColumnContainer + where T : struct + { + public PrimitiveColumnContainer Add(PrimitiveColumnContainer right) + { + PrimitiveDataFrameColumnArithmetic.Instance.Add(this, right); + return this; + } + + public PrimitiveColumnContainer Add(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Add(this, scalar); + return this; + } + + public PrimitiveColumnContainer Subtract(PrimitiveColumnContainer right) + { + PrimitiveDataFrameColumnArithmetic.Instance.Subtract(this, right); + return this; + } + + public PrimitiveColumnContainer Subtract(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Subtract(this, scalar); + return this; + } + + public PrimitiveColumnContainer Multiply(PrimitiveColumnContainer right) + { + PrimitiveDataFrameColumnArithmetic.Instance.Multiply(this, right); + return this; + } + + public PrimitiveColumnContainer Multiply(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Multiply(this, scalar); + return this; + } + + public PrimitiveColumnContainer Divide(PrimitiveColumnContainer right) + { + PrimitiveDataFrameColumnArithmetic.Instance.Divide(this, right); + return this; + } + + public PrimitiveColumnContainer Divide(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Divide(this, scalar); + return this; + } + + public PrimitiveColumnContainer Modulo(PrimitiveColumnContainer right) + { + PrimitiveDataFrameColumnArithmetic.Instance.Modulo(this, right); + return this; + } + + public PrimitiveColumnContainer Modulo(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Modulo(this, scalar); + return this; + } + + public PrimitiveColumnContainer And(PrimitiveColumnContainer right) + { + PrimitiveDataFrameColumnArithmetic.Instance.And(this, right); + return this; + } + + public PrimitiveColumnContainer And(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.And(this, scalar); + return this; + } + + public PrimitiveColumnContainer Or(PrimitiveColumnContainer right) + { + PrimitiveDataFrameColumnArithmetic.Instance.Or(this, right); + return this; + } + + public PrimitiveColumnContainer Or(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Or(this, scalar); + return this; + } + + public PrimitiveColumnContainer Xor(PrimitiveColumnContainer right) + { + PrimitiveDataFrameColumnArithmetic.Instance.Xor(this, right); + return this; + } + + public PrimitiveColumnContainer Xor(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Xor(this, scalar); + return this; + } + + public PrimitiveColumnContainer LeftShift(int value) + { + PrimitiveDataFrameColumnArithmetic.Instance.LeftShift(this, value); + return this; + } + + public PrimitiveColumnContainer RightShift(int value) + { + PrimitiveDataFrameColumnArithmetic.Instance.RightShift(this, value); + return this; + } + + public PrimitiveColumnContainer ElementwiseEquals(PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseEquals(this, right, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseEquals(T scalar, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseEquals(this, scalar, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseNotEquals(PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseNotEquals(this, right, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseNotEquals(T scalar, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseNotEquals(this, scalar, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseGreaterThanOrEqual(this, right, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseGreaterThanOrEqual(T scalar, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseGreaterThanOrEqual(this, scalar, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseLessThanOrEqual(PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseLessThanOrEqual(this, right, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseLessThanOrEqual(T scalar, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseLessThanOrEqual(this, scalar, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseGreaterThan(PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseGreaterThan(this, right, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseGreaterThan(T scalar, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseGreaterThan(this, scalar, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseLessThan(PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseLessThan(this, right, ret); + return this; + } + + public PrimitiveColumnContainer ElementwiseLessThan(T scalar, PrimitiveColumnContainer ret) + { + PrimitiveDataFrameColumnArithmetic.Instance.ElementwiseLessThan(this, scalar, ret); + return this; + } + + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.tt new file mode 100644 index 0000000000..068dd0c012 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.tt @@ -0,0 +1,47 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveColumnContainer.BinaryOperations.tt. Do not modify directly + +namespace Microsoft.Data.Analysis +{ + internal partial class PrimitiveColumnContainer + where T : struct + { +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.Comparison || method.MethodType == MethodType.ComparisonScalar) { #> + public <#= method.GetSingleArgumentMethodSignature("PrimitiveColumnContainer", "T") #> + { +<# if (method.MethodType == MethodType.ComparisonScalar ) { #> + PrimitiveDataFrameColumnArithmetic.Instance.<#=method.MethodName#>(this, scalar, ret); +<# } else { #> + PrimitiveDataFrameColumnArithmetic.Instance.<#=method.MethodName#>(this, right, ret); +<# } #> + return this; + } + +<# } else { #> + public <#= method.GetSingleArgumentMethodSignature("PrimitiveColumnContainer", "T")#> + { +<# if (method.MethodType == MethodType.BinaryScalar) { #> + PrimitiveDataFrameColumnArithmetic.Instance.<#=method.MethodName#>(this, scalar); +<# } else if (method.MethodType == MethodType.BinaryInt) { #> + PrimitiveDataFrameColumnArithmetic.Instance.<#=method.MethodName#>(this, value); +<# } else { #> + PrimitiveDataFrameColumnArithmetic.Instance.<#=method.MethodName#>(this, right); +<# } #> + return this; + } + +<# } #> +<# } #> + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs new file mode 100644 index 0000000000..ad94de690e --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs @@ -0,0 +1,626 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + /// + /// PrimitiveDataFrameColumnContainer is just a store for the column data. APIs that want to change the data must be defined in PrimitiveDataFrameColumn + /// + /// + internal partial class PrimitiveColumnContainer : IEnumerable + where T : struct + { + public IList> Buffers = new List>(); + + // To keep the mapping simple, each buffer is mapped 1v1 to a nullBitMapBuffer + // A set bit implies a valid value. An unset bit => null value + public IList> NullBitMapBuffers = new List>(); + + // Need a way to differentiate between columns initialized with default values and those with null values in SetValidityBit + internal bool _modifyNullCountWhileIndexing = true; + + public PrimitiveColumnContainer(T[] values) + { + values = values ?? throw new ArgumentNullException(nameof(values)); + long length = values.LongLength; + DataFrameBuffer curBuffer; + if (Buffers.Count == 0) + { + curBuffer = new DataFrameBuffer(); + Buffers.Add(curBuffer); + NullBitMapBuffers.Add(new DataFrameBuffer()); + } + else + { + curBuffer = (DataFrameBuffer)Buffers[Buffers.Count - 1]; + } + for (long i = 0; i < length; i++) + { + if (curBuffer.Length == ReadOnlyDataFrameBuffer.MaxCapacity) + { + curBuffer = new DataFrameBuffer(); + Buffers.Add(curBuffer); + NullBitMapBuffers.Add(new DataFrameBuffer()); + } + curBuffer.Append(values[i]); + SetValidityBit(Length, true); + Length++; + } + } + + public PrimitiveColumnContainer(IEnumerable values) + { + values = values ?? throw new ArgumentNullException(nameof(values)); + foreach (T value in values) + { + Append(value); + } + } + public PrimitiveColumnContainer(IEnumerable values) + { + values = values ?? throw new ArgumentNullException(nameof(values)); + foreach (T? value in values) + { + Append(value); + } + } + + public PrimitiveColumnContainer(ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length, int nullCount) + { + ReadOnlyDataFrameBuffer dataBuffer; + if (buffer.IsEmpty) + { + DataFrameBuffer mutableBuffer = new DataFrameBuffer(); + mutableBuffer.EnsureCapacity(length); + mutableBuffer.Length = length; + mutableBuffer.RawSpan.Fill(default(T)); + dataBuffer = mutableBuffer; + } + else + { + dataBuffer = new ReadOnlyDataFrameBuffer(buffer, length); + } + Buffers.Add(dataBuffer); + int bitMapBufferLength = (length + 7) / 8; + ReadOnlyDataFrameBuffer nullDataFrameBuffer; + if (nullBitMap.IsEmpty) + { + if (nullCount != 0) + { + throw new ArgumentNullException(Strings.InconsistentNullBitMapAndNullCount, nameof(nullBitMap)); + } + if (!buffer.IsEmpty) + { + // Create a new bitMap with all the bits up to length set + var bitMap = new byte[bitMapBufferLength]; + bitMap.AsSpan().Fill(255); + int lastByte = 1 << (length - (bitMapBufferLength - 1) * 8); + bitMap[bitMapBufferLength - 1] = (byte)(lastByte - 1); + nullDataFrameBuffer = new DataFrameBuffer(bitMap, bitMapBufferLength); + } + else + { + nullDataFrameBuffer = new DataFrameBuffer(); + } + } + else + { + if (nullBitMap.Length < bitMapBufferLength) + { + throw new ArgumentException(Strings.InconsistentNullBitMapAndLength, nameof(nullBitMap)); + } + nullDataFrameBuffer = new ReadOnlyDataFrameBuffer(nullBitMap, bitMapBufferLength); + } + NullBitMapBuffers.Add(nullDataFrameBuffer); + Length = length; + NullCount = nullCount; + } + + public PrimitiveColumnContainer(long length = 0) + { + while (length > 0) + { + if (Buffers.Count == 0) + { + Buffers.Add(new DataFrameBuffer()); + NullBitMapBuffers.Add(new DataFrameBuffer()); + } + DataFrameBuffer lastBuffer = (DataFrameBuffer)Buffers[Buffers.Count - 1]; + if (lastBuffer.Length == ReadOnlyDataFrameBuffer.MaxCapacity) + { + lastBuffer = new DataFrameBuffer(); + Buffers.Add(lastBuffer); + NullBitMapBuffers.Add(new DataFrameBuffer()); + } + int allocatable = (int)Math.Min(length, ReadOnlyDataFrameBuffer.MaxCapacity); + lastBuffer.EnsureCapacity(allocatable); + DataFrameBuffer lastNullBitMapBuffer = (DataFrameBuffer)(NullBitMapBuffers[NullBitMapBuffers.Count - 1]); + int nullBufferAllocatable = (allocatable + 7) / 8; + lastNullBitMapBuffer.EnsureCapacity(nullBufferAllocatable); + lastBuffer.Length = allocatable; + lastNullBitMapBuffer.Length = nullBufferAllocatable; + length -= allocatable; + Length += lastBuffer.Length; + NullCount += lastBuffer.Length; + } + } + + public void Resize(long length) + { + if (length < Length) + throw new ArgumentException(Strings.CannotResizeDown, nameof(length)); + AppendMany(default, length - Length); + } + + public void Append(T? value) + { + if (Buffers.Count == 0) + { + Buffers.Add(new DataFrameBuffer()); + NullBitMapBuffers.Add(new DataFrameBuffer()); + } + int bufferIndex = Buffers.Count - 1; + ReadOnlyDataFrameBuffer lastBuffer = Buffers[bufferIndex]; + if (lastBuffer.Length == ReadOnlyDataFrameBuffer.MaxCapacity) + { + lastBuffer = new DataFrameBuffer(); + Buffers.Add(lastBuffer); + NullBitMapBuffers.Add(new DataFrameBuffer()); + } + DataFrameBuffer mutableLastBuffer = DataFrameBuffer.GetMutableBuffer(lastBuffer); + Buffers[bufferIndex] = mutableLastBuffer; + mutableLastBuffer.Append(value ?? default); + SetValidityBit(Length, value.HasValue); + Length++; + } + + public void AppendMany(T? value, long count) + { + if (!value.HasValue) + { + NullCount += count; + } + + while (count > 0) + { + if (Buffers.Count == 0) + { + Buffers.Add(new DataFrameBuffer()); + NullBitMapBuffers.Add(new DataFrameBuffer()); + } + int bufferIndex = Buffers.Count - 1; + ReadOnlyDataFrameBuffer lastBuffer = Buffers[bufferIndex]; + if (lastBuffer.Length == ReadOnlyDataFrameBuffer.MaxCapacity) + { + lastBuffer = new DataFrameBuffer(); + Buffers.Add(lastBuffer); + NullBitMapBuffers.Add(new DataFrameBuffer()); + } + DataFrameBuffer mutableLastBuffer = DataFrameBuffer.GetMutableBuffer(lastBuffer); + Buffers[bufferIndex] = mutableLastBuffer; + int allocatable = (int)Math.Min(count, ReadOnlyDataFrameBuffer.MaxCapacity); + mutableLastBuffer.EnsureCapacity(allocatable); + mutableLastBuffer.RawSpan.Slice(lastBuffer.Length, allocatable).Fill(value ?? default); + mutableLastBuffer.Length += allocatable; + Length += allocatable; + + int nullBitMapBufferIndex = NullBitMapBuffers.Count - 1; + ReadOnlyDataFrameBuffer lastNullBitMapBuffer = NullBitMapBuffers[nullBitMapBufferIndex]; + DataFrameBuffer mutableLastNullBitMapBuffer = DataFrameBuffer.GetMutableBuffer(lastNullBitMapBuffer); + NullBitMapBuffers[nullBitMapBufferIndex] = mutableLastNullBitMapBuffer; + int nullBitMapAllocatable = (int)(((uint)allocatable) / 8) + 1; + mutableLastNullBitMapBuffer.EnsureCapacity(nullBitMapAllocatable); + _modifyNullCountWhileIndexing = false; + for (long i = Length - count; i < Length; i++) + { + SetValidityBit(i, value.HasValue ? true : false); + } + _modifyNullCountWhileIndexing = true; + count -= allocatable; + } + } + + public void ApplyElementwise(Func func) + { + for (int b = 0; b < Buffers.Count; b++) + { + ReadOnlyDataFrameBuffer buffer = Buffers[b]; + long prevLength = checked(Buffers[0].Length * b); + DataFrameBuffer mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + Buffers[b] = mutableBuffer; + Span span = mutableBuffer.Span; + DataFrameBuffer mutableNullBitMapBuffer = DataFrameBuffer.GetMutableBuffer(NullBitMapBuffers[b]); + NullBitMapBuffers[b] = mutableNullBitMapBuffer; + Span nullBitMapSpan = mutableNullBitMapBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + long curIndex = i + prevLength; + bool isValid = IsValid(nullBitMapSpan, i); + T? value = func(isValid ? span[i] : default(T?), curIndex); + span[i] = value.GetValueOrDefault(); + SetValidityBit(nullBitMapSpan, i, value != null); + } + } + } + + // Faster to use when we already have a span since it avoids indexing + public bool IsValid(ReadOnlySpan bitMapBufferSpan, int index) + { + int nullBitMapSpanIndex = index / 8; + byte thisBitMap = bitMapBufferSpan[nullBitMapSpanIndex]; + return IsBitSet(thisBitMap, index); + } + + public bool IsValid(long index) => NullCount == 0 || GetValidityBit(index); + + private byte SetBit(byte curBitMap, int index, bool value) + { + byte newBitMap; + if (value) + { + newBitMap = (byte)(curBitMap | (byte)(1 << (index & 7))); //bit hack for index % 8 + if (_modifyNullCountWhileIndexing && ((curBitMap >> (index & 7)) & 1) == 0 && index < Length && NullCount > 0) + { + // Old value was null. + NullCount--; + } + } + else + { + if (_modifyNullCountWhileIndexing && ((curBitMap >> (index & 7)) & 1) == 1 && index < Length) + { + // old value was NOT null and new value is null + NullCount++; + } + else if (_modifyNullCountWhileIndexing && index == Length) + { + // New entry from an append + NullCount++; + } + newBitMap = (byte)(curBitMap & (byte)~(1 << (int)((uint)index & 7))); + } + return newBitMap; + } + + // private function. Faster to use when we already have a span since it avoids indexing + private void SetValidityBit(Span bitMapBufferSpan, int index, bool value) + { + int bitMapBufferIndex = (int)((uint)index / 8); + Debug.Assert(bitMapBufferSpan.Length >= bitMapBufferIndex); + byte curBitMap = bitMapBufferSpan[bitMapBufferIndex]; + byte newBitMap = SetBit(curBitMap, index, value); + bitMapBufferSpan[bitMapBufferIndex] = newBitMap; + } + + /// + /// A null value has an unset bit + /// A NON-null value has a set bit + /// + /// + /// + internal void SetValidityBit(long index, bool value) + { + if ((ulong)index > (ulong)Length) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + // First find the right bitMapBuffer + int bitMapIndex = (int)(index / ReadOnlyDataFrameBuffer.MaxCapacity); + Debug.Assert(NullBitMapBuffers.Count > bitMapIndex); + DataFrameBuffer bitMapBuffer = (DataFrameBuffer)NullBitMapBuffers[bitMapIndex]; + + // Set the bit + index -= bitMapIndex * ReadOnlyDataFrameBuffer.MaxCapacity; + int bitMapBufferIndex = (int)((uint)index / 8); + Debug.Assert(bitMapBuffer.Length >= bitMapBufferIndex); + if (bitMapBuffer.Length == bitMapBufferIndex) + bitMapBuffer.Append(0); + SetValidityBit(bitMapBuffer.Span, (int)index, value); + } + + private bool IsBitSet(byte curBitMap, int index) + { + return ((curBitMap >> (index & 7)) & 1) != 0; + } + + private bool GetValidityBit(long index) + { + if ((uint)index >= Length) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + // First find the right bitMapBuffer + int bitMapIndex = (int)(index / ReadOnlyDataFrameBuffer.MaxCapacity); + Debug.Assert(NullBitMapBuffers.Count > bitMapIndex); + ReadOnlyDataFrameBuffer bitMapBuffer = NullBitMapBuffers[bitMapIndex]; + + // Get the bit + index -= bitMapIndex * ReadOnlyDataFrameBuffer.MaxCapacity; + int bitMapBufferIndex = (int)((uint)index / 8); + Debug.Assert(bitMapBuffer.Length > bitMapBufferIndex); + byte curBitMap = bitMapBuffer[bitMapBufferIndex]; + return IsBitSet(curBitMap, (int)index); + } + + public long Length; + + public long NullCount; + public int GetArrayContainingRowIndex(long rowIndex) + { + if (rowIndex >= Length) + { + throw new ArgumentOutOfRangeException(Strings.ColumnIndexOutOfRange, nameof(rowIndex)); + } + return (int)(rowIndex / ReadOnlyDataFrameBuffer.MaxCapacity); + } + + internal int MaxRecordBatchLength(long startIndex) + { + if (Length == 0) + return 0; + int arrayIndex = GetArrayContainingRowIndex(startIndex); + startIndex = startIndex - arrayIndex * ReadOnlyDataFrameBuffer.MaxCapacity; + return Buffers[arrayIndex].Length - (int)startIndex; + } + + internal ReadOnlyMemory GetValueBuffer(long startIndex) + { + int arrayIndex = GetArrayContainingRowIndex(startIndex); + return Buffers[arrayIndex].ReadOnlyBuffer; + } + + internal ReadOnlyMemory GetNullBuffer(long startIndex) + { + int arrayIndex = GetArrayContainingRowIndex(startIndex); + return NullBitMapBuffers[arrayIndex].ReadOnlyBuffer; + } + + public IReadOnlyList this[long startIndex, int length] + { + get + { + var ret = new List(length); + long endIndex = Math.Min(Length, startIndex + length); + for (long i = startIndex; i < endIndex; i++) + { + ret.Add(this[i]); + } + return ret; + } + } + + public T? this[long rowIndex] + { + get + { + if (!IsValid(rowIndex)) + { + return null; + } + int arrayIndex = GetArrayContainingRowIndex(rowIndex); + rowIndex = rowIndex - arrayIndex * ReadOnlyDataFrameBuffer.MaxCapacity; + return Buffers[arrayIndex][(int)rowIndex]; + } + set + { + int arrayIndex = GetArrayContainingRowIndex(rowIndex); + rowIndex = rowIndex - arrayIndex * ReadOnlyDataFrameBuffer.MaxCapacity; + ReadOnlyDataFrameBuffer buffer = Buffers[arrayIndex]; + DataFrameBuffer mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + Buffers[arrayIndex] = mutableBuffer; + DataFrameBuffer mutableNullBuffer = DataFrameBuffer.GetMutableBuffer(NullBitMapBuffers[arrayIndex]); + NullBitMapBuffers[arrayIndex] = mutableNullBuffer; + if (value.HasValue) + { + Buffers[arrayIndex][(int)rowIndex] = value.Value; + SetValidityBit(rowIndex, true); + } + else + { + Buffers[arrayIndex][(int)rowIndex] = default; + SetValidityBit(rowIndex, false); + } + } + } + + public IEnumerator GetEnumerator() + { + for (long i = 0; i < Length; i++) + { + yield return this[i]; + } + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < Length; i++) + { + T? value = this[i]; + if (value.HasValue) + { + sb.Append(this[i]).Append(" "); + } + else + { + sb.Append("null").Append(" "); + } + // Can this run out of memory? Just being safe here + if (sb.Length > 1000) + { + sb.Append("..."); + break; + } + } + return sb.ToString(); + } + + private List> CloneNullBitMapBuffers() + { + List> ret = new List>(); + foreach (ReadOnlyDataFrameBuffer buffer in NullBitMapBuffers) + { + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Add(newBuffer); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(span[i]); + } + } + return ret; + } + + public PrimitiveColumnContainer Clone(PrimitiveColumnContainer mapIndices, Type type, bool invertMapIndices = false) + where U : unmanaged + { + ReadOnlySpan thisSpan = Buffers[0].ReadOnlySpan; + ReadOnlySpan thisNullBitMapSpan = NullBitMapBuffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = DataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + PrimitiveColumnContainer ret = new PrimitiveColumnContainer(mapIndices.Length); + for (int b = 0; b < mapIndices.Buffers.Count; b++) + { + int index = b; + if (invertMapIndices) + index = mapIndices.Buffers.Count - 1 - b; + + ReadOnlyDataFrameBuffer buffer = mapIndices.Buffers[index]; + ReadOnlySpan mapIndicesNullBitMapSpan = mapIndices.NullBitMapBuffers[index].ReadOnlySpan; + ReadOnlySpan mapIndicesSpan = buffer.ReadOnlySpan; + ReadOnlySpan mapIndicesLongSpan = default; + ReadOnlySpan mapIndicesIntSpan = default; + DataFrameBuffer mutableBuffer = DataFrameBuffer.GetMutableBuffer(ret.Buffers[index]); + ret.Buffers[index] = mutableBuffer; + Span retSpan = mutableBuffer.Span; + DataFrameBuffer mutableNullBuffer = DataFrameBuffer.GetMutableBuffer(ret.NullBitMapBuffers[index]); + ret.NullBitMapBuffers[index] = mutableNullBuffer; + Span retNullBitMapSpan = mutableNullBuffer.Span; + if (type == typeof(long)) + { + mapIndicesLongSpan = MemoryMarshal.Cast(mapIndicesSpan); + } + if (type == typeof(int)) + { + mapIndicesIntSpan = MemoryMarshal.Cast(mapIndicesSpan); + } + for (int i = 0; i < buffer.Length; i++) + { + int spanIndex = i; + if (invertMapIndices) + spanIndex = buffer.Length - 1 - i; + + long mapRowIndex = mapIndicesIntSpan.IsEmpty ? mapIndicesLongSpan[spanIndex] : mapIndicesIntSpan[spanIndex]; + bool mapRowIndexIsValid = mapIndices.IsValid(mapIndicesNullBitMapSpan, spanIndex); + if (mapRowIndexIsValid && (mapRowIndex < minRange || mapRowIndex >= maxRange)) + { + int bufferIndex = (int)(mapRowIndex / maxCapacity); + thisSpan = Buffers[bufferIndex].ReadOnlySpan; + thisNullBitMapSpan = NullBitMapBuffers[bufferIndex].ReadOnlySpan; + minRange = bufferIndex * maxCapacity; + maxRange = (bufferIndex + 1) * maxCapacity; + } + T value = default; + bool isValid = false; + if (mapRowIndexIsValid) + { + mapRowIndex -= minRange; + value = thisSpan[(int)mapRowIndex]; + isValid = IsValid(thisNullBitMapSpan, (int)mapRowIndex); + } + + retSpan[i] = isValid ? value : default; + ret.SetValidityBit(retNullBitMapSpan, i, isValid); + } + } + return ret; + } + + public PrimitiveColumnContainer Clone() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + ReadOnlySpan span = buffer.ReadOnlySpan; + ret.Length += buffer.Length; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(span[i]); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsBoolContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + newBuffer.Span.Fill(false); + newBuffer.Length = buffer.Length; + ret.Length += buffer.Length; + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsDoubleContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(DoubleConverter.Instance.GetDouble(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsDecimalContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(DecimalConverter.Instance.GetDecimal(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs new file mode 100644 index 0000000000..d30ab798a1 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs @@ -0,0 +1,2472 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumn.BinaryOperations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class PrimitiveDataFrameColumn : DataFrameColumn + where T : unmanaged + { + public override DataFrameColumn Add(DataFrameColumn column, bool inPlace = false) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn byteColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn charColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn decimalColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn doubleColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn floatColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn intColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn longColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn sbyteColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn shortColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn uintColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ulongColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ushortColumn: + return AddImplementation(column as PrimitiveDataFrameColumn, inPlace); + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn Add(U value, bool inPlace = false) + { + return AddImplementation(value, inPlace); + } + public override DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = false) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn byteColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn charColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn decimalColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn doubleColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn floatColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn intColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn longColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn sbyteColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn shortColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn uintColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ulongColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ushortColumn: + return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace); + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn Subtract(U value, bool inPlace = false) + { + return SubtractImplementation(value, inPlace); + } + public override DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = false) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn byteColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn charColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn decimalColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn doubleColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn floatColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn intColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn longColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn sbyteColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn shortColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn uintColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ulongColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ushortColumn: + return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace); + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn Multiply(U value, bool inPlace = false) + { + return MultiplyImplementation(value, inPlace); + } + public override DataFrameColumn Divide(DataFrameColumn column, bool inPlace = false) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn byteColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn charColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn decimalColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn doubleColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn floatColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn intColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn longColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn sbyteColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn shortColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn uintColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ulongColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ushortColumn: + return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace); + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn Divide(U value, bool inPlace = false) + { + return DivideImplementation(value, inPlace); + } + public override DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = false) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn byteColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn charColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn decimalColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn doubleColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn floatColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn intColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn longColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn sbyteColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn shortColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn uintColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ulongColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ushortColumn: + return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace); + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn Modulo(U value, bool inPlace = false) + { + return ModuloImplementation(value, inPlace); + } + public override DataFrameColumn And(DataFrameColumn column, bool inPlace = false) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn byteColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn charColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn decimalColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn doubleColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn floatColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn intColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn longColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn sbyteColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn shortColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn uintColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ulongColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ushortColumn: + return AndImplementation(column as PrimitiveDataFrameColumn, inPlace); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn And(bool value, bool inPlace = false) + { + return AndImplementation(value, inPlace); + } + public override DataFrameColumn Or(DataFrameColumn column, bool inPlace = false) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn byteColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn charColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn decimalColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn doubleColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn floatColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn intColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn longColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn sbyteColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn shortColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn uintColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ulongColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ushortColumn: + return OrImplementation(column as PrimitiveDataFrameColumn, inPlace); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn Or(bool value, bool inPlace = false) + { + return OrImplementation(value, inPlace); + } + public override DataFrameColumn Xor(DataFrameColumn column, bool inPlace = false) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn byteColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn charColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn decimalColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn doubleColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn floatColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn intColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn longColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn sbyteColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn shortColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn uintColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ulongColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + case PrimitiveDataFrameColumn ushortColumn: + return XorImplementation(column as PrimitiveDataFrameColumn, inPlace); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn Xor(bool value, bool inPlace = false) + { + return XorImplementation(value, inPlace); + } + public override DataFrameColumn LeftShift(int value, bool inPlace = false) + { + return LeftShiftImplementation(value, inPlace); + } + public override DataFrameColumn RightShift(int value, bool inPlace = false) + { + return RightShiftImplementation(value, inPlace); + } + public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn column) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn byteColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn charColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn decimalColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn doubleColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn floatColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn intColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn longColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn sbyteColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn shortColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn uintColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ulongColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ushortColumn: + return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn ElementwiseEquals(U value) + { + return ElementwiseEqualsImplementation(value); + } + public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn byteColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn charColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn decimalColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn doubleColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn floatColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn intColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn longColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn sbyteColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn shortColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn uintColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ulongColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ushortColumn: + return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn ElementwiseNotEquals(U value) + { + return ElementwiseNotEqualsImplementation(value); + } + public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(DataFrameColumn column) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn byteColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn charColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn decimalColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn doubleColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn floatColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn intColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn longColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn sbyteColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn shortColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn uintColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ulongColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ushortColumn: + return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(U value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFrameColumn column) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn byteColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn charColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn decimalColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn doubleColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn floatColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn intColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn longColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn sbyteColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn shortColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn uintColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ulongColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ushortColumn: + return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(U value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public override PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameColumn column) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn byteColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn charColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn decimalColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn doubleColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn floatColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn intColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn longColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn sbyteColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn shortColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn uintColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ulongColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ushortColumn: + return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn ElementwiseGreaterThan(U value) + { + return ElementwiseGreaterThanImplementation(value); + } + public override PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColumn column) + { + switch (column) + { + case PrimitiveDataFrameColumn boolColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn byteColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn charColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn decimalColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn doubleColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn floatColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn intColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn longColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn sbyteColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn shortColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn uintColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ulongColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + case PrimitiveDataFrameColumn ushortColumn: + return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn); + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn ElementwiseLessThan(U value) + { + return ElementwiseLessThanImplementation(value); + } + + internal DataFrameColumn AddImplementation(PrimitiveDataFrameColumn column, bool inPlace) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Add(column._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Add(column.CloneAsDecimalColumn()._columnContainer); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Add(column._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Add((column as PrimitiveDataFrameColumn)._columnContainer); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Add(column.CloneAsDoubleColumn()._columnContainer); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn AddImplementation(U value, bool inPlace) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Add(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Add(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Add(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Add(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Add(DoubleConverter.Instance.GetDouble(value)); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn SubtractImplementation(PrimitiveDataFrameColumn column, bool inPlace) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Subtract(column._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Subtract(column.CloneAsDecimalColumn()._columnContainer); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Subtract(column._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Subtract((column as PrimitiveDataFrameColumn)._columnContainer); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Subtract(column.CloneAsDoubleColumn()._columnContainer); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn SubtractImplementation(U value, bool inPlace) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Subtract(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Subtract(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Subtract(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Subtract(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Subtract(DoubleConverter.Instance.GetDouble(value)); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn MultiplyImplementation(PrimitiveDataFrameColumn column, bool inPlace) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Multiply(column._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Multiply(column.CloneAsDecimalColumn()._columnContainer); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Multiply(column._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Multiply((column as PrimitiveDataFrameColumn)._columnContainer); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Multiply(column.CloneAsDoubleColumn()._columnContainer); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn MultiplyImplementation(U value, bool inPlace) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Multiply(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Multiply(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Multiply(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Multiply(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Multiply(DoubleConverter.Instance.GetDouble(value)); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn DivideImplementation(PrimitiveDataFrameColumn column, bool inPlace) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Divide(column._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Divide(column.CloneAsDecimalColumn()._columnContainer); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Divide(column._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Divide((column as PrimitiveDataFrameColumn)._columnContainer); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Divide(column.CloneAsDoubleColumn()._columnContainer); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn DivideImplementation(U value, bool inPlace) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Divide(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Divide(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Divide(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Divide(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Divide(DoubleConverter.Instance.GetDouble(value)); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn ModuloImplementation(PrimitiveDataFrameColumn column, bool inPlace) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Modulo(column._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Modulo(column.CloneAsDecimalColumn()._columnContainer); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Modulo(column._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Modulo((column as PrimitiveDataFrameColumn)._columnContainer); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Modulo(column.CloneAsDoubleColumn()._columnContainer); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn ModuloImplementation(U value, bool inPlace) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Modulo(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Modulo(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Modulo(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Modulo(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.Modulo(DoubleConverter.Instance.GetDouble(value)); + return doubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn AndImplementation(PrimitiveDataFrameColumn column, bool inPlace) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.And(column._columnContainer); + return retColumn; + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type decimalType when decimalType == typeof(decimal): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn AndImplementation(U value, bool inPlace) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.And(value); + return retColumn as PrimitiveDataFrameColumn; + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type decimalType when decimalType == typeof(decimal): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn OrImplementation(PrimitiveDataFrameColumn column, bool inPlace) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.Or(column._columnContainer); + return retColumn; + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type decimalType when decimalType == typeof(decimal): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn OrImplementation(U value, bool inPlace) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.Or(value); + return retColumn as PrimitiveDataFrameColumn; + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type decimalType when decimalType == typeof(decimal): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn XorImplementation(PrimitiveDataFrameColumn column, bool inPlace) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.Xor(column._columnContainer); + return retColumn; + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type decimalType when decimalType == typeof(decimal): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn XorImplementation(U value, bool inPlace) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.Xor(value); + return retColumn as PrimitiveDataFrameColumn; + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type decimalType when decimalType == typeof(decimal): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn LeftShiftImplementation(int value, bool inPlace) + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type byteType when byteType == typeof(byte): + PrimitiveDataFrameColumn byteColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newbyteColumn = inPlace ? byteColumn : byteColumn.Clone(); + newbyteColumn._columnContainer.LeftShift(value); + return newbyteColumn; + case Type charType when charType == typeof(char): + PrimitiveDataFrameColumn charColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newcharColumn = inPlace ? charColumn : charColumn.Clone(); + newcharColumn._columnContainer.LeftShift(value); + return newcharColumn; + case Type decimalType when decimalType == typeof(decimal): + throw new NotSupportedException(); + case Type doubleType when doubleType == typeof(double): + throw new NotSupportedException(); + case Type floatType when floatType == typeof(float): + throw new NotSupportedException(); + case Type intType when intType == typeof(int): + PrimitiveDataFrameColumn intColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newintColumn = inPlace ? intColumn : intColumn.Clone(); + newintColumn._columnContainer.LeftShift(value); + return newintColumn; + case Type longType when longType == typeof(long): + PrimitiveDataFrameColumn longColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newlongColumn = inPlace ? longColumn : longColumn.Clone(); + newlongColumn._columnContainer.LeftShift(value); + return newlongColumn; + case Type sbyteType when sbyteType == typeof(sbyte): + PrimitiveDataFrameColumn sbyteColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newsbyteColumn = inPlace ? sbyteColumn : sbyteColumn.Clone(); + newsbyteColumn._columnContainer.LeftShift(value); + return newsbyteColumn; + case Type shortType when shortType == typeof(short): + PrimitiveDataFrameColumn shortColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newshortColumn = inPlace ? shortColumn : shortColumn.Clone(); + newshortColumn._columnContainer.LeftShift(value); + return newshortColumn; + case Type uintType when uintType == typeof(uint): + PrimitiveDataFrameColumn uintColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newuintColumn = inPlace ? uintColumn : uintColumn.Clone(); + newuintColumn._columnContainer.LeftShift(value); + return newuintColumn; + case Type ulongType when ulongType == typeof(ulong): + PrimitiveDataFrameColumn ulongColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newulongColumn = inPlace ? ulongColumn : ulongColumn.Clone(); + newulongColumn._columnContainer.LeftShift(value); + return newulongColumn; + case Type ushortType when ushortType == typeof(ushort): + PrimitiveDataFrameColumn ushortColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newushortColumn = inPlace ? ushortColumn : ushortColumn.Clone(); + newushortColumn._columnContainer.LeftShift(value); + return newushortColumn; + default: + throw new NotSupportedException(); + } + } + internal DataFrameColumn RightShiftImplementation(int value, bool inPlace) + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type byteType when byteType == typeof(byte): + PrimitiveDataFrameColumn byteColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newbyteColumn = inPlace ? byteColumn : byteColumn.Clone(); + newbyteColumn._columnContainer.RightShift(value); + return newbyteColumn; + case Type charType when charType == typeof(char): + PrimitiveDataFrameColumn charColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newcharColumn = inPlace ? charColumn : charColumn.Clone(); + newcharColumn._columnContainer.RightShift(value); + return newcharColumn; + case Type decimalType when decimalType == typeof(decimal): + throw new NotSupportedException(); + case Type doubleType when doubleType == typeof(double): + throw new NotSupportedException(); + case Type floatType when floatType == typeof(float): + throw new NotSupportedException(); + case Type intType when intType == typeof(int): + PrimitiveDataFrameColumn intColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newintColumn = inPlace ? intColumn : intColumn.Clone(); + newintColumn._columnContainer.RightShift(value); + return newintColumn; + case Type longType when longType == typeof(long): + PrimitiveDataFrameColumn longColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newlongColumn = inPlace ? longColumn : longColumn.Clone(); + newlongColumn._columnContainer.RightShift(value); + return newlongColumn; + case Type sbyteType when sbyteType == typeof(sbyte): + PrimitiveDataFrameColumn sbyteColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newsbyteColumn = inPlace ? sbyteColumn : sbyteColumn.Clone(); + newsbyteColumn._columnContainer.RightShift(value); + return newsbyteColumn; + case Type shortType when shortType == typeof(short): + PrimitiveDataFrameColumn shortColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newshortColumn = inPlace ? shortColumn : shortColumn.Clone(); + newshortColumn._columnContainer.RightShift(value); + return newshortColumn; + case Type uintType when uintType == typeof(uint): + PrimitiveDataFrameColumn uintColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newuintColumn = inPlace ? uintColumn : uintColumn.Clone(); + newuintColumn._columnContainer.RightShift(value); + return newuintColumn; + case Type ulongType when ulongType == typeof(ulong): + PrimitiveDataFrameColumn ulongColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newulongColumn = inPlace ? ulongColumn : ulongColumn.Clone(); + newulongColumn._columnContainer.RightShift(value); + return newulongColumn; + case Type ushortType when ushortType == typeof(ushort): + PrimitiveDataFrameColumn ushortColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newushortColumn = inPlace ? ushortColumn : ushortColumn.Clone(); + newushortColumn._columnContainer.RightShift(value); + return newushortColumn; + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(PrimitiveDataFrameColumn column) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(column._columnContainer, retColumn._columnContainer); + return retColumn; + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseEquals(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseEquals(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseEquals(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseEquals((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseEquals(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U value) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(value, retColumn._columnContainer); + return retColumn; + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseEquals(value, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseEquals(value, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseEquals(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(PrimitiveDataFrameColumn column) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(column._columnContainer, retColumn._columnContainer); + return retColumn; + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseNotEquals(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseNotEquals(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseNotEquals(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseNotEquals((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseNotEquals(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U value) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } + PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(value, retColumn._columnContainer); + return retColumn; + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseNotEquals(value, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseNotEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseNotEquals(value, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseNotEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseNotEquals(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(PrimitiveDataFrameColumn column) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseGreaterThanOrEqual(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(U value) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(value, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(value, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseGreaterThanOrEqual(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation(PrimitiveDataFrameColumn column) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseLessThanOrEqual(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseLessThanOrEqual((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseLessThanOrEqual(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation(U value) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(value, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseLessThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(value, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseLessThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseLessThanOrEqual(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation(PrimitiveDataFrameColumn column) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseGreaterThan(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseGreaterThan(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseGreaterThan(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseGreaterThan((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseGreaterThan(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation(U value) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseGreaterThan(value, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseGreaterThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseGreaterThan(value, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseGreaterThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseGreaterThan(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(PrimitiveDataFrameColumn column) + where U : unmanaged + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseLessThan(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseLessThan(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseLessThan(column._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseLessThan((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseLessThan(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(U value) + where U : unmanaged + { + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + throw new NotSupportedException(); + case Type decimalType when decimalType == typeof(decimal): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseLessThan(value, newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseLessThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.ElementwiseLessThan(value, newColumn._columnContainer); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ElementwiseLessThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; + } + else + { + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.ElementwiseLessThan(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); + return newColumn; + } + } + default: + throw new NotSupportedException(); + } + } + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt new file mode 100644 index 0000000000..98568b945b --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt @@ -0,0 +1,338 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumn.BinaryOperations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class PrimitiveDataFrameColumn : DataFrameColumn + where T : unmanaged + { +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.Binary || method.MethodType == MethodType.Comparison) {#> +<# if (method.MethodType == MethodType.Binary) {#> + public override DataFrameColumn <#=method.MethodName#>(DataFrameColumn column, bool inPlace = false) +<# } else { #> + public override PrimitiveDataFrameColumn <#=method.MethodName#>(DataFrameColumn column) +<# } #> + { + switch (column) + { +<# foreach (TypeConfiguration type in typeConfiguration) { #> + case PrimitiveDataFrameColumn<<#=type.TypeName#>> <#=type.TypeName#>Column: +<# if (method.MethodType == MethodType.Binary) {#> + return <#=method.MethodName#>Implementation(column as PrimitiveDataFrameColumn<<#=type.TypeName#>>, inPlace); +<# } else { #> + return <#=method.MethodName#>Implementation(column as PrimitiveDataFrameColumn<<#=type.TypeName#>>); +<# } #> +<# } #> + default: + throw new NotSupportedException(); + } + } +<# } #> +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.ComparisonScalar) {#> +<# if (method.MethodType == MethodType.BinaryScalar) {#> +<# if (method.IsBitwise == true) { #> + public override PrimitiveDataFrameColumn <#=method.MethodName#>(bool value, bool inPlace = false) +<# } else { #> + public override DataFrameColumn <#=method.MethodName#>(U value, bool inPlace = false) +<# } #> +<# } else {#> + public override PrimitiveDataFrameColumn <#=method.MethodName#>(U value) +<# } #> + { +<# if (method.MethodType == MethodType.BinaryScalar) {#> + return <#=method.MethodName#>Implementation(value, inPlace); +<# } else {#> + return <#=method.MethodName#>Implementation(value); +<# } #> + } +<# } #> +<# if (method.MethodType == MethodType.BinaryInt ) {#> + public override DataFrameColumn <#=method.MethodName#>(int value, bool inPlace = false) + { + return <#=method.MethodName#>Implementation(value, inPlace); + } +<# } #> +<# } #> + +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.ComparisonScalar) {#> +<# if (method.MethodType == MethodType.BinaryScalar) {#> +<# if (method.IsBitwise == true) { #> + internal PrimitiveDataFrameColumn <#=method.MethodName#>Implementation(U value, bool inPlace) +<# } else { #> + internal DataFrameColumn <#=method.MethodName#>Implementation(U value, bool inPlace) +<# } #> +<# } else {#> + internal PrimitiveDataFrameColumn <#=method.MethodName#>Implementation(U value) +<# } #> + where U : unmanaged +<# } #> +<# if (method.MethodType == MethodType.Binary || method.MethodType == MethodType.Comparison) {#> +<# if (method.MethodType == MethodType.Binary) {#> + internal DataFrameColumn <#=method.MethodName#>Implementation(PrimitiveDataFrameColumn column, bool inPlace) +<# } else { #> + internal PrimitiveDataFrameColumn <#=method.MethodName#>Implementation(PrimitiveDataFrameColumn column) +<# } #> + where U : unmanaged +<# } #> +<# if (method.MethodType == MethodType.BinaryInt ) {#> + internal DataFrameColumn <#=method.MethodName#>Implementation(int value, bool inPlace) +<# } #> + { +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.BinaryInt) {#> +<# } else { #> + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } +<# } #> +<# if (method.MethodType == MethodType.BinaryInt ) {#> + switch (typeof(T)) + { +<# foreach (TypeConfiguration type in typeConfiguration) { #> + case Type <#=type.TypeName#>Type when <#=type.TypeName#>Type == typeof(<#=type.TypeName#>): +<# if (type.TypeName == "bool" || type.SupportsBitwise == false) { #> + throw new NotSupportedException(); +<# } else { #> + PrimitiveDataFrameColumn<<#=type.TypeName#>> <#=type.TypeName#>Column = this as PrimitiveDataFrameColumn<<#=type.TypeName#>>; + PrimitiveDataFrameColumn<<#=type.TypeName#>> new<#=type.TypeName#>Column = inPlace ? <#=type.TypeName#>Column : <#=type.TypeName#>Column.Clone(); + new<#=type.TypeName#>Column._columnContainer.<#=method.MethodName#>(value); + return new<#=type.TypeName#>Column; +<# } #> +<# } #> + default: + throw new NotSupportedException(); + } +<# } else if (method.IsBitwise == true && method.IsNumeric == false) { #> + switch (typeof(T)) + { + case Type boolType when boolType == typeof(bool): + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } +<# if (method.MethodType == MethodType.BinaryScalar) {#> + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = <#=GenerateInPlaceStatement("typedColumn", "typedColumn.Clone()")#>; + retColumn._columnContainer.<#=method.MethodName#>(value); + return retColumn as PrimitiveDataFrameColumn; +<# } else { #> + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = <#=GenerateInPlaceStatement("typedColumn", "typedColumn.Clone()")#>; + retColumn._columnContainer.<#=method.MethodName#>(column._columnContainer); + return retColumn; +<# } #> +<# foreach (TypeConfiguration type in typeConfiguration) { #> +<# if (type.TypeName == "bool") { #> +<# } else { #> + case Type <#=type.TypeName#>Type when <#=type.TypeName#>Type == typeof(<#=type.TypeName#>): +<# } #> +<# } #> + default: + throw new NotSupportedException(); + } +<# } else { #> + switch (typeof(T)) + { +<# foreach (TypeConfiguration type in typeConfiguration) { #> +<# if (type.TypeName == "bool") { #> + case Type <#=type.TypeName#>Type when <#=type.TypeName#>Type == typeof(<#=type.TypeName#>): +<# if (method.IsNumeric == true) { #> + throw new NotSupportedException(); +<# } else { #> + if (typeof(U) != typeof(bool)) + { + throw new NotSupportedException(); + } +<# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> + PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); +<# if (method.MethodType == MethodType.ComparisonScalar) { #> + (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(value, retColumn._columnContainer); +<# } else { #> + (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(column._columnContainer, retColumn._columnContainer); +<# } #> +<# } else if (method.MethodType == MethodType.BinaryScalar) {#> + PrimitiveDataFrameColumn column = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = <#=GenerateInPlaceStatement("column", "column.Clone()")#>; + retColumn._columnContainer.<#=method.MethodName#>(value); +<# } else { #> + PrimitiveDataFrameColumn column = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = <#=GenerateInPlaceStatement("column", "column.Clone()")#>; + retColumn._columnContainer.<#=method.MethodName#>(column._columnContainer); +<# } #> + return retColumn; +<# } #> +<# } else if (type.TypeName == "decimal") { #> + case Type <#=type.TypeName#>Type when <#=type.TypeName#>Type == typeof(<#=type.TypeName#>): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; +<# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); +<# if (method.MethodType == MethodType.ComparisonScalar) { #> + primitiveColumn._columnContainer.<#=method.MethodName#>(value, newColumn._columnContainer); + return newColumn; +<# } else { #> + primitiveColumn._columnContainer.<#=method.MethodName#>(column._columnContainer, newColumn._columnContainer); + return newColumn; +<# } #> +<# } else if (method.IsBitwise == true ) { #> + throw new NotSupportedException(); +<# } else if (method.MethodType == MethodType.BinaryScalar ) { #> + PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; + newColumn._columnContainer.<#=method.MethodName#>(value); + return newColumn; +<# } else { #> + PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; + newColumn._columnContainer.<#=method.MethodName#>(column._columnContainer); + return newColumn; +<# } #> + } + else + { +<# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); +<# if (method.MethodType == MethodType.ComparisonScalar) { #> + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; +<# } else { #> + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.<#=method.MethodName#>(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); + return newColumn; +<# } #> +<# } else if (method.IsBitwise == true) { #> + throw new NotSupportedException(); +<# } else if (method.MethodType == MethodType.BinaryScalar) { #> + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; +<# } else { #> + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.<#=method.MethodName#>(column.CloneAsDecimalColumn()._columnContainer); + return decimalColumn; +<# } #> + } +<# } else { #> +<# } #> +<# } #> + case Type byteType when byteType == typeof(byte): + case Type charType when charType == typeof(char): + case Type doubleType when doubleType == typeof(double): + case Type floatType when floatType == typeof(float): + case Type intType when intType == typeof(int): + case Type longType when longType == typeof(long): + case Type sbyteType when sbyteType == typeof(sbyte): + case Type shortType when shortType == typeof(short): + case Type uintType when uintType == typeof(uint): + case Type ulongType when ulongType == typeof(ulong): + case Type ushortType when ushortType == typeof(ushort): + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; +<# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); +<# if (method.MethodType == MethodType.ComparisonScalar) { #> + primitiveColumn._columnContainer.<#=method.MethodName#>(value, newColumn._columnContainer); + return newColumn; +<# } else { #> + primitiveColumn._columnContainer.<#=method.MethodName#>(column._columnContainer, newColumn._columnContainer); + return newColumn; +<# } #> +<# } else if (method.IsBitwise == true ) { #> + throw new NotSupportedException(); +<# } else if (method.MethodType == MethodType.BinaryScalar ) { #> + PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; + newColumn._columnContainer.<#=method.MethodName#>(value); + return newColumn; +<# } else { #> + PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; + newColumn._columnContainer.<#=method.MethodName#>(column._columnContainer); + return newColumn; +<# } #> + } + else + { + if (typeof(U) == typeof(decimal)) + { +<# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); +<# if (method.MethodType == MethodType.ComparisonScalar) { #> + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); + return newColumn; +<# } else { #> + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.<#=method.MethodName#>((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); + return newColumn; +<# } #> +<# } else if (method.IsBitwise == true) { #> + throw new NotSupportedException(); +<# } else if (method.MethodType == MethodType.BinaryScalar) { #> + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; +<# } else { #> + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.<#=method.MethodName#>((column as PrimitiveDataFrameColumn)._columnContainer); + return decimalColumn; +<# } #> + } + else + { +<# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); +<# if (method.MethodType == MethodType.ComparisonScalar) { #> + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.<#=method.MethodName#>(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); + return newColumn; +<# } else { #> + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.<#=method.MethodName#>(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); + return newColumn; +<# } #> +<# } else if (method.IsBitwise == true) { #> + throw new NotSupportedException(); +<# } else if (method.MethodType == MethodType.BinaryScalar ) { #> + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.<#=method.MethodName#>(DoubleConverter.Instance.GetDouble(value)); + return doubleColumn; +<# } else { #> + PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + doubleColumn._columnContainer.<#=method.MethodName#>(column.CloneAsDoubleColumn()._columnContainer); + return doubleColumn; +<# } #> + } + } + default: + throw new NotSupportedException(); + } +<# } #> + } +<# } #> + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.cs new file mode 100644 index 0000000000..2907d01b62 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.cs @@ -0,0 +1,129 @@ + + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumn.Computations.tt. Do not modify directly + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class PrimitiveDataFrameColumn : DataFrameColumn + where T : unmanaged + { + public override DataFrameColumn Abs(bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.Abs(ret._columnContainer); + return ret; + } + public override bool All() + { + PrimitiveColumnComputation.Instance.All(_columnContainer, out bool ret); + return ret; + } + public override bool Any() + { + PrimitiveColumnComputation.Instance.Any(_columnContainer, out bool ret); + return ret; + } + public override DataFrameColumn CumulativeMax(bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.CumulativeMax(ret._columnContainer); + return ret; + } + public override DataFrameColumn CumulativeMax(IEnumerable rowIndices, bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.CumulativeMax(ret._columnContainer, rowIndices); + return ret; + } + public override DataFrameColumn CumulativeMin(bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.CumulativeMin(ret._columnContainer); + return ret; + } + public override DataFrameColumn CumulativeMin(IEnumerable rowIndices, bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.CumulativeMin(ret._columnContainer, rowIndices); + return ret; + } + public override DataFrameColumn CumulativeProduct(bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.CumulativeProduct(ret._columnContainer); + return ret; + } + public override DataFrameColumn CumulativeProduct(IEnumerable rowIndices, bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.CumulativeProduct(ret._columnContainer, rowIndices); + return ret; + } + public override DataFrameColumn CumulativeSum(bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.CumulativeSum(ret._columnContainer); + return ret; + } + public override DataFrameColumn CumulativeSum(IEnumerable rowIndices, bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.CumulativeSum(ret._columnContainer, rowIndices); + return ret; + } + public override object Max() + { + PrimitiveColumnComputation.Instance.Max(_columnContainer, out T ret); + return ret; + } + public override object Max(IEnumerable rowIndices) + { + PrimitiveColumnComputation.Instance.Max(_columnContainer, rowIndices, out T ret); + return ret; + } + public override object Min() + { + PrimitiveColumnComputation.Instance.Min(_columnContainer, out T ret); + return ret; + } + public override object Min(IEnumerable rowIndices) + { + PrimitiveColumnComputation.Instance.Min(_columnContainer, rowIndices, out T ret); + return ret; + } + public override object Product() + { + PrimitiveColumnComputation.Instance.Product(_columnContainer, out T ret); + return ret; + } + public override object Product(IEnumerable rowIndices) + { + PrimitiveColumnComputation.Instance.Product(_columnContainer, rowIndices, out T ret); + return ret; + } + public override object Sum() + { + PrimitiveColumnComputation.Instance.Sum(_columnContainer, out T ret); + return ret; + } + public override object Sum(IEnumerable rowIndices) + { + PrimitiveColumnComputation.Instance.Sum(_columnContainer, rowIndices, out T ret); + return ret; + } + public override DataFrameColumn Round(bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + PrimitiveColumnComputation.Instance.Round(ret._columnContainer); + return ret; + } + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.tt new file mode 100644 index 0000000000..588822e48b --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.tt @@ -0,0 +1,63 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumn.Computations.tt. Do not modify directly + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class PrimitiveDataFrameColumn : DataFrameColumn + where T : unmanaged + { +<# foreach (MethodConfiguration compMethod in computationMethodConfiguration) { #> +<# if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false && compMethod.SupportsRowSubsets == true) {#> + public override DataFrameColumn <#=compMethod.MethodName#>(IEnumerable rowIndices, bool inPlace = false) +<# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false) {#> + public override DataFrameColumn <#=compMethod.MethodName#>(bool inPlace = false) +<# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == true) {#> + public override object <#=compMethod.MethodName#>() +<# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true && compMethod.SupportsRowSubsets == true) { #> + public override object <#=compMethod.MethodName#>(IEnumerable rowIndices) +<# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true) { #> + public override object <#=compMethod.MethodName#>() +<# } else { #> + public override bool <#=compMethod.MethodName#>() +<# } #> + { +<# if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false && compMethod.SupportsRowSubsets == true) {#> + PrimitiveDataFrameColumn ret = <#=GenerateInPlaceStatement("this", "Clone()")#>; + PrimitiveColumnComputation.Instance.<#=compMethod.MethodName#>(ret._columnContainer, rowIndices); + return ret; +<# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false) {#> + PrimitiveDataFrameColumn ret = <#=GenerateInPlaceStatement("this", "Clone()")#>; + PrimitiveColumnComputation.Instance.<#=compMethod.MethodName#>(ret._columnContainer); + return ret; +<# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == true) {#> + PrimitiveColumnComputation.Instance.<#=compMethod.MethodName#>(_columnContainer, out T ret); + return ret; +<# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true && compMethod.SupportsRowSubsets == true) { #> + PrimitiveColumnComputation.Instance.<#=compMethod.MethodName#>(_columnContainer, rowIndices, out T ret); + return ret; +<# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true) { #> + PrimitiveColumnComputation.Instance.<#=compMethod.MethodName#>(_columnContainer, out T ret); + return ret; +<# } else { #> + PrimitiveColumnComputation.Instance.<#=compMethod.MethodName#>(_columnContainer, out bool ret); + return ret; +<# } #> + } +<# } #> + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Sort.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Sort.cs new file mode 100644 index 0000000000..51b2729226 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Sort.cs @@ -0,0 +1,101 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Data.Analysis +{ + public partial class PrimitiveDataFrameColumn : DataFrameColumn + where T : unmanaged + { + public new PrimitiveDataFrameColumn Sort(bool ascending = true) + { + PrimitiveDataFrameColumn sortIndices = GetAscendingSortIndices(); + return Clone(sortIndices, !ascending, NullCount); + } + + internal override PrimitiveDataFrameColumn GetAscendingSortIndices() + { + // The return sortIndices contains only the non null indices. + GetSortIndices(Comparer.Default, out PrimitiveDataFrameColumn sortIndices); + return sortIndices; + } + + private void GetSortIndices(IComparer comparer, out PrimitiveDataFrameColumn columnSortIndices) + { + List> bufferSortIndices = new List>(_columnContainer.Buffers.Count); + // Sort each buffer first + for (int b = 0; b < _columnContainer.Buffers.Count; b++) + { + ReadOnlyDataFrameBuffer buffer = _columnContainer.Buffers[b]; + ReadOnlySpan nullBitMapSpan = _columnContainer.NullBitMapBuffers[b].ReadOnlySpan; + int[] sortIndices = new int[buffer.Length]; + for (int i = 0; i < buffer.Length; i++) + sortIndices[i] = i; + IntrospectiveSort(buffer.ReadOnlySpan, buffer.Length, sortIndices, comparer); + // Bug fix: QuickSort is not stable. When PrimitiveDataFrameColumn has null values and default values, they move around + List nonNullSortIndices = new List(); + for (int i = 0; i < sortIndices.Length; i++) + { + if (_columnContainer.IsValid(nullBitMapSpan, sortIndices[i])) + nonNullSortIndices.Add(sortIndices[i]); + + } + bufferSortIndices.Add(nonNullSortIndices); + } + // Simple merge sort to build the full column's sort indices + ValueTuple GetFirstNonNullValueAndBufferIndexStartingAtIndex(int bufferIndex, int startIndex) + { + int index = bufferSortIndices[bufferIndex][startIndex]; + T value; + ReadOnlyMemory buffer = _columnContainer.Buffers[bufferIndex].ReadOnlyBuffer; + ReadOnlyMemory typedBuffer = Unsafe.As, ReadOnlyMemory>(ref buffer); + if (!typedBuffer.IsEmpty) + { + bool isArray = MemoryMarshal.TryGetArray(typedBuffer, out ArraySegment arraySegment); + if (isArray) + { + value = arraySegment.Array[index + arraySegment.Offset]; + } + else + value = _columnContainer.Buffers[bufferIndex][index]; + } + else + { + value = _columnContainer.Buffers[bufferIndex][index]; + } + return (value, startIndex); + } + SortedDictionary>> heapOfValueAndListOfTupleOfSortAndBufferIndex = new SortedDictionary>>(comparer); + IList> buffers = _columnContainer.Buffers; + for (int i = 0; i < buffers.Count; i++) + { + ReadOnlyDataFrameBuffer buffer = buffers[i]; + if (bufferSortIndices[i].Count == 0) + { + // All nulls + continue; + } + ValueTuple valueAndBufferIndex = GetFirstNonNullValueAndBufferIndexStartingAtIndex(i, 0); + if (heapOfValueAndListOfTupleOfSortAndBufferIndex.ContainsKey(valueAndBufferIndex.Item1)) + { + heapOfValueAndListOfTupleOfSortAndBufferIndex[valueAndBufferIndex.Item1].Add((valueAndBufferIndex.Item2, i)); + } + else + { + heapOfValueAndListOfTupleOfSortAndBufferIndex.Add(valueAndBufferIndex.Item1, new List>() { (valueAndBufferIndex.Item2, i) }); + } + } + columnSortIndices = new PrimitiveDataFrameColumn("SortIndices"); + GetBufferSortIndex getBufferSortIndex = new GetBufferSortIndex((int bufferIndex, int sortIndex) => (bufferSortIndices[bufferIndex][sortIndex]) + bufferIndex * bufferSortIndices[0].Count); + GetValueAndBufferSortIndexAtBuffer getValueAndBufferSortIndexAtBuffer = new GetValueAndBufferSortIndexAtBuffer((int bufferIndex, int sortIndex) => GetFirstNonNullValueAndBufferIndexStartingAtIndex(bufferIndex, sortIndex)); + GetBufferLengthAtIndex getBufferLengthAtIndex = new GetBufferLengthAtIndex((int bufferIndex) => bufferSortIndices[bufferIndex].Count); + PopulateColumnSortIndicesWithHeap(heapOfValueAndListOfTupleOfSortAndBufferIndex, columnSortIndices, getBufferSortIndex, getValueAndBufferSortIndexAtBuffer, getBufferLengthAtIndex); + } + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs new file mode 100644 index 0000000000..a613470a55 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs @@ -0,0 +1,678 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using Apache.Arrow; +using Apache.Arrow.Types; +using Microsoft.ML; +using Microsoft.ML.Data; + +namespace Microsoft.Data.Analysis +{ + /// + /// A column to hold primitive types such as int, float etc. + /// + /// + public partial class PrimitiveDataFrameColumn : DataFrameColumn, IEnumerable + where T : unmanaged + { + private PrimitiveColumnContainer _columnContainer; + + internal PrimitiveDataFrameColumn(string name, PrimitiveColumnContainer column) : base(name, column.Length, typeof(T)) + { + _columnContainer = column; + } + + public PrimitiveDataFrameColumn(string name, IEnumerable values) : base(name, 0, typeof(T)) + { + _columnContainer = new PrimitiveColumnContainer(values); + Length = _columnContainer.Length; + } + + public PrimitiveDataFrameColumn(string name, IEnumerable values) : base(name, 0, typeof(T)) + { + _columnContainer = new PrimitiveColumnContainer(values); + Length = _columnContainer.Length; + } + + public PrimitiveDataFrameColumn(string name, long length = 0) : base(name, length, typeof(T)) + { + _columnContainer = new PrimitiveColumnContainer(length); + } + + public PrimitiveDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, length, typeof(T)) + { + _columnContainer = new PrimitiveColumnContainer(buffer, nullBitMap, length, nullCount); + } + + /// + /// Returns an enumerable of immutable memory buffers representing the underlying values + /// + /// Null values are encoded in the buffers returned by GetReadOnlyNullBitmapBuffers in the Apache Arrow format + /// IEnumerable> + public IEnumerable> GetReadOnlyDataBuffers() + { + for (int i = 0; i < _columnContainer.Buffers.Count; i++) + { + ReadOnlyDataFrameBuffer buffer = _columnContainer.Buffers[i]; + yield return buffer.ReadOnlyMemory; + } + } + + /// + /// Returns an enumerable of immutable ReadOnlyMemory buffers representing null values in the Apache Arrow format + /// + /// Each ReadOnlyMemory encodes the null values for its corresponding Data buffer + /// IEnumerable> + public IEnumerable> GetReadOnlyNullBitMapBuffers() + { + for (int i = 0; i < _columnContainer.NullBitMapBuffers.Count; i++) + { + ReadOnlyDataFrameBuffer buffer = _columnContainer.NullBitMapBuffers[i]; + yield return buffer.RawReadOnlyMemory; + } + } + + private IArrowType GetArrowType() + { + if (typeof(T) == typeof(bool)) + return BooleanType.Default; + else if (typeof(T) == typeof(double)) + return DoubleType.Default; + else if (typeof(T) == typeof(float)) + return FloatType.Default; + else if (typeof(T) == typeof(sbyte)) + return Int8Type.Default; + else if (typeof(T) == typeof(int)) + return Int32Type.Default; + else if (typeof(T) == typeof(long)) + return Int64Type.Default; + else if (typeof(T) == typeof(short)) + return Int16Type.Default; + else if (typeof(T) == typeof(byte)) + return UInt8Type.Default; + else if (typeof(T) == typeof(uint)) + return UInt32Type.Default; + else if (typeof(T) == typeof(ulong)) + return UInt64Type.Default; + else if (typeof(T) == typeof(ushort)) + return UInt16Type.Default; + else + throw new NotImplementedException(nameof(T)); + } + + protected internal override Field GetArrowField() => new Field(Name, GetArrowType(), NullCount != 0); + + protected internal override int GetMaxRecordBatchLength(long startIndex) => _columnContainer.MaxRecordBatchLength(startIndex); + + private int GetNullCount(long startIndex, int numberOfRows) + { + int nullCount = 0; + for (long i = startIndex; i < numberOfRows; i++) + { + if (!IsValid(i)) + nullCount++; + } + return nullCount; + } + + protected internal override Apache.Arrow.Array ToArrowArray(long startIndex, int numberOfRows) + { + int arrayIndex = numberOfRows == 0 ? 0 : _columnContainer.GetArrayContainingRowIndex(startIndex); + int offset = (int)(startIndex - arrayIndex * ReadOnlyDataFrameBuffer.MaxCapacity); + if (numberOfRows != 0 && numberOfRows > _columnContainer.Buffers[arrayIndex].Length - offset) + { + throw new ArgumentException(Strings.SpansMultipleBuffers, nameof(numberOfRows)); + } + ArrowBuffer valueBuffer = numberOfRows == 0 ? ArrowBuffer.Empty : new ArrowBuffer(_columnContainer.GetValueBuffer(startIndex)); + ArrowBuffer nullBuffer = numberOfRows == 0 ? ArrowBuffer.Empty : new ArrowBuffer(_columnContainer.GetNullBuffer(startIndex)); + int nullCount = GetNullCount(startIndex, numberOfRows); + Type type = this.DataType; + if (type == typeof(bool)) + return new BooleanArray(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(double)) + return new DoubleArray(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(float)) + return new FloatArray(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(int)) + return new Int32Array(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(long)) + return new Int64Array(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(sbyte)) + return new Int8Array(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(short)) + return new Int16Array(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(uint)) + return new UInt32Array(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(ulong)) + return new UInt64Array(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(ushort)) + return new UInt16Array(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else if (type == typeof(byte)) + return new UInt8Array(valueBuffer, nullBuffer, numberOfRows, nullCount, offset); + else + throw new NotImplementedException(type.ToString()); + } + + public new IReadOnlyList this[long startIndex, int length] + { + get + { + if (startIndex > Length) + { + throw new ArgumentOutOfRangeException(nameof(startIndex)); + } + return _columnContainer[startIndex, length]; + } + } + + protected override IReadOnlyList GetValues(long startIndex, int length) + { + if (startIndex > Length) + { + throw new ArgumentOutOfRangeException(nameof(startIndex)); + } + + var ret = new List(length); + long endIndex = Math.Min(Length, startIndex + length); + for (long i = startIndex; i < endIndex; i++) + { + ret.Add(this[i]); + } + return ret; + } + + internal T? GetTypedValue(long rowIndex) => _columnContainer[rowIndex]; + + protected override object GetValue(long rowIndex) => GetTypedValue(rowIndex); + + protected override void SetValue(long rowIndex, object value) + { + if (value == null || value.GetType() == typeof(T)) + { + _columnContainer[rowIndex] = (T?)value; + } + else + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, DataType), nameof(value)); + } + } + + public new T? this[long rowIndex] + { + get => GetTypedValue(rowIndex); + set + { + if (value == null || value.GetType() == typeof(T)) + { + _columnContainer[rowIndex] = value; + } + else + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, DataType), nameof(value)); + } + } + } + + public override double Median() + { + // Not the most efficient implementation. Using a selection algorithm here would be O(n) instead of O(nLogn) + if (Length == 0) + return 0; + PrimitiveDataFrameColumn sortIndices = GetAscendingSortIndices(); + long middle = sortIndices.Length / 2; + double middleValue = (double)Convert.ChangeType(this[sortIndices[middle].Value].Value, typeof(double)); + if (Length % 2 == 0) + { + double otherMiddleValue = (double)Convert.ChangeType(this[sortIndices[middle - 1].Value].Value, typeof(double)); + return (middleValue + otherMiddleValue) / 2; + } + else + { + return middleValue; + } + } + + public override double Mean() + { + if (Length == 0) + return 0; + return (double)Convert.ChangeType((T)Sum(), typeof(double)) / Length; + } + + protected internal override void Resize(long length) + { + _columnContainer.Resize(length); + Length = _columnContainer.Length; + } + + public void Append(T? value) + { + _columnContainer.Append(value); + Length++; + } + + public void AppendMany(T? value, long count) + { + _columnContainer.AppendMany(value, count); + Length += count; + } + + public override long NullCount + { + get + { + Debug.Assert(_columnContainer.NullCount >= 0); + return _columnContainer.NullCount; + } + } + + public bool IsValid(long index) => _columnContainer.IsValid(index); + + public IEnumerator GetEnumerator() => _columnContainer.GetEnumerator(); + + protected override IEnumerator GetEnumeratorCore() => GetEnumerator(); + + public override bool IsNumericColumn() + { + bool ret = true; + if (typeof(T) == typeof(char) || typeof(T) == typeof(bool)) + ret = false; + return ret; + } + + /// + /// Returns a new column with nulls replaced by value + /// + /// + public PrimitiveDataFrameColumn FillNulls(T value, bool inPlace = false) + { + PrimitiveDataFrameColumn column = inPlace ? this : Clone(); + column.ApplyElementwise((T? columnValue, long index) => + { + if (columnValue.HasValue == false) + return value; + else + return columnValue.Value; + }); + return column; + } + + protected override DataFrameColumn FillNullsImplementation(object value, bool inPlace) + { + T convertedValue = (T)Convert.ChangeType(value, typeof(T)); + return FillNulls(convertedValue, inPlace); + } + + public override DataFrame ValueCounts() + { + Dictionary> groupedValues = GroupColumnValues(); + PrimitiveDataFrameColumn keys = new PrimitiveDataFrameColumn("Values"); + PrimitiveDataFrameColumn counts = new PrimitiveDataFrameColumn("Counts"); + foreach (KeyValuePair> keyValuePair in groupedValues) + { + keys.Append(keyValuePair.Key); + counts.Append(keyValuePair.Value.Count); + } + return new DataFrame(new List { keys, counts }); + } + + public override bool HasDescription() => IsNumericColumn(); + + public override string ToString() + { + return $"{Name}: {_columnContainer.ToString()}"; + } + + public new PrimitiveDataFrameColumn Clone(DataFrameColumn mapIndices, bool invertMapIndices, long numberOfNullsToAppend) + { + PrimitiveDataFrameColumn clone; + if (!(mapIndices is null)) + { + Type dataType = mapIndices.DataType; + if (dataType != typeof(long) && dataType != typeof(int) && dataType != typeof(bool)) + throw new ArgumentException(String.Format(Strings.MultipleMismatchedValueType, typeof(long), typeof(int), typeof(bool)), nameof(mapIndices)); + if (dataType == typeof(long)) + clone = Clone(mapIndices as PrimitiveDataFrameColumn, invertMapIndices); + else if (dataType == typeof(int)) + clone = Clone(mapIndices as PrimitiveDataFrameColumn, invertMapIndices); + else + clone = Clone(mapIndices as PrimitiveDataFrameColumn); + } + else + { + clone = Clone(); + } + Debug.Assert(!ReferenceEquals(clone, null)); + clone.AppendMany(null, numberOfNullsToAppend); + return clone; + } + + protected override DataFrameColumn CloneImplementation(DataFrameColumn mapIndices, bool invertMapIndices, long numberOfNullsToAppend) + { + return Clone(mapIndices, invertMapIndices, numberOfNullsToAppend); + } + + private PrimitiveDataFrameColumn Clone(PrimitiveDataFrameColumn boolColumn) + { + if (boolColumn.Length > Length) + throw new ArgumentException(Strings.MapIndicesExceedsColumnLenth, nameof(boolColumn)); + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name); + for (long i = 0; i < boolColumn.Length; i++) + { + bool? value = boolColumn[i]; + if (value.HasValue && value.Value == true) + ret.Append(this[i]); + } + return ret; + } + + private PrimitiveDataFrameColumn CloneImplementation(PrimitiveDataFrameColumn mapIndices, bool invertMapIndices = false) + where U : unmanaged + { + if (!mapIndices.IsNumericColumn()) + throw new ArgumentException(String.Format(Strings.MismatchedValueType, Strings.NumericColumnType), nameof(mapIndices)); + + PrimitiveColumnContainer retContainer; + if (mapIndices.DataType == typeof(long)) + { + retContainer = _columnContainer.Clone(mapIndices._columnContainer, typeof(long), invertMapIndices); + } + else if (mapIndices.DataType == typeof(int)) + { + retContainer = _columnContainer.Clone(mapIndices._columnContainer, typeof(int), invertMapIndices); + } + else + throw new NotImplementedException(); + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name, retContainer); + return ret; + } + + public PrimitiveDataFrameColumn Clone(PrimitiveDataFrameColumn mapIndices = null, bool invertMapIndices = false) + { + if (mapIndices is null) + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.Clone(); + return new PrimitiveDataFrameColumn(Name, newColumnContainer); + } + else + { + return CloneImplementation(mapIndices, invertMapIndices); + } + } + + public PrimitiveDataFrameColumn Clone(PrimitiveDataFrameColumn mapIndices, bool invertMapIndices = false) + { + return CloneImplementation(mapIndices, invertMapIndices); + } + + public PrimitiveDataFrameColumn Clone(IEnumerable mapIndices) + { + IEnumerator rows = mapIndices.GetEnumerator(); + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name); + ret._columnContainer._modifyNullCountWhileIndexing = false; + long numberOfRows = 0; + while (rows.MoveNext() && numberOfRows < Length) + { + numberOfRows++; + long curRow = rows.Current; + T? value = _columnContainer[curRow]; + ret[curRow] = value; + if (!value.HasValue) + ret._columnContainer.NullCount++; + } + ret._columnContainer._modifyNullCountWhileIndexing = true; + return ret; + } + + internal PrimitiveDataFrameColumn CloneAsBoolColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsBoolContainer(); + return new PrimitiveDataFrameColumn(Name, newColumnContainer); + } + + internal PrimitiveDataFrameColumn CloneAsDoubleColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsDoubleContainer(); + return new PrimitiveDataFrameColumn(Name, newColumnContainer); + } + + internal PrimitiveDataFrameColumn CloneAsDecimalColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsDecimalContainer(); + return new PrimitiveDataFrameColumn(Name, newColumnContainer); + } + + public override GroupBy GroupBy(int columnIndex, DataFrame parent) + { + Dictionary> dictionary = GroupColumnValues(); + return new GroupBy(parent, columnIndex, dictionary); + } + + public override Dictionary> GroupColumnValues() + { + if (typeof(TKey) == typeof(T)) + { + Dictionary> multimap = new Dictionary>(EqualityComparer.Default); + for (int b = 0; b < _columnContainer.Buffers.Count; b++) + { + ReadOnlyDataFrameBuffer buffer = _columnContainer.Buffers[b]; + ReadOnlySpan readOnlySpan = buffer.ReadOnlySpan; + long previousLength = b * ReadOnlyDataFrameBuffer.MaxCapacity; + for (int i = 0; i < readOnlySpan.Length; i++) + { + long currentLength = i + previousLength; + bool containsKey = multimap.TryGetValue(readOnlySpan[i], out ICollection values); + if (containsKey) + { + values.Add(currentLength); + } + else + { + multimap.Add(readOnlySpan[i], new List() { currentLength }); + } + } + } + return multimap as Dictionary>; + } + else + { + throw new NotImplementedException(nameof(TKey)); + } + } + + public void ApplyElementwise(Func func) => _columnContainer.ApplyElementwise(func); + + /// + /// Clips values beyond the specified thresholds + /// + /// Minimum value. All values below this threshold will be set to it + /// Maximum value. All values above this threshold will be set to it + public PrimitiveDataFrameColumn Clip(T lower, T upper, bool inPlace = false) + { + PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); + + Comparer comparer = Comparer.Default; + for (long i = 0; i < ret.Length; i++) + { + T? value = ret[i]; + if (value == null) + continue; + + if (comparer.Compare(value.Value, lower) < 0) + ret[i] = lower; + + if (comparer.Compare(value.Value, upper) > 0) + ret[i] = upper; + } + return ret; + } + + protected override DataFrameColumn ClipImplementation(U lower, U upper, bool inPlace) + { + object convertedLower = Convert.ChangeType(lower, typeof(T)); + if (typeof(T) == typeof(U) || convertedLower != null) + return Clip((T)convertedLower, (T)Convert.ChangeType(upper, typeof(T)), inPlace); + else + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(U)); + } + + /// + /// Returns a new column filtered by the lower and upper bounds + /// + /// + /// + public PrimitiveDataFrameColumn Filter(T lower, T upper) + { + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name); + Comparer comparer = Comparer.Default; + for (long i = 0; i < Length; i++) + { + T? value = this[i]; + if (value == null) + continue; + + if (comparer.Compare(value.Value, lower) >= 0 && comparer.Compare(value.Value, upper) <= 0) + ret.Append(value); + } + return ret; + } + + protected override DataFrameColumn FilterImplementation(U lower, U upper) + { + object convertedLower = Convert.ChangeType(lower, typeof(T)); + if (typeof(T) == typeof(U) || convertedLower != null) + return Filter((T)convertedLower, (T)Convert.ChangeType(upper, typeof(T))); + else + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(U)); + } + + public override DataFrame Description() + { + DataFrame ret = new DataFrame(); + StringDataFrameColumn stringColumn = new StringDataFrameColumn("Description", 0); + stringColumn.Append("Length"); + stringColumn.Append("Max"); + stringColumn.Append("Min"); + stringColumn.Append("Mean"); + float max = (float)Convert.ChangeType(Max(), typeof(float)); + float min = (float)Convert.ChangeType(Min(), typeof(float)); + float mean = (float)Convert.ChangeType(Sum(), typeof(float)) / Length; + PrimitiveDataFrameColumn column = new PrimitiveDataFrameColumn(Name); + column.Append(Length - NullCount); + column.Append(max); + column.Append(min); + column.Append(mean); + ret.Columns.Insert(0, stringColumn); + ret.Columns.Insert(1, column); + return ret; + } + + protected internal override void AddDataViewColumn(DataViewSchema.Builder builder) + { + builder.AddColumn(Name, GetDataViewType()); + } + + private static DataViewType GetDataViewType() + { + if (typeof(T) == typeof(bool)) + { + return BooleanDataViewType.Instance; + } + else if (typeof(T) == typeof(byte)) + { + return NumberDataViewType.Byte; + } + else if (typeof(T) == typeof(double)) + { + return NumberDataViewType.Double; + } + else if (typeof(T) == typeof(float)) + { + return NumberDataViewType.Single; + } + else if (typeof(T) == typeof(int)) + { + return NumberDataViewType.Int32; + } + else if (typeof(T) == typeof(long)) + { + return NumberDataViewType.Int64; + } + else if (typeof(T) == typeof(sbyte)) + { + return NumberDataViewType.SByte; + } + else if (typeof(T) == typeof(short)) + { + return NumberDataViewType.Int16; + } + else if (typeof(T) == typeof(uint)) + { + return NumberDataViewType.UInt32; + } + else if (typeof(T) == typeof(ulong)) + { + return NumberDataViewType.UInt64; + } + else if (typeof(T) == typeof(ushort)) + { + return NumberDataViewType.UInt16; + } + // The following 2 implementations are not ideal, but IDataView doesn't support + // these types + else if (typeof(T) == typeof(char)) + { + return NumberDataViewType.UInt16; + } + else if (typeof(T) == typeof(decimal)) + { + return NumberDataViewType.Double; + } + + throw new NotSupportedException(); + } + + protected internal override Delegate GetDataViewGetter(DataViewRowCursor cursor) + { + // special cases for types that have NA values + if (typeof(T) == typeof(float)) + { + return CreateSingleValueGetterDelegate(cursor, (PrimitiveDataFrameColumn)(object)this); + } + else if (typeof(T) == typeof(double)) + { + return CreateDoubleValueGetterDelegate(cursor, (PrimitiveDataFrameColumn)(object)this); + } + // special cases for types not supported + else if (typeof(T) == typeof(char)) + { + return CreateCharValueGetterDelegate(cursor, (PrimitiveDataFrameColumn)(object)this); + } + else if (typeof(T) == typeof(decimal)) + { + return CreateDecimalValueGetterDelegate(cursor, (PrimitiveDataFrameColumn)(object)this); + } + return CreateValueGetterDelegate(cursor); + } + + private ValueGetter CreateValueGetterDelegate(DataViewRowCursor cursor) => + (ref T value) => value = this[cursor.Position].GetValueOrDefault(); + + private static ValueGetter CreateSingleValueGetterDelegate(DataViewRowCursor cursor, PrimitiveDataFrameColumn column) => + (ref float value) => value = column[cursor.Position] ?? float.NaN; + + private static ValueGetter CreateDoubleValueGetterDelegate(DataViewRowCursor cursor, PrimitiveDataFrameColumn column) => + (ref double value) => value = column[cursor.Position] ?? double.NaN; + + private static ValueGetter CreateCharValueGetterDelegate(DataViewRowCursor cursor, PrimitiveDataFrameColumn column) => + (ref ushort value) => value = column[cursor.Position].GetValueOrDefault(); + + private static ValueGetter CreateDecimalValueGetterDelegate(DataViewRowCursor cursor, PrimitiveDataFrameColumn column) => + (ref double value) => value = (double?)column[cursor.Position] ?? double.NaN; + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs new file mode 100644 index 0000000000..ad8b5eb5b0 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs @@ -0,0 +1,5342 @@ + + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumnArithmetic.tt. Do not modify directly + +using System; + +namespace Microsoft.Data.Analysis +{ + internal interface IPrimitiveDataFrameColumnArithmetic + where T : struct + { + void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right); + void Add(PrimitiveColumnContainer column, T scalar); + void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right); + void Subtract(PrimitiveColumnContainer column, T scalar); + void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right); + void Multiply(PrimitiveColumnContainer column, T scalar); + void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right); + void Divide(PrimitiveColumnContainer column, T scalar); + void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right); + void Modulo(PrimitiveColumnContainer column, T scalar); + void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right); + void And(PrimitiveColumnContainer column, T scalar); + void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right); + void Or(PrimitiveColumnContainer column, T scalar); + void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right); + void Xor(PrimitiveColumnContainer column, T scalar); + void LeftShift(PrimitiveColumnContainer column, int value); + void RightShift(PrimitiveColumnContainer column, int value); + void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret); + void ElementwiseEquals(PrimitiveColumnContainer column, T scalar, PrimitiveColumnContainer ret); + void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret); + void ElementwiseNotEquals(PrimitiveColumnContainer column, T scalar, PrimitiveColumnContainer ret); + void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret); + void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, T scalar, PrimitiveColumnContainer ret); + void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret); + void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, T scalar, PrimitiveColumnContainer ret); + void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret); + void ElementwiseGreaterThan(PrimitiveColumnContainer column, T scalar, PrimitiveColumnContainer ret); + void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret); + void ElementwiseLessThan(PrimitiveColumnContainer column, T scalar, PrimitiveColumnContainer ret); + } + + internal static class PrimitiveDataFrameColumnArithmetic + where T : struct + { + public static IPrimitiveDataFrameColumnArithmetic Instance { get; } = PrimitiveDataFrameColumnArithmetic.GetArithmetic(); + } + + internal static class PrimitiveDataFrameColumnArithmetic + { + public static IPrimitiveDataFrameColumnArithmetic GetArithmetic() + where T : struct + { + if (typeof(T) == typeof(bool)) + { + return (IPrimitiveDataFrameColumnArithmetic)new BoolArithmetic(); + } + else if (typeof(T) == typeof(byte)) + { + return (IPrimitiveDataFrameColumnArithmetic)new ByteArithmetic(); + } + else if (typeof(T) == typeof(char)) + { + return (IPrimitiveDataFrameColumnArithmetic)new CharArithmetic(); + } + else if (typeof(T) == typeof(decimal)) + { + return (IPrimitiveDataFrameColumnArithmetic)new DecimalArithmetic(); + } + else if (typeof(T) == typeof(double)) + { + return (IPrimitiveDataFrameColumnArithmetic)new DoubleArithmetic(); + } + else if (typeof(T) == typeof(float)) + { + return (IPrimitiveDataFrameColumnArithmetic)new FloatArithmetic(); + } + else if (typeof(T) == typeof(int)) + { + return (IPrimitiveDataFrameColumnArithmetic)new IntArithmetic(); + } + else if (typeof(T) == typeof(long)) + { + return (IPrimitiveDataFrameColumnArithmetic)new LongArithmetic(); + } + else if (typeof(T) == typeof(sbyte)) + { + return (IPrimitiveDataFrameColumnArithmetic)new SByteArithmetic(); + } + else if (typeof(T) == typeof(short)) + { + return (IPrimitiveDataFrameColumnArithmetic)new ShortArithmetic(); + } + else if (typeof(T) == typeof(uint)) + { + return (IPrimitiveDataFrameColumnArithmetic)new UIntArithmetic(); + } + else if (typeof(T) == typeof(ulong)) + { + return (IPrimitiveDataFrameColumnArithmetic)new ULongArithmetic(); + } + else if (typeof(T) == typeof(ushort)) + { + return (IPrimitiveDataFrameColumnArithmetic)new UShortArithmetic(); + } + throw new NotSupportedException(); + } + } + + internal class BoolArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Add(PrimitiveColumnContainer column, bool scalar) + { + throw new NotSupportedException(); + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Subtract(PrimitiveColumnContainer column, bool scalar) + { + throw new NotSupportedException(); + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Multiply(PrimitiveColumnContainer column, bool scalar) + { + throw new NotSupportedException(); + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Divide(PrimitiveColumnContainer column, bool scalar) + { + throw new NotSupportedException(); + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Modulo(PrimitiveColumnContainer column, bool scalar) + { + throw new NotSupportedException(); + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, bool scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, bool scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, bool scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + throw new NotSupportedException(); + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + throw new NotSupportedException(); + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, bool scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, bool scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + throw new NotSupportedException(); + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, bool scalar, PrimitiveColumnContainer ret) + { + throw new NotSupportedException(); + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + throw new NotSupportedException(); + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, bool scalar, PrimitiveColumnContainer ret) + { + throw new NotSupportedException(); + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + throw new NotSupportedException(); + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, bool scalar, PrimitiveColumnContainer ret) + { + throw new NotSupportedException(); + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + throw new NotSupportedException(); + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, bool scalar, PrimitiveColumnContainer ret) + { + throw new NotSupportedException(); + } + } + internal class ByteArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, byte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, byte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, byte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, byte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, byte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, byte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, byte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, byte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, byte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, byte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, byte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, byte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, byte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, byte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class CharArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, char scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, char scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, char scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, char scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, char scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, char scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, char scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, char scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, char scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, char scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, char scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, char scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, char scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, char scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class DecimalArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, decimal scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, decimal scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, decimal scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, decimal scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, decimal scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void And(PrimitiveColumnContainer column, decimal scalar) + { + throw new NotSupportedException(); + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Or(PrimitiveColumnContainer column, decimal scalar) + { + throw new NotSupportedException(); + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Xor(PrimitiveColumnContainer column, decimal scalar) + { + throw new NotSupportedException(); + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + throw new NotSupportedException(); + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + throw new NotSupportedException(); + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, decimal scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, decimal scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, decimal scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, decimal scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, decimal scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, decimal scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class DoubleArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, double scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, double scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, double scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, double scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, double scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void And(PrimitiveColumnContainer column, double scalar) + { + throw new NotSupportedException(); + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Or(PrimitiveColumnContainer column, double scalar) + { + throw new NotSupportedException(); + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Xor(PrimitiveColumnContainer column, double scalar) + { + throw new NotSupportedException(); + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + throw new NotSupportedException(); + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + throw new NotSupportedException(); + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, double scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, double scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, double scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, double scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, double scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, double scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class FloatArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, float scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, float scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, float scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, float scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, float scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void And(PrimitiveColumnContainer column, float scalar) + { + throw new NotSupportedException(); + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Or(PrimitiveColumnContainer column, float scalar) + { + throw new NotSupportedException(); + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + throw new NotSupportedException(); + } + public void Xor(PrimitiveColumnContainer column, float scalar) + { + throw new NotSupportedException(); + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + throw new NotSupportedException(); + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + throw new NotSupportedException(); + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, float scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, float scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, float scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, float scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, float scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, float scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class IntArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, int scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, int scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, int scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, int scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, int scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, int scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, int scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, int scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, int scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, int scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, int scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, int scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, int scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, int scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class LongArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, long scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, long scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, long scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, long scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, long scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, long scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, long scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, long scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, long scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, long scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, long scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, long scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, long scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, long scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class SByteArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, sbyte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, sbyte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, sbyte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, sbyte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, sbyte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, sbyte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, sbyte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, sbyte scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, sbyte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, sbyte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, sbyte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, sbyte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, sbyte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, sbyte scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class ShortArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, short scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, short scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, short scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, short scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, short scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, short scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class UIntArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, uint scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, uint scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, uint scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, uint scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, uint scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, uint scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, uint scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, uint scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, uint scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, uint scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, uint scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, uint scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, uint scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, uint scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class ULongArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, ulong scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, ulong scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, ulong scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, ulong scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, ulong scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, ulong scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, ulong scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, ulong scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, ulong scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, ulong scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, ulong scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, ulong scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, ulong scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, ulong scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + internal class UShortArithmetic : IPrimitiveDataFrameColumnArithmetic + { + public void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] + otherSpan[i]); + } + } + } + public void Add(PrimitiveColumnContainer column, ushort scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] + scalar); + } + } + } + public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] - otherSpan[i]); + } + } + } + public void Subtract(PrimitiveColumnContainer column, ushort scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] - scalar); + } + } + } + public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] * otherSpan[i]); + } + } + } + public void Multiply(PrimitiveColumnContainer column, ushort scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] * scalar); + } + } + } + public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] / otherSpan[i]); + } + } + } + public void Divide(PrimitiveColumnContainer column, ushort scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] / scalar); + } + } + } + public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] % otherSpan[i]); + } + } + } + public void Modulo(PrimitiveColumnContainer column, ushort scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] % scalar); + } + } + } + public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] & otherSpan[i]); + } + } + } + public void And(PrimitiveColumnContainer column, ushort scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] & scalar); + } + } + } + public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] | otherSpan[i]); + } + } + } + public void Or(PrimitiveColumnContainer column, ushort scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] | scalar); + } + } + } + public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] ^ otherSpan[i]); + } + } + } + public void Xor(PrimitiveColumnContainer column, ushort scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] ^ scalar); + } + } + } + public void LeftShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] << value); + } + } + } + public void RightShift(PrimitiveColumnContainer column, int value) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(span[i] >> value); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == otherSpan[i]); + } + } + } + public void ElementwiseEquals(PrimitiveColumnContainer column, ushort scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] == scalar); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != otherSpan[i]); + } + } + } + public void ElementwiseNotEquals(PrimitiveColumnContainer column, ushort scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] != scalar); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= otherSpan[i]); + } + } + } + public void ElementwiseGreaterThanOrEqual(PrimitiveColumnContainer column, ushort scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] >= scalar); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= otherSpan[i]); + } + } + } + public void ElementwiseLessThanOrEqual(PrimitiveColumnContainer column, ushort scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] <= scalar); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > otherSpan[i]); + } + } + } + public void ElementwiseGreaterThan(PrimitiveColumnContainer column, ushort scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] > scalar); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < left.Buffers.Count; b++) + { + var buffer = left.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + left.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + var otherSpan = right.Buffers[b].ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < otherSpan[i]); + } + } + } + public void ElementwiseLessThan(PrimitiveColumnContainer column, ushort scalar, PrimitiveColumnContainer ret) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + ret[i] = (span[i] < scalar); + } + } + } + } + + + + +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.tt new file mode 100644 index 0000000000..f7ffd1677e --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.tt @@ -0,0 +1,91 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumnArithmetic.tt. Do not modify directly + +using System; + +namespace Microsoft.Data.Analysis +{ + internal interface IPrimitiveDataFrameColumnArithmetic + where T : struct + { +<# foreach (MethodConfiguration method in methodConfiguration) { #> + <#= method.GetMethodSignature("PrimitiveColumnContainer", "T")#>; +<# } #> + } + + internal static class PrimitiveDataFrameColumnArithmetic + where T : struct + { + public static IPrimitiveDataFrameColumnArithmetic Instance { get; } = PrimitiveDataFrameColumnArithmetic.GetArithmetic(); + } + + internal static class PrimitiveDataFrameColumnArithmetic + { + public static IPrimitiveDataFrameColumnArithmetic GetArithmetic() + where T : struct + { +<# foreach (TypeConfiguration type in typeConfiguration) { #> + <#=GenerateIfStatementHeader(type)#> + { + return (IPrimitiveDataFrameColumnArithmetic)new <#=type.ClassPrefix#>Arithmetic(); + } +<# } #> + throw new NotSupportedException(); + } + } + +<# foreach (TypeConfiguration type in typeConfiguration) { #> + internal class <#=type.ClassPrefix#>Arithmetic : IPrimitiveDataFrameColumnArithmetic<<#=type.TypeName#>> + { +<# foreach (MethodConfiguration method in methodConfiguration) { #> + public <#= method.GetMethodSignature("PrimitiveColumnContainer", type.TypeName) #> + { +<# if ((method.IsNumeric && !type.SupportsNumeric) || (method.IsBitwise && !type.SupportsBitwise) || (type.UnsupportedMethods.Contains(method.MethodName))) { #> + throw new NotSupportedException(); +<# } else if (method.Operator != null) { #> + for (int b = 0 ; b < <#= method.Op1Name #>.Buffers.Count; b++) + { + var buffer = <#= method.Op1Name #>.Buffers[b]; + var mutableBuffer = DataFrameBuffer<<#=type.TypeName#>>.GetMutableBuffer(buffer); + <#= method.Op1Name #>.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; +<# if (method.MethodType == MethodType.Binary || method.MethodType == MethodType.Comparison) { #> + var otherSpan = <#=method.Op2Name#>.Buffers[b].ReadOnlySpan; +<# } #> + for (int i = 0; i < span.Length; i++) + { +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.BinaryInt) { #> + span[i] = (<#=type.TypeName#>)(span[i] <#= method.Operator #> <#= method.Op2Name #>); +<# } else if (method.MethodType == MethodType.Binary) { #> + span[i] = (<#=type.TypeName#>)(span[i] <#= method.Operator #> otherSpan[i]); +<# } else if (method.MethodType == MethodType.Comparison) { #> + ret[i] = (span[i] <#= method.Operator #> otherSpan[i]); +<# } else if (method.MethodType == MethodType.ComparisonScalar) { #> + ret[i] = (span[i] <#= method.Operator #> <#= method.Op2Name #>); +<# } else {#> + throw new NotImplementedException(); +<# } #> + } + } +<# } #> + } +<# } #> + } +<# } #> + + + + +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnComputations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnComputations.cs new file mode 100644 index 0000000000..987209fa1a --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnComputations.cs @@ -0,0 +1,5359 @@ + + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveColumnComputations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + internal interface IPrimitiveColumnComputation + where T : struct + { + void Abs(PrimitiveColumnContainer column); + void All(PrimitiveColumnContainer column, out bool ret); + void Any(PrimitiveColumnContainer column, out bool ret); + void CumulativeMax(PrimitiveColumnContainer column); + void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows); + void CumulativeMin(PrimitiveColumnContainer column); + void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows); + void CumulativeProduct(PrimitiveColumnContainer column); + void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows); + void CumulativeSum(PrimitiveColumnContainer column); + void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows); + void Max(PrimitiveColumnContainer column, out T ret); + void Max(PrimitiveColumnContainer column, IEnumerable rows, out T ret); + void Min(PrimitiveColumnContainer column, out T ret); + void Min(PrimitiveColumnContainer column, IEnumerable rows, out T ret); + void Product(PrimitiveColumnContainer column, out T ret); + void Product(PrimitiveColumnContainer column, IEnumerable rows, out T ret); + void Sum(PrimitiveColumnContainer column, out T ret); + void Sum(PrimitiveColumnContainer column, IEnumerable rows, out T ret); + void Round(PrimitiveColumnContainer column); + } + + internal static class PrimitiveColumnComputation + where T : struct + { + public static IPrimitiveColumnComputation Instance { get; } = PrimitiveColumnComputation.GetComputation(); + } + + internal static class PrimitiveColumnComputation + { + public static IPrimitiveColumnComputation GetComputation() + where T : struct + { + if (typeof(T) == typeof(bool)) + { + return (IPrimitiveColumnComputation)new BoolComputation(); + } + else if (typeof(T) == typeof(byte)) + { + return (IPrimitiveColumnComputation)new ByteComputation(); + } + else if (typeof(T) == typeof(char)) + { + return (IPrimitiveColumnComputation)new CharComputation(); + } + else if (typeof(T) == typeof(decimal)) + { + return (IPrimitiveColumnComputation)new DecimalComputation(); + } + else if (typeof(T) == typeof(double)) + { + return (IPrimitiveColumnComputation)new DoubleComputation(); + } + else if (typeof(T) == typeof(float)) + { + return (IPrimitiveColumnComputation)new FloatComputation(); + } + else if (typeof(T) == typeof(int)) + { + return (IPrimitiveColumnComputation)new IntComputation(); + } + else if (typeof(T) == typeof(long)) + { + return (IPrimitiveColumnComputation)new LongComputation(); + } + else if (typeof(T) == typeof(sbyte)) + { + return (IPrimitiveColumnComputation)new SByteComputation(); + } + else if (typeof(T) == typeof(short)) + { + return (IPrimitiveColumnComputation)new ShortComputation(); + } + else if (typeof(T) == typeof(uint)) + { + return (IPrimitiveColumnComputation)new UIntComputation(); + } + else if (typeof(T) == typeof(ulong)) + { + return (IPrimitiveColumnComputation)new ULongComputation(); + } + else if (typeof(T) == typeof(ushort)) + { + return (IPrimitiveColumnComputation)new UShortComputation(); + } + throw new NotSupportedException(); + } + } + + internal class BoolComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + ret = true; + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + if (span[i] == false) + { + ret = false; + return; + } + } + } + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + ret = false; + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + if (span[i] == true) + { + ret = true; + return; + } + } + } + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + throw new NotSupportedException(); + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + throw new NotSupportedException(); + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + throw new NotSupportedException(); + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + throw new NotSupportedException(); + } + + public void Max(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out bool ret) + { + throw new NotSupportedException(); + } + + public void Min(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out bool ret) + { + throw new NotSupportedException(); + } + + public void Product(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out bool ret) + { + throw new NotSupportedException(); + } + + public void Sum(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out bool ret) + { + throw new NotSupportedException(); + } + + public void Round(PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } + + } + internal class ByteComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (byte)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (byte)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(byte); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (byte)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (byte)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(byte); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (byte)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (byte)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (byte)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(byte); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((byte)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (byte)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (byte)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(byte); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((byte)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out byte ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (byte)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out byte ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (byte)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out byte ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (byte)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out byte ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (byte)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out byte ret) + { + ret = (byte)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (byte)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out byte ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((byte)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out byte ret) + { + ret = (byte)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (byte)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out byte ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((byte)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (byte)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class CharComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (char)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (char)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(char); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (char)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (char)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(char); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (char)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (char)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (char)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(char); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((char)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (char)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (char)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(char); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((char)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out char ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (char)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out char ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (char)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out char ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (char)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out char ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (char)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out char ret) + { + ret = (char)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (char)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out char ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((char)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out char ret) + { + ret = (char)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (char)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out char ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((char)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (char)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class DecimalComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (decimal)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (decimal)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(decimal); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (decimal)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (decimal)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(decimal); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (decimal)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (decimal)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (decimal)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(decimal); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((decimal)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (decimal)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (decimal)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(decimal); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((decimal)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out decimal ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (decimal)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out decimal ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (decimal)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out decimal ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (decimal)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out decimal ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (decimal)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out decimal ret) + { + ret = (decimal)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (decimal)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out decimal ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((decimal)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out decimal ret) + { + ret = (decimal)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (decimal)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out decimal ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((decimal)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (decimal)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class DoubleComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (double)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (double)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(double); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (double)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (double)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(double); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (double)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (double)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (double)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(double); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((double)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (double)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (double)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(double); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((double)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out double ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (double)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out double ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (double)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out double ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (double)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out double ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (double)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out double ret) + { + ret = (double)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (double)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out double ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((double)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out double ret) + { + ret = (double)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (double)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out double ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((double)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (double)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class FloatComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (float)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (float)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(float); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (float)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (float)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(float); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (float)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (float)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (float)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(float); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((float)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (float)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (float)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(float); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((float)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out float ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (float)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out float ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (float)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out float ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (float)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out float ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (float)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out float ret) + { + ret = (float)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (float)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out float ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((float)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out float ret) + { + ret = (float)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (float)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out float ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((float)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (float)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class IntComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (int)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (int)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(int); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (int)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (int)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(int); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (int)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (int)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (int)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(int); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((int)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (int)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (int)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(int); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((int)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out int ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (int)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out int ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (int)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out int ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (int)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out int ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (int)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out int ret) + { + ret = (int)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (int)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out int ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((int)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out int ret) + { + ret = (int)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (int)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out int ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((int)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (int)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class LongComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (long)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (long)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(long); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (long)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (long)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(long); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (long)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (long)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (long)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(long); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((long)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (long)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (long)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(long); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((long)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out long ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (long)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out long ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (long)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out long ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (long)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out long ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (long)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out long ret) + { + ret = (long)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (long)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out long ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((long)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out long ret) + { + ret = (long)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (long)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out long ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((long)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (long)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class SByteComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (sbyte)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (sbyte)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(sbyte); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (sbyte)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (sbyte)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(sbyte); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (sbyte)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (sbyte)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (sbyte)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(sbyte); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((sbyte)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (sbyte)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (sbyte)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(sbyte); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((sbyte)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out sbyte ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (sbyte)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out sbyte ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (sbyte)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out sbyte ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (sbyte)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out sbyte ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (sbyte)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out sbyte ret) + { + ret = (sbyte)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (sbyte)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out sbyte ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((sbyte)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out sbyte ret) + { + ret = (sbyte)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (sbyte)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out sbyte ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((sbyte)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (sbyte)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class ShortComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (short)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (short)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(short); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (short)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (short)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(short); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (short)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (short)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (short)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(short); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((short)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (short)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (short)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(short); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((short)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out short ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (short)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out short ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (short)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out short ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (short)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out short ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (short)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out short ret) + { + ret = (short)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (short)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out short ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((short)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out short ret) + { + ret = (short)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (short)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out short ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((short)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (short)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class UIntComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (uint)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (uint)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(uint); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (uint)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (uint)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(uint); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (uint)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (uint)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (uint)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(uint); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((uint)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (uint)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (uint)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(uint); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((uint)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out uint ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (uint)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out uint ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (uint)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out uint ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (uint)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out uint ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (uint)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out uint ret) + { + ret = (uint)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (uint)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out uint ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((uint)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out uint ret) + { + ret = (uint)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (uint)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out uint ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((uint)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (uint)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class ULongComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (ulong)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ulong)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(ulong); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (ulong)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ulong)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(ulong); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (ulong)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (ulong)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ulong)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(ulong); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((ulong)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (ulong)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ulong)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(ulong); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((ulong)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out ulong ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ulong)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out ulong ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (ulong)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out ulong ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ulong)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out ulong ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (ulong)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out ulong ret) + { + ret = (ulong)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ulong)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out ulong ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((ulong)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out ulong ret) + { + ret = (ulong)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ulong)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out ulong ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((ulong)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (ulong)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } + internal class UShortComputation : IPrimitiveColumnComputation + { + public void Abs(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (ushort)(Math.Abs((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + public void All(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void Any(PrimitiveColumnContainer column, out bool ret) + { + throw new NotSupportedException(); + } + + public void CumulativeMax(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ushort)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMax(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(ushort); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (ushort)Math.Max(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column) + { + var ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ushort)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeMin(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(ushort); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (ushort)Math.Min(span[(int)row], ret); + span[(int)row] = ret; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column) + { + var ret = (ushort)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ushort)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeProduct(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(ushort); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((ushort)((span[(int)row]) * ret)); + span[(int)row] = ret; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column) + { + var ret = (ushort)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ushort)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; + } + column.Buffers[b] = mutableBuffer; + } + } + + public void CumulativeSum(PrimitiveColumnContainer column, IEnumerable rows) + { + var ret = default(ushort); + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((ushort)((span[(int)row]) + ret)); + span[(int)row] = ret; + } + } + + public void Max(PrimitiveColumnContainer column, out ushort ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ushort)(Math.Max(readOnlySpan[i], ret)); + } + } + } + + public void Max(PrimitiveColumnContainer column, IEnumerable rows, out ushort ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (ushort)(Math.Max(readOnlySpan[(int)row], ret)); + } + } + + public void Min(PrimitiveColumnContainer column, out ushort ret) + { + ret = column.Buffers[0].ReadOnlySpan[0]; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ushort)(Math.Min(readOnlySpan[i], ret)); + } + } + } + + public void Min(PrimitiveColumnContainer column, IEnumerable rows, out ushort ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = (ushort)(Math.Min(readOnlySpan[(int)row], ret)); + } + } + + public void Product(PrimitiveColumnContainer column, out ushort ret) + { + ret = (ushort)1; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ushort)(readOnlySpan[i] * ret); + } + } + } + + public void Product(PrimitiveColumnContainer column, IEnumerable rows, out ushort ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((ushort)(readOnlySpan[(int)row] * ret)); + } + } + + public void Sum(PrimitiveColumnContainer column, out ushort ret) + { + ret = (ushort)0; + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { + ret = (ushort)(readOnlySpan[i] + ret); + } + } + } + + public void Sum(PrimitiveColumnContainer column, IEnumerable rows, out ushort ret) + { + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = checked((ushort)(readOnlySpan[(int)row] + ret)); + } + } + + public void Round(PrimitiveColumnContainer column) + { + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (ushort)(Math.Round((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } + } + + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnComputations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnComputations.tt new file mode 100644 index 0000000000..a2f82a8c2f --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnComputations.tt @@ -0,0 +1,268 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveColumnComputations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + internal interface IPrimitiveColumnComputation + where T : struct + { +<# foreach (MethodConfiguration compMethod in computationMethodConfiguration) { #> +<# if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false && compMethod.SupportsRowSubsets == true) {#> + void <#=compMethod.MethodName#>(PrimitiveColumnContainer column, IEnumerable rows); +<# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false) {#> + void <#=compMethod.MethodName#>(PrimitiveColumnContainer column); +<# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == true) {#> + void <#=compMethod.MethodName#>(PrimitiveColumnContainer column, out T ret); +<# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true && compMethod.SupportsRowSubsets == true) { #> + void <#=compMethod.MethodName#>(PrimitiveColumnContainer column, IEnumerable rows, out T ret); +<# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true) { #> + void <#=compMethod.MethodName#>(PrimitiveColumnContainer column, out T ret); +<# } else { #> + void <#=compMethod.MethodName#>(PrimitiveColumnContainer column, out bool ret); +<# } #> +<# } #> + } + + internal static class PrimitiveColumnComputation + where T : struct + { + public static IPrimitiveColumnComputation Instance { get; } = PrimitiveColumnComputation.GetComputation(); + } + + internal static class PrimitiveColumnComputation + { + public static IPrimitiveColumnComputation GetComputation() + where T : struct + { +<# foreach (TypeConfiguration type in typeConfiguration) { #> + <#=GenerateIfStatementHeader(type)#> + { + return (IPrimitiveColumnComputation)new <#=type.ClassPrefix#>Computation(); + } +<# } #> + throw new NotSupportedException(); + } + } + +<# foreach (TypeConfiguration type in typeConfiguration) { #> + internal class <#=type.ClassPrefix#>Computation : IPrimitiveColumnComputation<<#=type.TypeName#>> + { +<# foreach (MethodConfiguration method in computationMethodConfiguration) { #> +<# if (method.MethodType == MethodType.ElementwiseComputation && method.HasReturnValue == false && method.SupportsRowSubsets == true) {#> + public void <#=method.MethodName#>(PrimitiveColumnContainer<<#=type.TypeName#>> column, IEnumerable rows) +<# } else if (method.MethodType == MethodType.ElementwiseComputation && method.HasReturnValue == false) {#> + public void <#=method.MethodName#>(PrimitiveColumnContainer<<#=type.TypeName#>> column) +<# } else if (method.MethodType == MethodType.ElementwiseComputation && method.HasReturnValue == true) {#> + public void <#=method.MethodName#>(PrimitiveColumnContainer<<#=type.TypeName#>> column, out <#=type.TypeName#> ret) +<# } else if (method.MethodType == MethodType.Reduction && method.IsNumeric == true && method.SupportsRowSubsets == true) { #> + public void <#=method.MethodName#>(PrimitiveColumnContainer<<#=type.TypeName#>> column, IEnumerable rows, out <#=type.TypeName#> ret) +<# } else if (method.MethodType == MethodType.Reduction && method.IsNumeric == true) { #> + public void <#=method.MethodName#>(PrimitiveColumnContainer<<#=type.TypeName#>> column, out <#=type.TypeName#> ret) +<# } else { #> + public void <#=method.MethodName#>(PrimitiveColumnContainer<<#=type.TypeName#>> column, out bool ret) +<# } #> + { +<# if ((method.IsNumeric && !type.SupportsNumeric) || (method.IsBitwise && !type.SupportsBitwise) || (type.UnsupportedMethods.Contains(method.MethodName))) { #> + throw new NotSupportedException(); +<# } else { #> +<# if ((method.MethodName == "Max" || method.MethodName == "Min" || method.MethodName == "Product" || method.MethodName == "Sum") && method.SupportsRowSubsets == true) { #> + ret = default; + var readOnlySpan = column.Buffers[0].ReadOnlySpan; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer<<#=type.TypeName#>>.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + readOnlySpan = column.Buffers[bufferIndex].ReadOnlySpan; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; +<# if (method.MethodName == "Max") { #> + ret = (<#=type.TypeName#>)(Math.Max(readOnlySpan[(int)row], ret)); +<# } #> +<# if (method.MethodName == "Min") { #> + ret = (<#=type.TypeName#>)(Math.Min(readOnlySpan[(int)row], ret)); +<# } #> +<# if (method.MethodName == "Product") { #> + ret = checked((<#=type.TypeName#>)(readOnlySpan[(int)row] * ret)); +<# } #> +<# if (method.MethodName == "Sum") { #> + ret = checked((<#=type.TypeName#>)(readOnlySpan[(int)row] + ret)); +<# } #> + } +<# } else if ((method.MethodName == "CumulativeMax" || method.MethodName == "CumulativeMin" || method.MethodName == "CumulativeProduct" || method.MethodName == "CumulativeSum") && method.SupportsRowSubsets == true) { #> + var ret = default(<#=type.TypeName#>); + var mutableBuffer = DataFrameBuffer<<#=type.TypeName#>>.GetMutableBuffer(column.Buffers[0]); + var span = mutableBuffer.Span; + long minRange = 0; + long maxRange = ReadOnlyDataFrameBuffer<<#=type.TypeName#>>.MaxCapacity; + long maxCapacity = maxRange; + IEnumerator enumerator = rows.GetEnumerator(); + if (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer<<#=type.TypeName#>>.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; + ret = span[(int)row]; + } + + while (enumerator.MoveNext()) + { + long row = enumerator.Current; + if (row < minRange || row >= maxRange) + { + int bufferIndex = (int)(row / maxCapacity); + mutableBuffer = DataFrameBuffer<<#=type.TypeName#>>.GetMutableBuffer(column.Buffers[bufferIndex]); + span = mutableBuffer.Span; + minRange = checked(bufferIndex * maxCapacity); + maxRange = checked((bufferIndex + 1) * maxCapacity); + } + row -= minRange; +<# if (method.MethodName == "CumulativeMax") { #> + ret = (<#=type.TypeName#>)Math.Max(span[(int)row], ret); + span[(int)row] = ret; +<# } else if (method.MethodName == "CumulativeMin") { #> + ret = (<#=type.TypeName#>)Math.Min(span[(int)row], ret); + span[(int)row] = ret; +<# } else if (method.MethodName == "CumulativeProduct") { #> + ret = checked((<#=type.TypeName#>)((span[(int)row]) * ret)); + span[(int)row] = ret; +<# } else if (method.MethodName =="CumulativeSum") { #> + ret = checked((<#=type.TypeName#>)((span[(int)row]) + ret)); + span[(int)row] = ret; +<# } #> + } +<# } else if (method.MethodName == "CumulativeMax" || method.MethodName == "CumulativeMin" || method.MethodName == "CumulativeProduct" || method.MethodName == "CumulativeSum" || method.MethodName == "Max" || method.MethodName == "Min" || method.MethodName == "Product" || method.MethodName == "Sum") { #> +<# if (method.MethodName == "CumulativeMax" || method.MethodName == "CumulativeMin") { #> + var ret = column.Buffers[0].ReadOnlySpan[0]; +<# } else if ((method.MethodName == "Max" || method.MethodName == "Min") && method.SupportsRowSubsets == false) { #> + ret = column.Buffers[0].ReadOnlySpan[0]; +<# } else if (method.MethodName == "CumulativeProduct") { #> + var ret = (<#=type.TypeName#>)1; +<# } else if (method.MethodName =="Product" && method.SupportsRowSubsets == false) { #> + ret = (<#=type.TypeName#>)1; +<# } else if (method.MethodName =="CumulativeSum") { #> + var ret = (<#=type.TypeName#>)0; +<# } else if (method.SupportsRowSubsets == false) { #> + ret = (<#=type.TypeName#>)0; +<# } #> + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; +<# if (method.MethodName == "CumulativeMax" || method.MethodName == "CumulativeMin" || method.MethodName == "CumulativeProduct" || method.MethodName == "CumulativeSum") { #> + var mutableBuffer = DataFrameBuffer<<#=type.TypeName#>>.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; +<# } #> + var readOnlySpan = buffer.ReadOnlySpan; + for (int i = 0; i < readOnlySpan.Length; i++) + { +<# if (method.MethodName == "CumulativeMax") { #> + ret = (<#=type.TypeName#>)(Math.Max(readOnlySpan[i], ret)); + mutableSpan[i] = ret; +<# } #> +<# if (method.MethodName == "CumulativeMin") { #> + ret = (<#=type.TypeName#>)(Math.Min(readOnlySpan[i], ret)); + mutableSpan[i] = ret; +<# } #> +<# if (method.MethodName == "CumulativeProduct") { #> + ret = (<#=type.TypeName#>)(readOnlySpan[i] * ret); + mutableSpan[i] = ret; +<# } #> +<# if (method.MethodName == "CumulativeSum") { #> + ret = (<#=type.TypeName#>)(readOnlySpan[i] + ret); + mutableSpan[i] = ret; +<# } #> +<# if (method.MethodName == "Max") { #> + ret = (<#=type.TypeName#>)(Math.Max(readOnlySpan[i], ret)); +<# } #> +<# if (method.MethodName == "Min") { #> + ret = (<#=type.TypeName#>)(Math.Min(readOnlySpan[i], ret)); +<# } #> +<# if (method.MethodName == "Product") { #> + ret = (<#=type.TypeName#>)(readOnlySpan[i] * ret); +<# } #> +<# if (method.MethodName == "Sum") { #> + ret = (<#=type.TypeName#>)(readOnlySpan[i] + ret); +<# } #> + } +<# if (method.MethodName == "CumulativeMax" || method.MethodName == "CumulativeMin" || method.MethodName == "CumulativeProduct" || method.MethodName == "CumulativeSum") { #> + column.Buffers[b] = mutableBuffer; +<# } #> + } +<# } else if (method.MethodType == MethodType.ElementwiseComputation && method.Operator != null) { #> + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer<<#=type.TypeName#>>.GetMutableBuffer(buffer); + var mutableSpan = mutableBuffer.Span; + for (int i = 0; i < mutableSpan.Length; i++) + { + mutableSpan[i] = (<#=type.TypeName#>)(<#=method.Operator#>((decimal)mutableSpan[i])); + } + column.Buffers[b] = mutableBuffer; + } +<# } else if (method.MethodType == MethodType.Reduction) { #> +<# if (method.MethodName == "All") { #> + ret = true; +<# } else if (method.MethodName == "Any") { #> + ret = false; +<# } #> + for (int b = 0; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { +<# if (method.MethodName == "All") { #> + if (span[i] == false) + { + ret = false; + return; + } +<# } else if (method.MethodName == "Any") { #> + if (span[i] == true) + { + ret = true; + return; + } +<# } #> + } + } +<# } else { #> + throw new NotImplementedException(); +<# } #> +<# } #> + } + +<# } #> + } +<# } #> +} diff --git a/src/Microsoft.Data.Analysis/ReadOnlyDataFrameBuffer.cs b/src/Microsoft.Data.Analysis/ReadOnlyDataFrameBuffer.cs new file mode 100644 index 0000000000..59394eed8e --- /dev/null +++ b/src/Microsoft.Data.Analysis/ReadOnlyDataFrameBuffer.cs @@ -0,0 +1,88 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + /// + /// A basic immutable store to hold values in a DataFrame column. Supports wrapping with an ArrowBuffer + /// + /// + internal class ReadOnlyDataFrameBuffer + where T : struct + { + private readonly ReadOnlyMemory _readOnlyBuffer; + + public virtual ReadOnlyMemory ReadOnlyBuffer => _readOnlyBuffer; + + public ReadOnlyMemory ReadOnlyMemory => RawReadOnlyMemory.Slice(0, Length); + + public ReadOnlyMemory RawReadOnlyMemory + { + get + { + ReadOnlyMemory memory = ReadOnlyBuffer; + return Unsafe.As, ReadOnlyMemory>(ref memory); + } + } + + protected static int Size = Unsafe.SizeOf(); + + protected int Capacity => ReadOnlyBuffer.Length / Size; + + + public static int MaxCapacity => Int32.MaxValue / Size; + + public ReadOnlySpan ReadOnlySpan + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => (MemoryMarshal.Cast(ReadOnlyBuffer.Span)).Slice(0, Length); + } + + public int Length { get; internal set; } + + public ReadOnlyDataFrameBuffer(int numberOfValues = 8) + { + if ((long)numberOfValues * Size > MaxCapacity) + { + throw new ArgumentException($"{numberOfValues} exceeds buffer capacity", nameof(numberOfValues)); + } + _readOnlyBuffer = new byte[numberOfValues * Size]; + } + + public ReadOnlyDataFrameBuffer(ReadOnlyMemory buffer, int length) + { + _readOnlyBuffer = buffer; + Length = length; + } + + internal virtual T this[int index] + { + get + { + if (index > Length) + throw new ArgumentOutOfRangeException(nameof(index)); + return ReadOnlySpan[index]; + } + set => throw new NotSupportedException(); + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + ReadOnlySpan span = ReadOnlySpan; + for (int i = 0; i < Length; i++) + { + sb.Append(span[i]).Append(" "); + } + return sb.ToString(); + } + + } +} diff --git a/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs new file mode 100644 index 0000000000..d90118b193 --- /dev/null +++ b/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs @@ -0,0 +1,143 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class StringDataFrameColumn : DataFrameColumn + { + public override DataFrameColumn Add(DataFrameColumn column, bool inPlace = false) + { + if (Length != column.Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + StringDataFrameColumn ret = inPlace ? this : Clone(); + for (long i = 0; i < Length; i++) + { + ret[i] += column[i].ToString(); + } + return ret; + } + + public static StringDataFrameColumn operator+(StringDataFrameColumn column, string value) + { + return column.Add(value); + } + + public static StringDataFrameColumn operator+(string value, StringDataFrameColumn column) + { + return Add(value, column); + } + + public static StringDataFrameColumn Add(string value, StringDataFrameColumn right) + { + StringDataFrameColumn ret = right.Clone(); + for (int i = 0; i < ret._stringBuffers.Count; i++) + { + IList buffer = ret._stringBuffers[i]; + int bufferLen = buffer.Count; + for (int j = 0; j < bufferLen; j++) + { + buffer[j] = value + buffer[j]; + } + } + return ret; + } + + public StringDataFrameColumn Add(string value, bool inPlace = false) + { + StringDataFrameColumn ret = inPlace ? this : Clone(); + for (int i = 0; i < ret._stringBuffers.Count; i++) + { + IList buffer = ret._stringBuffers[i]; + int bufferLen = buffer.Count; + for (int j = 0; j < bufferLen; j++) + { + buffer[j] += value; + } + } + return ret; + } + + public override DataFrameColumn Add(T value, bool inPlace = false) + { + return Add(value.ToString(), inPlace); + } + + internal static PrimitiveDataFrameColumn ElementwiseEqualsImplementation(DataFrameColumn left, DataFrameColumn right) + { + if (left.Length != right.Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(right)); + } + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(left.Name, left.Length); + for (long i = 0; i < left.Length; i++) + { + ret[i] = (string)left[i] == right[i]?.ToString(); + } + return ret; + + } + + public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn column) + { + return ElementwiseEqualsImplementation(this, column); + } + + public PrimitiveDataFrameColumn ElementwiseEquals(string value) + { + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name, Length); + for (long i = 0; i < Length; i++) + { + ret[i] = this[i] == value; + } + return ret; + } + + public override PrimitiveDataFrameColumn ElementwiseEquals(T value) + { + return ElementwiseEquals(value.ToString()); + } + + internal static PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(DataFrameColumn left, DataFrameColumn column) + { + if (left.Length != column.Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(left.Name, left.Length); + for (long i = 0; i < left.Length; i++) + { + ret[i] = (string)left[i] != column[i].ToString(); + } + return ret; + } + + public PrimitiveDataFrameColumn ElementwiseNotEquals(string value) + { + PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name, Length); + for (long i = 0; i < Length; i++) + { + ret[i] = this[i] != value; + } + return ret; + } + + public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(this, column); + } + + public override PrimitiveDataFrameColumn ElementwiseNotEquals(T value) + { + return ElementwiseNotEquals(value.ToString()); + } + } +} diff --git a/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs new file mode 100644 index 0000000000..d89be69079 --- /dev/null +++ b/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs @@ -0,0 +1,471 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.ML; +using Microsoft.ML.Data; + +namespace Microsoft.Data.Analysis +{ + /// + /// A mutable column to hold strings + /// + /// Is NOT Arrow compatible + public partial class StringDataFrameColumn : DataFrameColumn, IEnumerable + { + private List> _stringBuffers = new List>(); // To store more than intMax number of strings + + public StringDataFrameColumn(string name, long length) : base(name, length, typeof(string)) + { + int numberOfBuffersRequired = Math.Max((int)(length / int.MaxValue), 1); + for (int i = 0; i < numberOfBuffersRequired; i++) + { + long bufferLen = length - _stringBuffers.Count * int.MaxValue; + List buffer = new List((int)Math.Min(int.MaxValue, bufferLen)); + _stringBuffers.Add(buffer); + for (int j = 0; j < bufferLen; j++) + { + buffer.Add(default); + } + } + } + + public StringDataFrameColumn(string name, IEnumerable values) : base(name, 0, typeof(string)) + { + values = values ?? throw new ArgumentNullException(nameof(values)); + if (_stringBuffers.Count == 0) + { + _stringBuffers.Add(new List()); + } + foreach (var value in values) + { + Append(value); + } + } + + private long _nullCount; + public override long NullCount => _nullCount; + + protected internal override void Resize(long length) + { + if (length < Length) + throw new ArgumentException(Strings.CannotResizeDown, nameof(length)); + + for (long i = Length; i < length; i++) + { + Append(null); + } + } + + public void Append(string value) + { + List lastBuffer = _stringBuffers[_stringBuffers.Count - 1]; + if (lastBuffer.Count == int.MaxValue) + { + lastBuffer = new List(); + _stringBuffers.Add(lastBuffer); + } + lastBuffer.Add(value); + if (value == null) + _nullCount++; + Length++; + } + + private int GetBufferIndexContainingRowIndex(ref long rowIndex) + { + if (rowIndex > Length) + { + throw new ArgumentOutOfRangeException(Strings.ColumnIndexOutOfRange, nameof(rowIndex)); + } + return (int)(rowIndex / int.MaxValue); + } + + protected override object GetValue(long rowIndex) + { + int bufferIndex = GetBufferIndexContainingRowIndex(ref rowIndex); + return _stringBuffers[bufferIndex][(int)rowIndex]; + } + + protected override IReadOnlyList GetValues(long startIndex, int length) + { + var ret = new List(); + int bufferIndex = GetBufferIndexContainingRowIndex(ref startIndex); + while (ret.Count < length && bufferIndex < _stringBuffers.Count) + { + for (int i = (int)startIndex; ret.Count < length && i < _stringBuffers[bufferIndex].Count; i++) + { + ret.Add(_stringBuffers[bufferIndex][i]); + } + bufferIndex++; + startIndex = 0; + } + return ret; + } + + protected override void SetValue(long rowIndex, object value) + { + if (value == null || value is string) + { + int bufferIndex = GetBufferIndexContainingRowIndex(ref rowIndex); + var oldValue = this[rowIndex]; + _stringBuffers[bufferIndex][(int)rowIndex] = (string)value; + if (oldValue != (string)value) + { + if (value == null) + _nullCount++; + if (oldValue == null && _nullCount > 0) + _nullCount--; + } + } + else + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(string)), nameof(value)); + } + } + + public new string this[long rowIndex] + { + get => (string)GetValue(rowIndex); + set => SetValue(rowIndex, value); + } + + public new List this[long startIndex, int length] + { + get + { + var ret = new List(); + int bufferIndex = GetBufferIndexContainingRowIndex(ref startIndex); + while (ret.Count < length && bufferIndex < _stringBuffers.Count) + { + for (int i = (int)startIndex; ret.Count < length && i < _stringBuffers[bufferIndex].Count; i++) + { + ret.Add(_stringBuffers[bufferIndex][i]); + } + bufferIndex++; + startIndex = 0; + } + return ret; + } + } + + public IEnumerator GetEnumerator() + { + foreach (List buffer in _stringBuffers) + { + foreach (string value in buffer) + { + yield return value; + } + } + } + + protected override IEnumerator GetEnumeratorCore() => GetEnumerator(); + + public override DataFrameColumn Clip(U lower, U upper, bool inPlace = false) => throw new NotSupportedException(); + + public override DataFrameColumn Filter(U lower, U upper) => throw new NotSupportedException(); + + public new StringDataFrameColumn Sort(bool ascending = true) + { + PrimitiveDataFrameColumn columnSortIndices = GetAscendingSortIndices(); + return Clone(columnSortIndices, !ascending, NullCount); + } + + internal override PrimitiveDataFrameColumn GetAscendingSortIndices() + { + GetSortIndices(Comparer.Default, out PrimitiveDataFrameColumn columnSortIndices); + return columnSortIndices; + } + + private void GetSortIndices(Comparer comparer, out PrimitiveDataFrameColumn columnSortIndices) + { + List bufferSortIndices = new List(_stringBuffers.Count); + foreach (List buffer in _stringBuffers) + { + var sortIndices = new int[buffer.Count]; + for (int i = 0; i < buffer.Count; i++) + { + sortIndices[i] = i; + } + // TODO: Refactor the sort routine to also work with IList? + string[] array = buffer.ToArray(); + IntrospectiveSort(array, array.Length, sortIndices, comparer); + bufferSortIndices.Add(sortIndices); + } + // Simple merge sort to build the full column's sort indices + ValueTuple GetFirstNonNullValueStartingAtIndex(int stringBufferIndex, int startIndex) + { + string value = _stringBuffers[stringBufferIndex][bufferSortIndices[stringBufferIndex][startIndex]]; + while (value == null && ++startIndex < bufferSortIndices[stringBufferIndex].Length) + { + value = _stringBuffers[stringBufferIndex][bufferSortIndices[stringBufferIndex][startIndex]]; + } + return (value, startIndex); + } + + SortedDictionary>> heapOfValueAndListOfTupleOfSortAndBufferIndex = new SortedDictionary>>(comparer); + List> buffers = _stringBuffers; + for (int i = 0; i < buffers.Count; i++) + { + List buffer = buffers[i]; + ValueTuple valueAndBufferSortIndex = GetFirstNonNullValueStartingAtIndex(i, 0); + if (valueAndBufferSortIndex.Item1 == null) + { + // All nulls + continue; + } + if (heapOfValueAndListOfTupleOfSortAndBufferIndex.ContainsKey(valueAndBufferSortIndex.Item1)) + { + heapOfValueAndListOfTupleOfSortAndBufferIndex[valueAndBufferSortIndex.Item1].Add((valueAndBufferSortIndex.Item2, i)); + } + else + { + heapOfValueAndListOfTupleOfSortAndBufferIndex.Add(valueAndBufferSortIndex.Item1, new List>() { (valueAndBufferSortIndex.Item2, i) }); + } + } + columnSortIndices = new PrimitiveDataFrameColumn("SortIndices"); + GetBufferSortIndex getBufferSortIndex = new GetBufferSortIndex((int bufferIndex, int sortIndex) => (bufferSortIndices[bufferIndex][sortIndex]) + bufferIndex * bufferSortIndices[0].Length); + GetValueAndBufferSortIndexAtBuffer getValueAtBuffer = new GetValueAndBufferSortIndexAtBuffer((int bufferIndex, int sortIndex) => GetFirstNonNullValueStartingAtIndex(bufferIndex, sortIndex)); + GetBufferLengthAtIndex getBufferLengthAtIndex = new GetBufferLengthAtIndex((int bufferIndex) => bufferSortIndices[bufferIndex].Length); + PopulateColumnSortIndicesWithHeap(heapOfValueAndListOfTupleOfSortAndBufferIndex, columnSortIndices, getBufferSortIndex, getValueAtBuffer, getBufferLengthAtIndex); + } + + public new StringDataFrameColumn Clone(DataFrameColumn mapIndices, bool invertMapIndices, long numberOfNullsToAppend) + { + StringDataFrameColumn clone; + if (!(mapIndices is null)) + { + Type dataType = mapIndices.DataType; + if (dataType != typeof(long) && dataType != typeof(int) && dataType != typeof(bool)) + throw new ArgumentException(String.Format(Strings.MultipleMismatchedValueType, typeof(long), typeof(int), typeof(bool)), nameof(mapIndices)); + if (mapIndices.DataType == typeof(long)) + clone = Clone(mapIndices as PrimitiveDataFrameColumn, invertMapIndices); + else if (dataType == typeof(int)) + clone = Clone(mapIndices as PrimitiveDataFrameColumn, invertMapIndices); + else + clone = Clone(mapIndices as PrimitiveDataFrameColumn); + } + else + { + clone = Clone(); + } + for (long i = 0; i < numberOfNullsToAppend; i++) + { + clone.Append(null); + } + return clone; + } + + protected override DataFrameColumn CloneImplementation(DataFrameColumn mapIndices = null, bool invertMapIndices = false, long numberOfNullsToAppend = 0) + { + return Clone(mapIndices, invertMapIndices, numberOfNullsToAppend); + } + + private StringDataFrameColumn Clone(PrimitiveDataFrameColumn boolColumn) + { + if (boolColumn.Length > Length) + throw new ArgumentException(Strings.MapIndicesExceedsColumnLenth, nameof(boolColumn)); + StringDataFrameColumn ret = new StringDataFrameColumn(Name, 0); + for (long i = 0; i < boolColumn.Length; i++) + { + bool? value = boolColumn[i]; + if (value.HasValue && value.Value == true) + ret.Append(this[i]); + } + return ret; + } + + private StringDataFrameColumn CloneImplementation(PrimitiveDataFrameColumn mapIndices, bool invertMapIndices = false) + where U : unmanaged + { + mapIndices = mapIndices ?? throw new ArgumentNullException(nameof(mapIndices)); + StringDataFrameColumn ret = new StringDataFrameColumn(Name, mapIndices.Length); + + List setBuffer = ret._stringBuffers[0]; + long setBufferMinRange = 0; + long setBufferMaxRange = int.MaxValue; + List getBuffer = _stringBuffers[0]; + long getBufferMinRange = 0; + long getBufferMaxRange = int.MaxValue; + long maxCapacity = int.MaxValue; + if (mapIndices.DataType == typeof(long)) + { + PrimitiveDataFrameColumn longMapIndices = mapIndices as PrimitiveDataFrameColumn; + longMapIndices.ApplyElementwise((long? mapIndex, long rowIndex) => + { + long index = rowIndex; + if (invertMapIndices) + index = longMapIndices.Length - 1 - index; + if (index < setBufferMinRange || index >= setBufferMaxRange) + { + int bufferIndex = (int)(index / maxCapacity); + setBuffer = ret._stringBuffers[bufferIndex]; + setBufferMinRange = bufferIndex * maxCapacity; + setBufferMaxRange = (bufferIndex + 1) * maxCapacity; + } + index -= setBufferMinRange; + if (mapIndex == null) + { + setBuffer[(int)index] = null; + ret._nullCount++; + return mapIndex; + } + + if (mapIndex.Value < getBufferMinRange || mapIndex.Value >= getBufferMaxRange) + { + int bufferIndex = (int)(mapIndex.Value / maxCapacity); + getBuffer = _stringBuffers[bufferIndex]; + getBufferMinRange = bufferIndex * maxCapacity; + getBufferMaxRange = (bufferIndex + 1) * maxCapacity; + } + int bufferLocalMapIndex = (int)(mapIndex - getBufferMinRange); + string value = getBuffer[bufferLocalMapIndex]; + setBuffer[(int)index] = value; + if (value == null) + ret._nullCount++; + + return mapIndex; + }); + } + else if (mapIndices.DataType == typeof(int)) + { + PrimitiveDataFrameColumn intMapIndices = mapIndices as PrimitiveDataFrameColumn; + intMapIndices.ApplyElementwise((int? mapIndex, long rowIndex) => + { + long index = rowIndex; + if (invertMapIndices) + index = intMapIndices.Length - 1 - index; + + if (mapIndex == null) + { + setBuffer[(int)index] = null; + ret._nullCount++; + return mapIndex; + } + string value = getBuffer[mapIndex.Value]; + setBuffer[(int)index] = value; + if (value == null) + ret._nullCount++; + + return mapIndex; + }); + } + else + { + Debug.Assert(false, nameof(mapIndices.DataType)); + } + + return ret; + } + + private StringDataFrameColumn Clone(PrimitiveDataFrameColumn mapIndices = null, bool invertMapIndex = false) + { + if (mapIndices is null) + { + StringDataFrameColumn ret = new StringDataFrameColumn(Name, mapIndices is null ? Length : mapIndices.Length); + for (long i = 0; i < Length; i++) + { + ret[i] = this[i]; + } + return ret; + } + else + { + return CloneImplementation(mapIndices, invertMapIndex); + } + } + + private StringDataFrameColumn Clone(PrimitiveDataFrameColumn mapIndices, bool invertMapIndex = false) + { + return CloneImplementation(mapIndices, invertMapIndex); + } + + internal static DataFrame ValueCountsImplementation(Dictionary> groupedValues) + { + StringDataFrameColumn keys = new StringDataFrameColumn("Values", 0); + PrimitiveDataFrameColumn counts = new PrimitiveDataFrameColumn("Counts"); + foreach (KeyValuePair> keyValuePair in groupedValues) + { + keys.Append(keyValuePair.Key); + counts.Append(keyValuePair.Value.Count); + } + return new DataFrame(new List { keys, counts }); + } + + public override DataFrame ValueCounts() + { + Dictionary> groupedValues = GroupColumnValues(); + return ValueCountsImplementation(groupedValues); + } + + public override GroupBy GroupBy(int columnIndex, DataFrame parent) + { + Dictionary> dictionary = GroupColumnValues(); + return new GroupBy(parent, columnIndex, dictionary); + } + + public override Dictionary> GroupColumnValues() + { + if (typeof(TKey) == typeof(string)) + { + Dictionary> multimap = new Dictionary>(EqualityComparer.Default); + for (long i = 0; i < Length; i++) + { + bool containsKey = multimap.TryGetValue(this[i] ?? default, out ICollection values); + if (containsKey) + { + values.Add(i); + } + else + { + multimap.Add(this[i] ?? default, new List() { i }); + } + } + return multimap as Dictionary>; + } + else + { + throw new NotImplementedException(nameof(TKey)); + } + } + + public StringDataFrameColumn FillNulls(string value, bool inPlace = false) + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + StringDataFrameColumn column = inPlace ? this : Clone(); + + for (long i = 0; i < column.Length; i++) + { + if (column[i] == null) + column[i] = value; + } + return column; + } + + protected override DataFrameColumn FillNullsImplementation(object value, bool inPlace) + { + if (value is string valueString) + return FillNulls(valueString, inPlace); + else + throw new ArgumentException(String.Format(Strings.MismatchedValueType, typeof(string)), nameof(value)); + } + + protected internal override void AddDataViewColumn(DataViewSchema.Builder builder) + { + builder.AddColumn(Name, TextDataViewType.Instance); + } + + protected internal override Delegate GetDataViewGetter(DataViewRowCursor cursor) + { + return CreateValueGetterDelegate(cursor); + } + + private ValueGetter> CreateValueGetterDelegate(DataViewRowCursor cursor) => + (ref ReadOnlyMemory value) => value = this[cursor.Position].AsMemory(); + } +} diff --git a/src/Microsoft.Data.Analysis/strings.Designer.cs b/src/Microsoft.Data.Analysis/strings.Designer.cs new file mode 100644 index 0000000000..fc27befb7a --- /dev/null +++ b/src/Microsoft.Data.Analysis/strings.Designer.cs @@ -0,0 +1,225 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Data { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Strings { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Strings() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Data.Analysis.Strings", typeof(Strings).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Cannot resize down. + /// + internal static string CannotResizeDown { + get { + return ResourceManager.GetString("CannotResizeDown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Index cannot be greater than the Column's Length. + /// + internal static string ColumnIndexOutOfRange { + get { + return ResourceManager.GetString("ColumnIndexOutOfRange", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DataFrame already contains a column called {0}. + /// + internal static string DuplicateColumnName { + get { + return ResourceManager.GetString("DuplicateColumnName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Empty file. + /// + internal static string EmptyFile { + get { + return ResourceManager.GetString("EmptyFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parameter.Count exceeds the number of columns({0}) in the DataFrame . + /// + internal static string ExceedsNumberOfColumns { + get { + return ResourceManager.GetString("ExceedsNumberOfColumns", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Column is immutable. + /// + internal static string ImmutableColumn { + get { + return ResourceManager.GetString("ImmutableColumn", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Inconsistent null bitmap and data buffer lengths. + /// + internal static string InconsistentNullBitMapAndLength { + get { + return ResourceManager.GetString("InconsistentNullBitMapAndLength", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Inconsistent null bitmaps and NullCounts. + /// + internal static string InconsistentNullBitMapAndNullCount { + get { + return ResourceManager.GetString("InconsistentNullBitMapAndNullCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Column does not exist. + /// + internal static string InvalidColumnName { + get { + return ResourceManager.GetString("InvalidColumnName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Line {0} has less columns than expected. + /// + internal static string LessColumnsThatExpected { + get { + return ResourceManager.GetString("LessColumnsThatExpected", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MapIndices exceeds column length. + /// + internal static string MapIndicesExceedsColumnLenth { + get { + return ResourceManager.GetString("MapIndicesExceedsColumnLenth", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Column lengths are mismatched. + /// + internal static string MismatchedColumnLengths { + get { + return ResourceManager.GetString("MismatchedColumnLengths", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to rowCount differs from Column length for Column . + /// + internal static string MismatchedRowCount { + get { + return ResourceManager.GetString("MismatchedRowCount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected value to be of type {0}. + /// + internal static string MismatchedValueType { + get { + return ResourceManager.GetString("MismatchedValueType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected value to be of type {0}, {1} or {2}. + /// + internal static string MultipleMismatchedValueType { + get { + return ResourceManager.GetString("MultipleMismatchedValueType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected a seekable stream. + /// + internal static string NonSeekableStream { + get { + return ResourceManager.GetString("NonSeekableStream", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to numeric column. + /// + internal static string NumericColumnType { + get { + return ResourceManager.GetString("NumericColumnType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot span multiple buffers. + /// + internal static string SpansMultipleBuffers { + get { + return ResourceManager.GetString("SpansMultipleBuffers", resourceCulture); + } + } + } +} diff --git a/src/Microsoft.Data.Analysis/strings.resx b/src/Microsoft.Data.Analysis/strings.resx new file mode 100644 index 0000000000..a32a25a31a --- /dev/null +++ b/src/Microsoft.Data.Analysis/strings.resx @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cannot resize down + + + Index cannot be greater than the Column's Length + + + DataFrame already contains a column called {0} + + + Empty file + + + Parameter.Count exceeds the number of columns({0}) in the DataFrame + + + Column is immutable + + + Inconsistent null bitmap and data buffer lengths + + + Inconsistent null bitmaps and NullCounts + + + Column does not exist + + + Line {0} has less columns than expected + + + MapIndices exceeds column length + + + Column lengths are mismatched + + + rowCount differs from Column length for Column + + + Expected value to be of type {0} + + + Expected value to be of type {0}, {1} or {2} + + + Expected a seekable stream + + + numeric column + + + Cannot span multiple buffers + + \ No newline at end of file diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs b/tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs new file mode 100644 index 0000000000..05bda8b18f --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs @@ -0,0 +1,182 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Linq; +using Apache.Arrow; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public class ArrayComparer : + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor, + IArrowArrayVisitor + { + private readonly IArrowArray _expectedArray; + + public ArrayComparer(IArrowArray expectedArray) + { + _expectedArray = expectedArray; + } + + public void Visit(Int8Array array) => CompareArrays(array); + public void Visit(Int16Array array) => CompareArrays(array); + public void Visit(Int32Array array) => CompareArrays(array); + public void Visit(Int64Array array) => CompareArrays(array); + public void Visit(UInt8Array array) => CompareArrays(array); + public void Visit(UInt16Array array) => CompareArrays(array); + public void Visit(UInt32Array array) => CompareArrays(array); + public void Visit(UInt64Array array) => CompareArrays(array); + public void Visit(FloatArray array) => CompareArrays(array); + public void Visit(DoubleArray array) => CompareArrays(array); + public void Visit(BooleanArray array) => CompareArrays(array); + public void Visit(TimestampArray array) => CompareArrays(array); + public void Visit(Date32Array array) => CompareArrays(array); + public void Visit(Date64Array array) => CompareArrays(array); + public void Visit(ListArray array) => throw new NotImplementedException(); + public void Visit(StringArray array) => CompareArrays(array); + public void Visit(BinaryArray array) => throw new NotImplementedException(); + public void Visit(IArrowArray array) => throw new NotImplementedException(); + + private void CompareArrays(PrimitiveArray actualArray) + where T : struct, IEquatable + { + Assert.IsAssignableFrom>(_expectedArray); + PrimitiveArray expectedArray = (PrimitiveArray)_expectedArray; + + Assert.Equal(expectedArray.Length, actualArray.Length); + Assert.Equal(expectedArray.NullCount, actualArray.NullCount); + Assert.Equal(expectedArray.Offset, actualArray.Offset); + + if (expectedArray.NullCount > 0) + { + Assert.True(expectedArray.NullBitmapBuffer.Span.SequenceEqual(actualArray.NullBitmapBuffer.Span)); + } + else + { + // expectedArray may have passed in a null bitmap. DataFrame might have populated it with Length set bits + Assert.Equal(0, expectedArray.NullCount); + Assert.Equal(0, actualArray.NullCount); + for (int i = 0; i < actualArray.Length; i++) + { + Assert.True(actualArray.IsValid(i)); + } + } + Assert.True(expectedArray.Values.Slice(0, expectedArray.Length).SequenceEqual(actualArray.Values.Slice(0, actualArray.Length))); + } + + private void CompareArrays(BooleanArray actualArray) + { + Assert.IsAssignableFrom(_expectedArray); + BooleanArray expectedArray = (BooleanArray)_expectedArray; + + Assert.Equal(expectedArray.Length, actualArray.Length); + Assert.Equal(expectedArray.NullCount, actualArray.NullCount); + Assert.Equal(expectedArray.Offset, actualArray.Offset); + + Assert.True(expectedArray.NullBitmapBuffer.Span.SequenceEqual(actualArray.NullBitmapBuffer.Span)); + int booleanByteCount = BitUtility.ByteCount(expectedArray.Length); + Assert.True(expectedArray.Values.Slice(0, booleanByteCount).SequenceEqual(actualArray.Values.Slice(0, booleanByteCount))); + } + + private void CompareArrays(StringArray actualArray) + { + Assert.IsAssignableFrom(_expectedArray); + StringArray expectedArray = (StringArray)_expectedArray; + + Assert.Equal(expectedArray.Length, actualArray.Length); + Assert.Equal(expectedArray.NullCount, actualArray.NullCount); + Assert.Equal(expectedArray.Offset, actualArray.Offset); + + Assert.True(expectedArray.NullBitmapBuffer.Span.SequenceEqual(actualArray.NullBitmapBuffer.Span)); + Assert.True(expectedArray.Values.Slice(0, expectedArray.Length).SequenceEqual(actualArray.Values.Slice(0, actualArray.Length))); + } + } + + internal static class FieldComparer + { + public static bool Equals(Field f1, Field f2) + { + if (ReferenceEquals(f1, f2)) + { + return true; + } + if (f2 != null && f1 != null && f1.Name == f2.Name && f1.IsNullable == f2.IsNullable && + f1.DataType.TypeId == f2.DataType.TypeId && f1.HasMetadata == f2.HasMetadata) + { + if (f1.HasMetadata && f2.HasMetadata) + { + return f1.Metadata.Keys.Count() == f2.Metadata.Keys.Count() && + f1.Metadata.Keys.All(k => f2.Metadata.ContainsKey(k) && f1.Metadata[k] == f2.Metadata[k]) && + f2.Metadata.Keys.All(k => f1.Metadata.ContainsKey(k) && f2.Metadata[k] == f1.Metadata[k]); + } + return true; + } + return false; + } + } + + internal static class SchemaComparer + { + public static bool Equals(Schema s1, Schema s2) + { + if (ReferenceEquals(s1, s2)) + { + return true; + } + if (s2 == null || s1 == null || s1.HasMetadata != s2.HasMetadata || s1.Fields.Count != s2.Fields.Count) + { + return false; + } + + if (!s1.Fields.Keys.All(k => s2.Fields.ContainsKey(k) && FieldComparer.Equals(s1.Fields[k], s2.Fields[k])) || + !s2.Fields.Keys.All(k => s1.Fields.ContainsKey(k) && FieldComparer.Equals(s2.Fields[k], s1.Fields[k]))) + { + return false; + } + + if (s1.HasMetadata && s2.HasMetadata) + { + return s1.Metadata.Keys.Count() == s2.Metadata.Keys.Count() && + s1.Metadata.Keys.All(k => s2.Metadata.ContainsKey(k) && s1.Metadata[k] == s2.Metadata[k]) && + s2.Metadata.Keys.All(k => s1.Metadata.ContainsKey(k) && s2.Metadata[k] == s1.Metadata[k]); + } + return true; + } + } + + public static class RecordBatchComparer + { + public static void CompareBatches(RecordBatch expectedBatch, RecordBatch actualBatch) + { + Assert.True(SchemaComparer.Equals(expectedBatch.Schema, actualBatch.Schema)); + Assert.Equal(expectedBatch.Length, actualBatch.Length); + Assert.Equal(expectedBatch.ColumnCount, actualBatch.ColumnCount); + + for (int i = 0; i < expectedBatch.ColumnCount; i++) + { + IArrowArray expectedArray = expectedBatch.Arrays.ElementAt(i); + IArrowArray actualArray = actualBatch.Arrays.ElementAt(i); + + actualArray.Accept(new ArrayComparer(expectedArray)); + } + } + + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs new file mode 100644 index 0000000000..550c3a7254 --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs @@ -0,0 +1,158 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Apache.Arrow; +using Apache.Arrow.Ipc; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public class ArrowIntegrationTests + { + [Fact] + public void TestArrowIntegration() + { + RecordBatch originalBatch = new RecordBatch.Builder() + .Append("Column1", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))) + .Append("Column2", true, new Int32Array( + valueBuffer: new ArrowBuffer.Builder().AppendRange(Enumerable.Range(0, 10)).Build(), + nullBitmapBuffer: new ArrowBuffer.Builder().Append(0xfd).Append(0xff).Build(), + length: 10, + nullCount: 1, + offset: 0)) + .Append("Column3", true, new Int32Array( + valueBuffer: new ArrowBuffer.Builder().AppendRange(Enumerable.Range(0, 10)).Build(), + nullBitmapBuffer: new ArrowBuffer.Builder().Append(0x00).Append(0x00).Build(), + length: 10, + nullCount: 10, + offset: 0)) + .Append("NullableBooleanColumn", true, new BooleanArray( + valueBuffer: new ArrowBuffer.Builder().Append(0xfd).Append(0xff).Build(), + nullBitmapBuffer: new ArrowBuffer.Builder().Append(0xed).Append(0xff).Build(), + length: 10, + nullCount: 2, + offset: 0)) + .Append("StringDataFrameColumn", false, new StringArray.Builder().AppendRange(Enumerable.Range(0, 10).Select(x => x.ToString())).Build()) + .Append("DoubleColumn", false, new DoubleArray.Builder().AppendRange(Enumerable.Repeat(1.0, 10)).Build()) + .Append("FloatColumn", false, new FloatArray.Builder().AppendRange(Enumerable.Repeat(1.0f, 10)).Build()) + .Append("ShortColumn", false, new Int16Array.Builder().AppendRange(Enumerable.Repeat((short)1, 10)).Build()) + .Append("LongColumn", false, new Int64Array.Builder().AppendRange(Enumerable.Repeat((long)1, 10)).Build()) + .Append("UIntColumn", false, new UInt32Array.Builder().AppendRange(Enumerable.Repeat((uint)1, 10)).Build()) + .Append("UShortColumn", false, new UInt16Array.Builder().AppendRange(Enumerable.Repeat((ushort)1, 10)).Build()) + .Append("ULongColumn", false, new UInt64Array.Builder().AppendRange(Enumerable.Repeat((ulong)1, 10)).Build()) + .Append("ByteColumn", false, new Int8Array.Builder().AppendRange(Enumerable.Repeat((sbyte)1, 10)).Build()) + .Append("UByteColumn", false, new UInt8Array.Builder().AppendRange(Enumerable.Repeat((byte)1, 10)).Build()) + .Build(); + + DataFrame df = DataFrame.FromArrowRecordBatch(originalBatch); + + IEnumerable recordBatches = df.ToArrowRecordBatches(); + + foreach (RecordBatch batch in recordBatches) + { + RecordBatchComparer.CompareBatches(originalBatch, batch); + } + } + + [Fact] + public void TestEmptyDataFrameRecordBatch() + { + PrimitiveDataFrameColumn ageColumn = new PrimitiveDataFrameColumn("Age"); + PrimitiveDataFrameColumn lengthColumn = new PrimitiveDataFrameColumn("CharCount"); + ArrowStringDataFrameColumn stringColumn = new ArrowStringDataFrameColumn("Empty"); + DataFrame df = new DataFrame(new List() { ageColumn, lengthColumn, stringColumn }); + + IEnumerable recordBatches = df.ToArrowRecordBatches(); + bool foundARecordBatch = false; + foreach (RecordBatch recordBatch in recordBatches) + { + foundARecordBatch = true; + MemoryStream stream = new MemoryStream(); + ArrowStreamWriter writer = new ArrowStreamWriter(stream, recordBatch.Schema); + writer.WriteRecordBatchAsync(recordBatch).GetAwaiter().GetResult(); + + stream.Position = 0; + ArrowStreamReader reader = new ArrowStreamReader(stream); + RecordBatch readRecordBatch = reader.ReadNextRecordBatch(); + while (readRecordBatch != null) + { + RecordBatchComparer.CompareBatches(recordBatch, readRecordBatch); + readRecordBatch = reader.ReadNextRecordBatch(); + } + } + Assert.True(foundARecordBatch); + } + + [Fact] + public void TestMutationOnArrowColumn() + { + RecordBatch originalBatch = new RecordBatch.Builder() + .Append("Column1", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))).Build(); + DataFrame df = DataFrame.FromArrowRecordBatch(originalBatch); + Assert.Equal(1, df["Column1"][1]); + df["Column1"][1] = 100; + Assert.Equal(100, df["Column1"][1]); + Assert.Equal(0, df["Column1"].NullCount); + } + + [Fact] + public void TestEmptyArrowColumns() + { + // Tests to ensure that we don't crash and the internal NullCounts stay consistent on encountering: + // 1. Data + Empty null bitmaps + // 2. Empty Data + Null bitmaps + // 3. Empty Data + Empty null bitmaps + RecordBatch originalBatch = new RecordBatch.Builder() + .Append("EmptyNullBitMapColumn", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))) + .Append("EmptyDataColumn", true, new Int32Array( + valueBuffer: ArrowBuffer.Empty, + nullBitmapBuffer: new ArrowBuffer.Builder().Append(0x00).Append(0x00).Build(), + length: 10, + nullCount: 10, + offset: 0)).Build(); + DataFrame df = DataFrame.FromArrowRecordBatch(originalBatch); + Assert.Equal(0, df["EmptyNullBitMapColumn"].NullCount); + Assert.Equal(10, df["EmptyNullBitMapColumn"].Length); + df["EmptyNullBitMapColumn"][9] = null; + Assert.Equal(1, df["EmptyNullBitMapColumn"].NullCount); + Assert.Equal(10, df["EmptyDataColumn"].NullCount); + Assert.Equal(10, df["EmptyDataColumn"].Length); + df["EmptyDataColumn"][9] = 9; + Assert.Equal(9, df["EmptyDataColumn"].NullCount); + Assert.Equal(10, df["EmptyDataColumn"].Length); + for (int i = 0; i < 9; i++) + { + Assert.Equal(i, (int)df["EmptyNullBitMapColumn"][i]); + Assert.Null(df["EmptyDataColumn"][i]); + } + + RecordBatch batch1 = new RecordBatch.Builder() + .Append("EmptyDataAndNullColumns", false, col => col.Int32(array => array.Clear())).Build(); + DataFrame emptyDataFrame = DataFrame.FromArrowRecordBatch(batch1); + Assert.Equal(0, emptyDataFrame.RowCount); + Assert.Equal(0, emptyDataFrame["EmptyDataAndNullColumns"].Length); + Assert.Equal(0, emptyDataFrame["EmptyDataAndNullColumns"].NullCount); + } + + [Fact] + public void TestInconsistentNullBitMapLength() + { + // Arrow allocates buffers of length 64 by default. 64 * 8 = 512 bits in the NullBitMapBuffer. Anything lesser than 512 will not trigger a throw + Int32Array int32 = new Int32Array.Builder().AppendRange(Enumerable.Range(0, 520)).Build(); + RecordBatch originalBatch = new RecordBatch.Builder() + .Append("EmptyDataColumn", true, new Int32Array( + valueBuffer: int32.ValueBuffer, + nullBitmapBuffer: new ArrowBuffer.Builder().Append(0x00).Build(), + length: 520, + nullCount: 520, + offset: 0)).Build(); + + Assert.ThrowsAny(() => DataFrame.FromArrowRecordBatch(originalBatch)); + } + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs b/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs new file mode 100644 index 0000000000..0b5a500100 --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs @@ -0,0 +1,279 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Apache.Arrow; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public class BufferTests + { + [Fact] + public void TestNullCounts() + { + PrimitiveDataFrameColumn dataFrameColumn1 = new PrimitiveDataFrameColumn("Int1", Enumerable.Range(0, 10).Select(x => x)); + dataFrameColumn1.Append(null); + Assert.Equal(1, dataFrameColumn1.NullCount); + + PrimitiveDataFrameColumn column2 = new PrimitiveDataFrameColumn("Int2"); + Assert.Equal(0, column2.NullCount); + + PrimitiveDataFrameColumn column3 = new PrimitiveDataFrameColumn("Int3", 10); + Assert.Equal(10, column3.NullCount); + + // Test null counts with assignments on Primitive Columns + column2.Append(null); + column2.Append(1); + Assert.Equal(1, column2.NullCount); + column2[1] = 10; + Assert.Equal(1, column2.NullCount); + column2[1] = null; + Assert.Equal(2, column2.NullCount); + column2[1] = 5; + Assert.Equal(1, column2.NullCount); + column2[0] = null; + Assert.Equal(1, column2.NullCount); + + // Test null counts with assignments on String Columns + StringDataFrameColumn strCol = new StringDataFrameColumn("String", 0); + Assert.Equal(0, strCol.NullCount); + + StringDataFrameColumn strCol1 = new StringDataFrameColumn("String1", 5); + Assert.Equal(0, strCol1.NullCount); + + StringDataFrameColumn strCol2 = new StringDataFrameColumn("String", Enumerable.Range(0, 10).Select(x => x.ToString())); + Assert.Equal(0, strCol2.NullCount); + + StringDataFrameColumn strCol3 = new StringDataFrameColumn("String", Enumerable.Range(0, 10).Select(x => (string)null)); + Assert.Equal(10, strCol3.NullCount); + + strCol.Append(null); + Assert.Equal(1, strCol.NullCount); + strCol.Append("foo"); + Assert.Equal(1, strCol.NullCount); + strCol[1] = "bar"; + Assert.Equal(1, strCol.NullCount); + strCol[1] = null; + Assert.Equal(2, strCol.NullCount); + strCol[1] = "foo"; + Assert.Equal(1, strCol.NullCount); + strCol[0] = null; + Assert.Equal(1, strCol.NullCount); + + PrimitiveDataFrameColumn intColumn = new PrimitiveDataFrameColumn("Int"); + intColumn.Append(0); + intColumn.Append(1); + intColumn.Append(null); + intColumn.Append(2); + intColumn.Append(null); + intColumn.Append(3); + Assert.Equal(0, intColumn[0]); + Assert.Equal(1, intColumn[1]); + Assert.Null(intColumn[2]); + Assert.Equal(2, intColumn[3]); + Assert.Null(intColumn[4]); + Assert.Equal(3, intColumn[5]); + + } + + [Fact] + public void TestNullCountWithIndexers() + { + PrimitiveDataFrameColumn intColumn = new PrimitiveDataFrameColumn("Int", 5); + Assert.Equal(5, intColumn.NullCount); + intColumn[2] = null; + Assert.Equal(5, intColumn.NullCount); + intColumn[2] = 5; + Assert.Equal(4, intColumn.NullCount); + } + + [Fact] + public void TestValidity() + { + PrimitiveDataFrameColumn dataFrameColumn1 = new PrimitiveDataFrameColumn("Int1", Enumerable.Range(0, 10).Select(x => x)); + dataFrameColumn1.Append(null); + Assert.False(dataFrameColumn1.IsValid(10)); + for (long i = 0; i < dataFrameColumn1.Length - 1; i++) + { + Assert.True(dataFrameColumn1.IsValid(i)); + } + } + + [Fact] + public void TestAppendMany() + { + PrimitiveDataFrameColumn intColumn = new PrimitiveDataFrameColumn("Int1"); + intColumn.AppendMany(null, 5); + Assert.Equal(5, intColumn.NullCount); + Assert.Equal(5, intColumn.Length); + for (int i = 0; i < intColumn.Length; i++) + { + Assert.False(intColumn.IsValid(i)); + } + + intColumn.AppendMany(5, 5); + Assert.Equal(5, intColumn.NullCount); + Assert.Equal(10, intColumn.Length); + for (int i = 5; i < intColumn.Length; i++) + { + Assert.True(intColumn.IsValid(i)); + } + + intColumn[2] = 10; + Assert.Equal(4, intColumn.NullCount); + Assert.True(intColumn.IsValid(2)); + + intColumn[7] = null; + Assert.Equal(5, intColumn.NullCount); + Assert.False(intColumn.IsValid(7)); + } + + [Fact] + public void TestBasicArrowStringColumn() + { + StringArray strArray = new StringArray.Builder().Append("foo").Append("bar").Build(); + Memory dataMemory = new byte[] { 102, 111, 111, 98, 97, 114 }; + Memory nullMemory = new byte[] { 0, 0, 0, 0 }; + Memory offsetMemory = new byte[] { 0, 0, 0, 0, 3, 0, 0, 0, 6, 0, 0, 0 }; + + ArrowStringDataFrameColumn stringColumn = new ArrowStringDataFrameColumn("String", dataMemory, offsetMemory, nullMemory, strArray.Length, strArray.NullCount); + Assert.Equal(2, stringColumn.Length); + Assert.Equal("foo", stringColumn[0]); + Assert.Equal("bar", stringColumn[1]); + } + + [Fact] + public void TestArrowStringColumnWithNulls() + { + string data = "joemark"; + byte[] bytes = Encoding.UTF8.GetBytes(data); + Memory dataMemory = new Memory(bytes); + Memory nullMemory = new byte[] { 0b1101 }; + Memory offsetMemory = new byte[] { 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0 }; + ArrowStringDataFrameColumn stringColumn = new ArrowStringDataFrameColumn("String", dataMemory, offsetMemory, nullMemory, 4, 1); + + Assert.Equal(4, stringColumn.Length); + Assert.Equal("joe", stringColumn[0]); + Assert.Null(stringColumn[1]); + Assert.Equal("mark", stringColumn[2]); + Assert.Equal("", stringColumn[3]); + + List ret = stringColumn[0, 4]; + Assert.Equal("joe", ret[0]); + Assert.Null(ret[1]); + Assert.Equal("mark", ret[2]); + Assert.Equal("", ret[3]); + } + + [Fact] + public void TestArrowStringColumnClone() + { + StringArray strArray = new StringArray.Builder().Append("foo").Append("bar").Build(); + Memory dataMemory = new byte[] { 102, 111, 111, 98, 97, 114 }; + Memory nullMemory = new byte[] { 0, 0, 0, 0 }; + Memory offsetMemory = new byte[] { 0, 0, 0, 0, 3, 0, 0, 0, 6, 0, 0, 0 }; + + ArrowStringDataFrameColumn stringColumn = new ArrowStringDataFrameColumn("String", dataMemory, offsetMemory, nullMemory, strArray.Length, strArray.NullCount); + + DataFrameColumn clone = stringColumn.Clone(numberOfNullsToAppend: 5); + Assert.Equal(7, clone.Length); + Assert.Equal(stringColumn[0], clone[0]); + Assert.Equal(stringColumn[1], clone[1]); + for (int i = 2; i < 7; i++) + Assert.Null(clone[i]); + } + + [Fact] + public void TestPrimitiveColumnGetReadOnlyBuffers() + { + RecordBatch recordBatch = new RecordBatch.Builder() + .Append("Column1", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))).Build(); + DataFrame df = DataFrame.FromArrowRecordBatch(recordBatch); + + PrimitiveDataFrameColumn column = df["Column1"] as PrimitiveDataFrameColumn; + + IEnumerable> buffers = column.GetReadOnlyDataBuffers(); + IEnumerable> nullBitMaps = column.GetReadOnlyNullBitMapBuffers(); + + long i = 0; + IEnumerator> bufferEnumerator = buffers.GetEnumerator(); + IEnumerator> nullBitMapsEnumerator = nullBitMaps.GetEnumerator(); + while (bufferEnumerator.MoveNext() && nullBitMapsEnumerator.MoveNext()) + { + ReadOnlyMemory dataBuffer = bufferEnumerator.Current; + ReadOnlyMemory nullBitMap = nullBitMapsEnumerator.Current; + + ReadOnlySpan span = dataBuffer.Span; + for (int j = 0; j < span.Length; j++) + { + // Each buffer has a max length of int.MaxValue + Assert.Equal(span[j], column[j + i * int.MaxValue]); + } + + bool GetBit(byte curBitMap, int index) + { + return ((curBitMap >> (index & 7)) & 1) != 0; + } + ReadOnlySpan bitMapSpan = nullBitMap.Span; + // No nulls in this column, so each bit must be set + for (int j = 0; j < bitMapSpan.Length; j++) + { + for (int k = 0; k < 8; k++) + { + if (j * 8 + k == column.Length) + break; + Assert.True(GetBit(bitMapSpan[j], k)); + } + } + i++; + } + } + + [Fact] + public void TestArrowStringColumnGetReadOnlyBuffers() + { + // Test ArrowStringDataFrameColumn. + StringArray strArray = new StringArray.Builder().Append("foo").Append("bar").Build(); + Memory dataMemory = new byte[] { 102, 111, 111, 98, 97, 114 }; + Memory nullMemory = new byte[] { 1 }; + Memory offsetMemory = new byte[] { 0, 0, 0, 0, 3, 0, 0, 0, 6, 0, 0, 0 }; + + ArrowStringDataFrameColumn column = new ArrowStringDataFrameColumn("String", dataMemory, offsetMemory, nullMemory, strArray.Length, strArray.NullCount); + + IEnumerable> dataBuffers = column.GetReadOnlyDataBuffers(); + IEnumerable> nullBitMaps = column.GetReadOnlyNullBitMapBuffers(); + IEnumerable> offsetsBuffers = column.GetReadOnlyOffsetsBuffers(); + + using (IEnumerator> bufferEnumerator = dataBuffers.GetEnumerator()) + using (IEnumerator> offsetsEnumerator = offsetsBuffers.GetEnumerator()) + using (IEnumerator> nullBitMapsEnumerator = nullBitMaps.GetEnumerator()) + { + while (bufferEnumerator.MoveNext() && nullBitMapsEnumerator.MoveNext() && offsetsEnumerator.MoveNext()) + { + ReadOnlyMemory dataBuffer = bufferEnumerator.Current; + ReadOnlyMemory nullBitMap = nullBitMapsEnumerator.Current; + ReadOnlyMemory offsets = offsetsEnumerator.Current; + + ReadOnlySpan dataSpan = dataBuffer.Span; + ReadOnlySpan offsetsSpan = offsets.Span; + int dataStart = 0; + for (int j = 1; j < offsetsSpan.Length; j++) + { + int length = offsetsSpan[j] - offsetsSpan[j - 1]; + ReadOnlySpan str = dataSpan.Slice(dataStart, length); + ReadOnlySpan columnStr = dataMemory.Span.Slice(dataStart, length); + Assert.Equal(str.Length, columnStr.Length); + for (int s = 0; s < str.Length; s++) + Assert.Equal(str[s], columnStr[s]); + dataStart = length; + } + } + } + } + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs new file mode 100644 index 0000000000..4d1a4f1708 --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.IO; +using System.Runtime.CompilerServices; +using System.Text; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public partial class DataFrameTests + { + [Fact] + public void TestReadCsvWithHeader() + { + string data = @"vendor_id,rate_code,passenger_count,trip_time_in_secs,trip_distance,payment_type,fare_amount +CMT,1,1,1271,3.8,CRD,17.5 +CMT,1,1,474,1.5,CRD,8 +CMT,1,1,637,1.4,CRD,8.5 +CMT,1,1,181,0.6,CSH,4.5"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Assert.Equal(4, df.RowCount); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df["vendor_id"][3]); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.RowCount); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows["vendor_id"][2]); + } + + [Fact] + public void TestReadCsvNoHeader() + { + string data = @"CMT,1,1,1271,3.8,CRD,17.5 +CMT,1,1,474,1.5,CRD,8 +CMT,1,1,637,1.4,CRD,8.5 +CMT,1,1,181,0.6,CSH,4.5"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data), header: false); + Assert.Equal(4, df.RowCount); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df["Column0"][3]); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), header: false, numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.RowCount); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows["Column0"][2]); + } + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs new file mode 100644 index 0000000000..57b530607f --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs @@ -0,0 +1,228 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Linq; +using Microsoft.ML; +using Microsoft.ML.Data; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public partial class DataFrameTests + { + [Fact] + public void TestIDataView() + { + IDataView dataView = MakeDataFrameWithAllColumnTypes(10, withNulls: false); + + DataDebuggerPreview preview = dataView.Preview(); + Assert.Equal(10, preview.RowView.Length); + Assert.Equal(15, preview.ColumnView.Length); + + Assert.Equal("Byte", preview.ColumnView[0].Column.Name); + Assert.Equal((byte)0, preview.ColumnView[0].Values[0]); + Assert.Equal((byte)1, preview.ColumnView[0].Values[1]); + + Assert.Equal("Decimal", preview.ColumnView[1].Column.Name); + Assert.Equal((double)0, preview.ColumnView[1].Values[0]); + Assert.Equal((double)1, preview.ColumnView[1].Values[1]); + + Assert.Equal("Double", preview.ColumnView[2].Column.Name); + Assert.Equal((double)0, preview.ColumnView[2].Values[0]); + Assert.Equal((double)1, preview.ColumnView[2].Values[1]); + + Assert.Equal("Float", preview.ColumnView[3].Column.Name); + Assert.Equal((float)0, preview.ColumnView[3].Values[0]); + Assert.Equal((float)1, preview.ColumnView[3].Values[1]); + + Assert.Equal("Int", preview.ColumnView[4].Column.Name); + Assert.Equal((int)0, preview.ColumnView[4].Values[0]); + Assert.Equal((int)1, preview.ColumnView[4].Values[1]); + + Assert.Equal("Long", preview.ColumnView[5].Column.Name); + Assert.Equal((long)0, preview.ColumnView[5].Values[0]); + Assert.Equal((long)1, preview.ColumnView[5].Values[1]); + + Assert.Equal("Sbyte", preview.ColumnView[6].Column.Name); + Assert.Equal((sbyte)0, preview.ColumnView[6].Values[0]); + Assert.Equal((sbyte)1, preview.ColumnView[6].Values[1]); + + Assert.Equal("Short", preview.ColumnView[7].Column.Name); + Assert.Equal((short)0, preview.ColumnView[7].Values[0]); + Assert.Equal((short)1, preview.ColumnView[7].Values[1]); + + Assert.Equal("Uint", preview.ColumnView[8].Column.Name); + Assert.Equal((uint)0, preview.ColumnView[8].Values[0]); + Assert.Equal((uint)1, preview.ColumnView[8].Values[1]); + + Assert.Equal("Ulong", preview.ColumnView[9].Column.Name); + Assert.Equal((ulong)0, preview.ColumnView[9].Values[0]); + Assert.Equal((ulong)1, preview.ColumnView[9].Values[1]); + + Assert.Equal("Ushort", preview.ColumnView[10].Column.Name); + Assert.Equal((ushort)0, preview.ColumnView[10].Values[0]); + Assert.Equal((ushort)1, preview.ColumnView[10].Values[1]); + + Assert.Equal("String", preview.ColumnView[11].Column.Name); + Assert.Equal("0".AsMemory(), preview.ColumnView[11].Values[0]); + Assert.Equal("1".AsMemory(), preview.ColumnView[11].Values[1]); + + Assert.Equal("Char", preview.ColumnView[12].Column.Name); + Assert.Equal((ushort)65, preview.ColumnView[12].Values[0]); + Assert.Equal((ushort)66, preview.ColumnView[12].Values[1]); + + Assert.Equal("Bool", preview.ColumnView[13].Column.Name); + Assert.Equal(true, preview.ColumnView[13].Values[0]); + Assert.Equal(false, preview.ColumnView[13].Values[1]); + + Assert.Equal("ArrowString", preview.ColumnView[14].Column.Name); + Assert.Equal("foo".ToString(), preview.ColumnView[14].Values[0].ToString()); + Assert.Equal("foo".ToString(), preview.ColumnView[14].Values[1].ToString()); + } + + [Fact] + public void TestIDataViewSchemaInvalidate() + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10, withNulls: false); + + IDataView dataView = df; + + DataViewSchema schema = dataView.Schema; + Assert.Equal(14, schema.Count); + + df.Columns.Remove("Bool"); + schema = dataView.Schema; + Assert.Equal(13, schema.Count); + + DataFrameColumn boolColumn = new PrimitiveDataFrameColumn("Bool", Enumerable.Range(0, (int)df.RowCount).Select(x => x % 2 == 1)); + df.Columns.Insert(0, boolColumn); + schema = dataView.Schema; + Assert.Equal(14, schema.Count); + Assert.Equal("Bool", schema[0].Name); + + DataFrameColumn boolClone = boolColumn.Clone(); + boolClone.SetName("BoolClone"); + df.Columns[1] = boolClone; + schema = dataView.Schema; + Assert.Equal("BoolClone", schema[1].Name); + } + + [Fact] + public void TestIDataViewWithNulls() + { + int length = 10; + IDataView dataView = MakeDataFrameWithAllColumnTypes(length, withNulls: true); + + DataDebuggerPreview preview = dataView.Preview(); + Assert.Equal(length, preview.RowView.Length); + Assert.Equal(15, preview.ColumnView.Length); + + Assert.Equal("Byte", preview.ColumnView[0].Column.Name); + Assert.Equal((byte)0, preview.ColumnView[0].Values[0]); + Assert.Equal((byte)1, preview.ColumnView[0].Values[1]); + Assert.Equal((byte)4, preview.ColumnView[0].Values[4]); + Assert.Equal((byte)0, preview.ColumnView[0].Values[5]); // null row + Assert.Equal((byte)6, preview.ColumnView[0].Values[6]); + + Assert.Equal("Decimal", preview.ColumnView[1].Column.Name); + Assert.Equal((double)0, preview.ColumnView[1].Values[0]); + Assert.Equal((double)1, preview.ColumnView[1].Values[1]); + Assert.Equal((double)4, preview.ColumnView[1].Values[4]); + Assert.Equal(double.NaN, preview.ColumnView[1].Values[5]); // null row + Assert.Equal((double)6, preview.ColumnView[1].Values[6]); + + Assert.Equal("Double", preview.ColumnView[2].Column.Name); + Assert.Equal((double)0, preview.ColumnView[2].Values[0]); + Assert.Equal((double)1, preview.ColumnView[2].Values[1]); + Assert.Equal((double)4, preview.ColumnView[2].Values[4]); + Assert.Equal(double.NaN, preview.ColumnView[2].Values[5]); // null row + Assert.Equal((double)6, preview.ColumnView[2].Values[6]); + + Assert.Equal("Float", preview.ColumnView[3].Column.Name); + Assert.Equal((float)0, preview.ColumnView[3].Values[0]); + Assert.Equal((float)1, preview.ColumnView[3].Values[1]); + Assert.Equal((float)4, preview.ColumnView[3].Values[4]); + Assert.Equal(float.NaN, preview.ColumnView[3].Values[5]); // null row + Assert.Equal((float)6, preview.ColumnView[3].Values[6]); + + Assert.Equal("Int", preview.ColumnView[4].Column.Name); + Assert.Equal((int)0, preview.ColumnView[4].Values[0]); + Assert.Equal((int)1, preview.ColumnView[4].Values[1]); + Assert.Equal((int)4, preview.ColumnView[4].Values[4]); + Assert.Equal((int)0, preview.ColumnView[4].Values[5]); // null row + Assert.Equal((int)6, preview.ColumnView[4].Values[6]); + + Assert.Equal("Long", preview.ColumnView[5].Column.Name); + Assert.Equal((long)0, preview.ColumnView[5].Values[0]); + Assert.Equal((long)1, preview.ColumnView[5].Values[1]); + Assert.Equal((long)4, preview.ColumnView[5].Values[4]); + Assert.Equal((long)0, preview.ColumnView[5].Values[5]); // null row + Assert.Equal((long)6, preview.ColumnView[5].Values[6]); + + Assert.Equal("Sbyte", preview.ColumnView[6].Column.Name); + Assert.Equal((sbyte)0, preview.ColumnView[6].Values[0]); + Assert.Equal((sbyte)1, preview.ColumnView[6].Values[1]); + Assert.Equal((sbyte)4, preview.ColumnView[6].Values[4]); + Assert.Equal((sbyte)0, preview.ColumnView[6].Values[5]); // null row + Assert.Equal((sbyte)6, preview.ColumnView[6].Values[6]); + + Assert.Equal("Short", preview.ColumnView[7].Column.Name); + Assert.Equal((short)0, preview.ColumnView[7].Values[0]); + Assert.Equal((short)1, preview.ColumnView[7].Values[1]); + Assert.Equal((short)4, preview.ColumnView[7].Values[4]); + Assert.Equal((short)0, preview.ColumnView[7].Values[5]); // null row + Assert.Equal((short)6, preview.ColumnView[7].Values[6]); + + Assert.Equal("Uint", preview.ColumnView[8].Column.Name); + Assert.Equal((uint)0, preview.ColumnView[8].Values[0]); + Assert.Equal((uint)1, preview.ColumnView[8].Values[1]); + Assert.Equal((uint)4, preview.ColumnView[8].Values[4]); + Assert.Equal((uint)0, preview.ColumnView[8].Values[5]); // null row + Assert.Equal((uint)6, preview.ColumnView[8].Values[6]); + + Assert.Equal("Ulong", preview.ColumnView[9].Column.Name); + Assert.Equal((ulong)0, preview.ColumnView[9].Values[0]); + Assert.Equal((ulong)1, preview.ColumnView[9].Values[1]); + Assert.Equal((ulong)4, preview.ColumnView[9].Values[4]); + Assert.Equal((ulong)0, preview.ColumnView[9].Values[5]); // null row + Assert.Equal((ulong)6, preview.ColumnView[9].Values[6]); + + Assert.Equal("Ushort", preview.ColumnView[10].Column.Name); + Assert.Equal((ushort)0, preview.ColumnView[10].Values[0]); + Assert.Equal((ushort)1, preview.ColumnView[10].Values[1]); + Assert.Equal((ushort)4, preview.ColumnView[10].Values[4]); + Assert.Equal((ushort)0, preview.ColumnView[10].Values[5]); // null row + Assert.Equal((ushort)6, preview.ColumnView[10].Values[6]); + + Assert.Equal("String", preview.ColumnView[11].Column.Name); + Assert.Equal("0", preview.ColumnView[11].Values[0].ToString()); + Assert.Equal("1", preview.ColumnView[11].Values[1].ToString()); + Assert.Equal("4", preview.ColumnView[11].Values[4].ToString()); + Assert.Equal("", preview.ColumnView[11].Values[5].ToString()); // null row + Assert.Equal("6", preview.ColumnView[11].Values[6].ToString()); + + Assert.Equal("Char", preview.ColumnView[12].Column.Name); + Assert.Equal((ushort)65, preview.ColumnView[12].Values[0]); + Assert.Equal((ushort)66, preview.ColumnView[12].Values[1]); + Assert.Equal((ushort)69, preview.ColumnView[12].Values[4]); + Assert.Equal((ushort)0, preview.ColumnView[12].Values[5]); // null row + Assert.Equal((ushort)71, preview.ColumnView[12].Values[6]); + + Assert.Equal("Bool", preview.ColumnView[13].Column.Name); + Assert.Equal(true, preview.ColumnView[13].Values[0]); + Assert.Equal(false, preview.ColumnView[13].Values[1]); + Assert.Equal(true, preview.ColumnView[13].Values[4]); + Assert.Equal(false, preview.ColumnView[13].Values[5]); // null row + Assert.Equal(true, preview.ColumnView[13].Values[6]); + + Assert.Equal("ArrowString", preview.ColumnView[14].Column.Name); + Assert.Equal("foo", preview.ColumnView[14].Values[0].ToString()); + Assert.Equal("foo", preview.ColumnView[14].Values[1].ToString()); + Assert.Equal("foo", preview.ColumnView[14].Values[4].ToString()); + Assert.Equal("", preview.ColumnView[14].Values[5].ToString()); // null row + Assert.Equal("foo", preview.ColumnView[14].Values[6].ToString()); + } + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs new file mode 100644 index 0000000000..2b8702cff5 --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -0,0 +1,1787 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Apache.Arrow; +using Microsoft.ML; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public partial class DataFrameTests + { + public static DataFrame MakeDataFrameWithTwoColumns(int length, bool withNulls = true) + { + DataFrameColumn dataFrameColumn1 = new PrimitiveDataFrameColumn("Int1", Enumerable.Range(0, length).Select(x => x)); + DataFrameColumn dataFrameColumn2 = new PrimitiveDataFrameColumn("Int2", Enumerable.Range(10, length).Select(x => x)); + if (withNulls) + { + dataFrameColumn1[length / 2] = null; + dataFrameColumn2[length / 2] = null; + } + DataFrame dataFrame = new DataFrame(); + dataFrame.Columns.Insert(0, dataFrameColumn1); + dataFrame.Columns.Insert(1, dataFrameColumn2); + return dataFrame; + } + + public static DataFrameColumn CreateArrowStringColumn(int length, bool withNulls = true) + { + byte[] dataMemory = new byte[length * 3]; + byte[] nullMemory = new byte[BitUtility.ByteCount(length)]; + byte[] offsetMemory = new byte[(length + 1) * 4]; + + // Initialize offset with 0 as the first value + offsetMemory[0] = 0; + offsetMemory[1] = 0; + offsetMemory[2] = 0; + offsetMemory[3] = 0; + + // Append "foo" length times, with a possible `null` in the middle + int validStringsIndex = 0; + for (int i = 0; i < length; i++) + { + if (withNulls && i == length / 2) + { + BitUtility.SetBit(nullMemory, i, false); + } + else + { + int dataMemoryIndex = validStringsIndex * 3; + dataMemory[dataMemoryIndex++] = 102; + dataMemory[dataMemoryIndex++] = 111; + dataMemory[dataMemoryIndex++] = 111; + BitUtility.SetBit(nullMemory, i, true); + + validStringsIndex++; + } + + // write the current length to (index + 1) + int offsetIndex = (i + 1) * 4; + offsetMemory[offsetIndex++] = (byte)(3 * validStringsIndex); + offsetMemory[offsetIndex++] = 0; + offsetMemory[offsetIndex++] = 0; + offsetMemory[offsetIndex++] = 0; + } + + int nullCount = withNulls ? 1 : 0; + return new ArrowStringDataFrameColumn("ArrowString", dataMemory, offsetMemory, nullMemory, length, nullCount); + } + + public static DataFrame MakeDataFrameWithAllColumnTypes(int length, bool withNulls = true) + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(length, withNulls); + DataFrameColumn arrowStringColumn = CreateArrowStringColumn(length, withNulls); + df.Columns.Insert(df.Columns.Count, arrowStringColumn); + return df; + } + + public static DataFrame MakeDataFrameWithAllMutableColumnTypes(int length, bool withNulls = true) + { + DataFrame df = MakeDataFrameWithNumericAndStringColumns(length, withNulls); + DataFrameColumn boolColumn = new PrimitiveDataFrameColumn("Bool", Enumerable.Range(0, length).Select(x => x % 2 == 0)); + df.Columns.Insert(df.Columns.Count, boolColumn); + if (withNulls) + { + boolColumn[length / 2] = null; + } + return df; + } + + public static DataFrame MakeDataFrameWithNumericAndBoolColumns(int length) + { + DataFrame df = MakeDataFrameWithNumericColumns(length); + DataFrameColumn boolColumn = new PrimitiveDataFrameColumn("Bool", Enumerable.Range(0, length).Select(x => x % 2 == 0)); + df.Columns.Insert(df.Columns.Count, boolColumn); + boolColumn[length / 2] = null; + return df; + } + + public static DataFrame MakeDataFrameWithNumericAndStringColumns(int length, bool withNulls = true) + { + DataFrame df = MakeDataFrameWithNumericColumns(length, withNulls); + DataFrameColumn stringColumn = new StringDataFrameColumn("String", Enumerable.Range(0, length).Select(x => x.ToString())); + df.Columns.Insert(df.Columns.Count, stringColumn); + if (withNulls) + { + stringColumn[length / 2] = null; + } + + DataFrameColumn charColumn = new PrimitiveDataFrameColumn("Char", Enumerable.Range(0, length).Select(x => (char)(x + 65))); + df.Columns.Insert(df.Columns.Count, charColumn); + if (withNulls) + { + charColumn[length / 2] = null; + } + return df; + } + + public static DataFrame MakeDataFrameWithNumericColumns(int length, bool withNulls = true) + { + DataFrameColumn byteColumn = new PrimitiveDataFrameColumn("Byte", Enumerable.Range(0, length).Select(x => (byte)x)); + DataFrameColumn decimalColumn = new PrimitiveDataFrameColumn("Decimal", Enumerable.Range(0, length).Select(x => (decimal)x)); + DataFrameColumn doubleColumn = new PrimitiveDataFrameColumn("Double", Enumerable.Range(0, length).Select(x => (double)x)); + DataFrameColumn floatColumn = new PrimitiveDataFrameColumn("Float", Enumerable.Range(0, length).Select(x => (float)x)); + DataFrameColumn intColumn = new PrimitiveDataFrameColumn("Int", Enumerable.Range(0, length).Select(x => x)); + DataFrameColumn longColumn = new PrimitiveDataFrameColumn("Long", Enumerable.Range(0, length).Select(x => (long)x)); + DataFrameColumn sbyteColumn = new PrimitiveDataFrameColumn("Sbyte", Enumerable.Range(0, length).Select(x => (sbyte)x)); + DataFrameColumn shortColumn = new PrimitiveDataFrameColumn("Short", Enumerable.Range(0, length).Select(x => (short)x)); + DataFrameColumn uintColumn = new PrimitiveDataFrameColumn("Uint", Enumerable.Range(0, length).Select(x => (uint)x)); + DataFrameColumn ulongColumn = new PrimitiveDataFrameColumn("Ulong", Enumerable.Range(0, length).Select(x => (ulong)x)); + DataFrameColumn ushortColumn = new PrimitiveDataFrameColumn("Ushort", Enumerable.Range(0, length).Select(x => (ushort)x)); + + DataFrame dataFrame = new DataFrame(new List { byteColumn, decimalColumn, doubleColumn, floatColumn, intColumn, longColumn, sbyteColumn, shortColumn, uintColumn, ulongColumn, ushortColumn }); + + if (withNulls) + { + for (int i = 0; i < dataFrame.Columns.Count; i++) + { + dataFrame.Columns[i][length / 2] = null; + } + } + return dataFrame; + } + + public static DataFrame MakeDataFrame(int length, bool withNulls = true) + where T1 : unmanaged + where T2 : unmanaged + { + DataFrameColumn baseColumn1 = new PrimitiveDataFrameColumn("Column1", Enumerable.Range(0, length).Select(x => (T1)Convert.ChangeType(x % 2 == 0 ? 0 : 1, typeof(T1)))); + DataFrameColumn baseColumn2 = new PrimitiveDataFrameColumn("Column2", Enumerable.Range(0, length).Select(x => (T2)Convert.ChangeType(x % 2 == 0 ? 0 : 1, typeof(T2)))); + DataFrame dataFrame = new DataFrame(new List { baseColumn1, baseColumn2 }); + + if (withNulls) + { + for (int i = 0; i < dataFrame.Columns.Count; i++) + { + dataFrame.Columns[i][length / 2] = null; + } + } + + return dataFrame; + } + + public DataFrame SplitTrainTest(DataFrame input, float testRatio, out DataFrame Test) + { + IEnumerable randomIndices = Enumerable.Range(0, (int)input.RowCount); + IEnumerable trainIndices = randomIndices.Take((int)(input.RowCount * testRatio)); + IEnumerable testIndices = randomIndices.TakeLast((int)(input.RowCount * (1 - testRatio))); + Test = input[testIndices]; + return input[trainIndices]; + } + + + [Fact] + public void TestIndexer() + { + DataFrame dataFrame = MakeDataFrameWithTwoColumns(length: 10); + var foo = dataFrame[0, 0]; + Assert.Equal(0, dataFrame[0, 0]); + Assert.Equal(11, dataFrame[1, 1]); + Assert.Equal(2, dataFrame.Columns.Count); + Assert.Equal("Int1", dataFrame.Columns[0].Name); + + var headList = dataFrame.Head(5); + Assert.Equal(14, (int)headList[4][1]); + + var tailList = dataFrame.Tail(5); + Assert.Equal(19, (int)tailList[4][1]); + + dataFrame[2, 1] = 1000; + Assert.Equal(1000, dataFrame[2, 1]); + + var row = dataFrame[4]; + Assert.Equal(14, (int)row[1]); + + var column = dataFrame["Int2"] as PrimitiveDataFrameColumn; + Assert.Equal(1000, (int)column[2]); + + Assert.Throws(() => dataFrame["Int5"]); + } + + [Fact] + public void ColumnAndTableCreationTest() + { + DataFrameColumn intColumn = new PrimitiveDataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); + DataFrameColumn floatColumn = new PrimitiveDataFrameColumn("FloatColumn", Enumerable.Range(0, 10).Select(x => (float)x)); + DataFrame dataFrame = new DataFrame(); + dataFrame.Columns.Insert(0, intColumn); + dataFrame.Columns.Insert(1, floatColumn); + Assert.Equal(10, dataFrame.RowCount); + Assert.Equal(2, dataFrame.Columns.Count); + Assert.Equal(10, dataFrame.Columns[0].Length); + Assert.Equal("IntColumn", dataFrame.Columns[0].Name); + Assert.Equal(10, dataFrame.Columns[1].Length); + Assert.Equal("FloatColumn", dataFrame.Columns[1].Name); + + DataFrameColumn bigColumn = new PrimitiveDataFrameColumn("BigColumn", Enumerable.Range(0, 11).Select(x => (float)x)); + DataFrameColumn repeatedName = new PrimitiveDataFrameColumn("FloatColumn", Enumerable.Range(0, 10).Select(x => (float)x)); + Assert.Throws(() => dataFrame.Columns.Insert(2, bigColumn)); + Assert.Throws(() => dataFrame.Columns.Insert(2, repeatedName)); + Assert.Throws(() => dataFrame.Columns.Insert(10, repeatedName)); + + Assert.Equal(2, dataFrame.Columns.Count); + DataFrameColumn intColumnCopy = new PrimitiveDataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); + Assert.Throws(() => dataFrame.Columns[1] = intColumnCopy); + + DataFrameColumn differentIntColumn = new PrimitiveDataFrameColumn("IntColumn1", Enumerable.Range(0, 10).Select(x => x)); + dataFrame.Columns[1] = differentIntColumn; + Assert.True(object.ReferenceEquals(differentIntColumn, dataFrame.Columns[1])); + + dataFrame.Columns.RemoveAt(1); + Assert.Single(dataFrame.Columns); + Assert.True(ReferenceEquals(intColumn, dataFrame.Columns[0])); + } + + [Fact] + public void InsertAndRemoveColumnTests() + { + DataFrame dataFrame = MakeDataFrameWithAllMutableColumnTypes(10); + DataFrameColumn intColumn = new PrimitiveDataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); + DataFrameColumn charColumn = dataFrame["Char"]; + int insertedIndex = dataFrame.Columns.Count; + dataFrame.Columns.Insert(dataFrame.Columns.Count, intColumn); + dataFrame.Columns.RemoveAt(0); + DataFrameColumn intColumn_1 = dataFrame["IntColumn"]; + DataFrameColumn charColumn_1 = dataFrame["Char"]; + Assert.True(ReferenceEquals(intColumn, intColumn_1)); + Assert.True(ReferenceEquals(charColumn, charColumn_1)); + } + + [Fact] + public void TestBinaryOperations() + { + DataFrame df = MakeDataFrameWithTwoColumns(12); + IReadOnlyList listOfInts = new List() { 5, 5 }; + + // The following binary ops return a copy + var ret = df.Add(5); + Assert.Equal(0, df[0, 0]); + Assert.Equal(5, ret[0, 0]); + ret = df.Add(listOfInts); + Assert.Equal(0, df[0, 0]); + Assert.Equal(5, ret[0, 0]); + ret = df.Subtract(5); + Assert.Equal(0, df[0, 0]); + Assert.Equal(-5, ret[0, 0]); + ret = df.Subtract(listOfInts); + Assert.Equal(0, df[0, 0]); + Assert.Equal(-5, ret[0, 0]); + ret = df.Multiply(5); + Assert.Equal(1, df[1, 0]); + Assert.Equal(5, ret[1, 0]); + ret = df.Multiply(listOfInts); + Assert.Equal(1, df[1, 0]); + Assert.Equal(5, ret[1, 0]); + ret = df.Divide(5); + Assert.Equal(5, df[5, 0]); + Assert.Equal(1, ret[5, 0]); + ret = df.Divide(listOfInts); + Assert.Equal(5, df[5, 0]); + Assert.Equal(1, ret[5, 0]); + ret = df.Modulo(5); + Assert.Equal(5, df[5, 0]); + Assert.Equal(0, ret[5, 0]); + ret = df.Modulo(listOfInts); + Assert.Equal(5, df[5, 0]); + Assert.Equal(0, ret[5, 0]); + + Assert.Equal(true, df.ElementwiseGreaterThanOrEqual(5)[7, 0]); + Assert.Equal(true, df.ElementwiseGreaterThanOrEqual(listOfInts)[7, 0]); + Assert.Equal(true, df.ElementwiseLessThanOrEqual(5)[4, 0]); + Assert.Equal(true, df.ElementwiseLessThanOrEqual(listOfInts)[4, 0]); + Assert.Equal(false, df.ElementwiseGreaterThan(5)[5, 0]); + Assert.Equal(false, df.ElementwiseGreaterThan(listOfInts)[5, 0]); + Assert.Equal(false, df.ElementwiseLessThan(5)[5, 0]); + Assert.Equal(false, df.ElementwiseLessThan(listOfInts)[5, 0]); + // The following binary ops are in place + Assert.Equal(5, df.Add(5, inPlace: true)[0, 0]); + Assert.Equal(10, df.Add(listOfInts, inPlace: true)[0, 0]); + Assert.Equal(5, df.Subtract(5, inPlace: true)[0, 0]); + Assert.Equal(0, df.Subtract(listOfInts, inPlace: true)[0, 0]); + Assert.Equal(5, df.Multiply(5, inPlace: true)[1, 0]); + Assert.Equal(25, df.Multiply(listOfInts, inPlace: true)[1, 0]); + Assert.Equal(5, df.Divide(5, inPlace: true)[1, 0]); + Assert.Equal(1, df.Divide(listOfInts, inPlace: true)[1, 0]); + Assert.Equal(1, df.Modulo(5, inPlace: true)[1, 0]); + Assert.Equal(1, df.Modulo(listOfInts, inPlace: true)[1, 0]); + Assert.Equal(2, df.LeftShift(1)[1, 0]); + Assert.Equal(1, df.RightShift(1)[2, 0]); + } + + [Fact] + public void TestBinaryOperationsWithColumns() + { + int length = 10; + var df1 = MakeDataFrameWithNumericColumns(length); + var df2 = MakeDataFrameWithNumericColumns(length); + + DataFrameColumn newColumn; + DataFrameColumn verify; + for (int i = 0; i < df1.Columns.Count; i++) + { + newColumn = df1[df1.Columns[i].Name] + df2[df2.Columns[i].Name]; + verify = newColumn.ElementwiseEquals(df1.Columns[i] * 2); + Assert.Equal(true, verify[0]); + + newColumn = df1[df1.Columns[i].Name] - df2[df2.Columns[i].Name]; + verify = newColumn.ElementwiseEquals(0); + Assert.Equal(true, verify[0]); + + newColumn = df1[df1.Columns[i].Name] * df2[df2.Columns[i].Name]; + verify = newColumn.ElementwiseEquals(df1.Columns[i] * df1.Columns[i]); + Assert.Equal(true, verify[0]); + + var df1Column = df1.Columns[i] + 1; + var df2Column = df2.Columns[i] + 1; + newColumn = df1Column / df2Column; + verify = newColumn.ElementwiseEquals(1); + Assert.Equal(true, verify[0]); + + newColumn = df1Column % df2Column; + verify = newColumn.ElementwiseEquals(0); + Assert.Equal(true, verify[0]); + + verify = df1[df1.Columns[i].Name].ElementwiseEquals(df2[df2.Columns[i].Name]); + Assert.True(verify.All()); + + verify = df1[df1.Columns[i].Name].ElementwiseNotEquals(df2[df2.Columns[i].Name]); + Assert.False(verify.Any()); + + verify = df1[df1.Columns[i].Name].ElementwiseGreaterThanOrEqual(df2[df2.Columns[i].Name]); + Assert.True(verify.All()); + + verify = df1[df1.Columns[i].Name].ElementwiseLessThanOrEqual(df2[df2.Columns[i].Name]); + Assert.True(verify.All()); + + verify = df1[df1.Columns[i].Name].ElementwiseGreaterThan(df2[df2.Columns[i].Name]); + Assert.False(verify.Any()); + + verify = df1[df1.Columns[i].Name].ElementwiseLessThan(df2[df2.Columns[i].Name]); + Assert.False(verify.Any()); + } + } + + [Fact] + public void TestBinaryOperationsWithConversions() + { + DataFrame df = DataFrameTests.MakeDataFrameWithTwoColumns(10); + + // Add a double to an int column + DataFrame dfd = df.Add(5.0f); + var dtype = dfd.Columns[0].DataType; + Assert.True(dtype == typeof(double)); + + // Add a decimal to an int column + DataFrame dfm = df.Add(5.0m); + dtype = dfm.Columns[0].DataType; + Assert.True(dtype == typeof(decimal)); + + // int + bool should throw + Assert.Throws(() => df.Add(true)); + + var dataFrameColumn1 = new PrimitiveDataFrameColumn("Double1", Enumerable.Range(0, 10).Select(x => (double)x)); + df.Columns[0] = dataFrameColumn1; + // Double + comparison ops should throw + Assert.Throws(() => df.And(true)); + } + + [Fact] + public void TestBinaryOperationsOnBoolColumn() + { + var df = new DataFrame(); + var dataFrameColumn1 = new PrimitiveDataFrameColumn("Bool1", Enumerable.Range(0, 10).Select(x => true)); + var dataFrameColumn2 = new PrimitiveDataFrameColumn("Bool2", Enumerable.Range(0, 10).Select(x => true)); + df.Columns.Insert(0, dataFrameColumn1); + df.Columns.Insert(1, dataFrameColumn2); + + // bool + int should throw + Assert.Throws(() => df.Add(5)); + // Left shift should throw + Assert.Throws(() => df.LeftShift(5)); + + IReadOnlyList listOfBools = new List() { true, false }; + // boolean and And should work + var newdf = df.And(true); + Assert.Equal(true, newdf[4, 0]); + var newdf1 = df.And(listOfBools); + Assert.Equal(false, newdf1[4, 1]); + + newdf = df.Or(true); + Assert.Equal(true, newdf[4, 0]); + newdf1 = df.Or(listOfBools); + Assert.Equal(true, newdf1[4, 1]); + + newdf = df.Xor(true); + Assert.Equal(false, newdf[4, 0]); + newdf1 = df.Xor(listOfBools); + Assert.Equal(true, newdf1[4, 1]); + } + + [Fact] + public void TestBinaryOperationsOnArrowStringColumn() + { + var df = new DataFrame(); + var strArrayBuilder = new StringArray.Builder(); + for (int i = 0; i < 10; i++) + { + strArrayBuilder.Append(i.ToString()); + } + StringArray strArray = strArrayBuilder.Build(); + + ArrowStringDataFrameColumn stringColumn = new ArrowStringDataFrameColumn("String", strArray.ValueBuffer.Memory, strArray.ValueOffsetsBuffer.Memory, strArray.NullBitmapBuffer.Memory, strArray.Length, strArray.NullCount); + df.Columns.Insert(0, stringColumn); + + DataFrameColumn newCol = stringColumn.ElementwiseEquals(4); + Assert.Equal(true, newCol[4]); + Assert.Equal(false, newCol[0]); + Assert.Equal(false, newCol[5]); + + newCol = stringColumn.ElementwiseEquals("4"); + Assert.Equal(true, newCol[4]); + Assert.Equal(false, newCol[0]); + + newCol = stringColumn.ElementwiseEquals("foo"); + Assert.False(newCol.All()); + newCol = stringColumn.ElementwiseEquals(null); + Assert.False(newCol.All()); + + ArrowStringDataFrameColumn stringColumnCopy = new ArrowStringDataFrameColumn("String", strArray.ValueBuffer.Memory, strArray.ValueOffsetsBuffer.Memory, strArray.NullBitmapBuffer.Memory, strArray.Length, strArray.NullCount); + newCol = stringColumn.ElementwiseEquals(stringColumnCopy); + Assert.True(newCol.All()); + + newCol = stringColumn.ElementwiseNotEquals(5); + Assert.Equal(true, newCol[0]); + Assert.Equal(false, newCol[5]); + + newCol = stringColumn.ElementwiseNotEquals("5"); + Assert.Equal(true, newCol[0]); + Assert.Equal(false, newCol[5]); + + newCol = stringColumn.ElementwiseNotEquals("foo"); + Assert.True(newCol.All()); + newCol = stringColumn.ElementwiseNotEquals(null); + Assert.True(newCol.All()); + + newCol = stringColumn.ElementwiseNotEquals(stringColumnCopy); + Assert.False(newCol.All()); + } + + [Fact] + public void TestBinaryOperationsOnStringColumn() + { + var df = new DataFrame(); + DataFrameColumn stringColumn = new StringDataFrameColumn("String", Enumerable.Range(0, 10).Select(x => x.ToString())); + df.Columns.Insert(0, stringColumn); + + DataFrameColumn newCol = stringColumn.ElementwiseEquals(5); + Assert.Equal(true, newCol[5]); + Assert.Equal(false, newCol[0]); + + newCol = (stringColumn as StringDataFrameColumn).ElementwiseEquals("5"); + Assert.Equal(true, newCol[5]); + Assert.Equal(false, newCol[0]); + + DataFrameColumn stringColumnCopy = new StringDataFrameColumn("String", Enumerable.Range(0, 10).Select(x => x.ToString())); + newCol = stringColumn.ElementwiseEquals(stringColumnCopy); + Assert.Equal(true, newCol[5]); + Assert.Equal(true, newCol[0]); + + newCol = stringColumn.ElementwiseNotEquals(5); + Assert.Equal(false, newCol[5]); + Assert.Equal(true, newCol[0]); + + newCol = (stringColumn as StringDataFrameColumn).ElementwiseNotEquals("5"); + Assert.Equal(false, newCol[5]); + Assert.Equal(true, newCol[0]); + + newCol = stringColumn.ElementwiseNotEquals(stringColumnCopy); + Assert.Equal(false, newCol[5]); + Assert.Equal(false, newCol[0]); + + StringDataFrameColumn typedStringColumn = stringColumn as StringDataFrameColumn; + newCol = typedStringColumn.Add("suffix"); + for (int i = 0; i < newCol.Length; i++) + { + Assert.Equal(newCol[i], typedStringColumn[i] + "suffix"); + } + DataFrameColumn addString = typedStringColumn + "suffix"; + for (int i = 0; i < addString.Length; i++) + { + Assert.Equal(addString[i], typedStringColumn[i] + "suffix"); + } + Assert.True(newCol.ElementwiseEquals(addString).All()); + addString = "prefix" + typedStringColumn; + for (int i = 0; i < addString.Length; i++) + { + Assert.Equal(addString[i], "prefix" + typedStringColumn[i]); + } + } + + [Fact] + public void TestBinaryOperatorsWithConversions() + { + var df = MakeDataFrameWithNumericColumns(10); + + DataFrame tempDf = df + 1; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + (double)1); + tempDf = df + 1.1; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + 1.1); + tempDf = df + 1.1m; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + 1.1m); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + Assert.Throws(() => df + true); + + tempDf = df - 1.1; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] - 1.1); + tempDf = df - 1.1m; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] - 1.1m); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + tempDf = df * 1.1; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] * 1.1); + tempDf = df * 1.1m; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] * 1.1m); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + tempDf = df / 1.1; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] / 1.1); + tempDf = df / 1.1m; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] / 1.1m); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + tempDf = df % 1.1; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] % 1.1); + tempDf = df % 1.1m; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] % 1.1m); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + Assert.Equal((byte)0, df[0, 0]); + } + + [Fact] + public void TestProjectionAndAppend() + { + DataFrame df = MakeDataFrameWithTwoColumns(10); + + df["Int3"] = df["Int1"] * 2 + df["Int2"]; + Assert.Equal(16, df["Int3"][2]); + } + + [Fact] + public void TestComputations() + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); + df["Int"][0] = -10; + Assert.Equal(-10, df["Int"][0]); + + DataFrameColumn absColumn = df["Int"].Abs(); + Assert.Equal(10, absColumn[0]); + Assert.Equal(-10, df["Int"][0]); + df["Int"].Abs(true); + Assert.Equal(10, df["Int"][0]); + + Assert.Throws(() => df["Byte"].All()); + Assert.Throws(() => df["Byte"].Any()); + Assert.Throws(() => df["Char"].All()); + Assert.Throws(() => df["Char"].Any()); + Assert.Throws(() => df["Decimal"].All()); + Assert.Throws(() => df["Decimal"].Any()); + Assert.Throws(() => df["Double"].All()); + Assert.Throws(() => df["Double"].Any()); + Assert.Throws(() => df["Float"].All()); + Assert.Throws(() => df["Float"].Any()); + Assert.Throws(() => df["Int"].All()); + Assert.Throws(() => df["Int"].Any()); + Assert.Throws(() => df["Long"].All()); + Assert.Throws(() => df["Long"].Any()); + Assert.Throws(() => df["Sbyte"].All()); + Assert.Throws(() => df["Sbyte"].Any()); + Assert.Throws(() => df["Short"].All()); + Assert.Throws(() => df["Short"].Any()); + Assert.Throws(() => df["Uint"].All()); + Assert.Throws(() => df["Uint"].Any()); + Assert.Throws(() => df["Ulong"].All()); + Assert.Throws(() => df["Ulong"].Any()); + Assert.Throws(() => df["Ushort"].All()); + Assert.Throws(() => df["Ushort"].Any()); + + bool any = df["Bool"].Any(); + bool all = df["Bool"].All(); + Assert.True(any); + Assert.False(all); + + // Test the computation results + df["Double"][0] = 100.0; + DataFrameColumn doubleColumn = df["Double"].CumulativeMax(); + for (int i = 0; i < doubleColumn.Length; i++) + { + if (i == 5) + Assert.Null(doubleColumn[i]); + else + Assert.Equal(100.0, (double)doubleColumn[i]); + } + Assert.Equal(1.0, df["Double"][1]); + df["Double"].CumulativeMax(true); + for (int i = 0; i < df["Double"].Length; i++) + { + if (i == 5) + Assert.Null(df["Double"][i]); + else + Assert.Equal(100.0, (double)df["Double"][i]); + } + + df["Float"][0] = -10.0f; + DataFrameColumn floatColumn = df["Float"].CumulativeMin(); + for (int i = 0; i < floatColumn.Length; i++) + { + if (i == 5) + Assert.Null(floatColumn[i]); + else + Assert.Equal(-10.0f, (float)floatColumn[i]); + } + Assert.Equal(9.0f, df["Float"][9]); + df["Float"].CumulativeMin(true); + for (int i = 0; i < df["Float"].Length; i++) + { + if (i == 5) + Assert.Null(df["Float"][i]); + else + Assert.Equal(-10.0f, (float)df["Float"][i]); + } + + DataFrameColumn uintColumn = df["Uint"].CumulativeProduct(); + Assert.Equal((uint)0, uintColumn[8]); + Assert.Equal((uint)8, df["Uint"][8]); + df["Uint"].CumulativeProduct(true); + Assert.Equal((uint)0, df["Uint"][9]); + + DataFrameColumn ushortColumn = df["Ushort"].CumulativeSum(); + Assert.Equal((ushort)40, ushortColumn[9]); + Assert.Equal((ushort)9, df["Ushort"][9]); + df["Ushort"].CumulativeSum(true); + Assert.Equal((ushort)40, df["Ushort"][9]); + + Assert.Equal(100.0, df["Double"].Max()); + Assert.Equal(-10.0f, df["Float"].Min()); + Assert.Equal((uint)0, df["Uint"].Product()); + Assert.Equal((ushort)140, df["Ushort"].Sum()); + + df["Double"][0] = 100.1; + Assert.Equal(100.1, df["Double"][0]); + DataFrameColumn roundColumn = df["Double"].Round(); + Assert.Equal(100.0, roundColumn[0]); + Assert.Equal(100.1, df["Double"][0]); + df["Double"].Round(true); + Assert.Equal(100.0, df["Double"][0]); + + // Test that none of the numeric column types throw + for (int i = 0; i < df.Columns.Count; i++) + { + DataFrameColumn column = df.Columns[i]; + if (column.DataType == typeof(bool)) + { + Assert.Throws(() => column.CumulativeMax()); + Assert.Throws(() => column.CumulativeMin()); + Assert.Throws(() => column.CumulativeProduct()); + Assert.Throws(() => column.CumulativeSum()); + Assert.Throws(() => column.Max()); + Assert.Throws(() => column.Min()); + Assert.Throws(() => column.Product()); + Assert.Throws(() => column.Sum()); + continue; + } + else if (column.DataType == typeof(string)) + { + Assert.Throws(() => column.CumulativeMax()); + Assert.Throws(() => column.CumulativeMin()); + Assert.Throws(() => column.CumulativeProduct()); + Assert.Throws(() => column.CumulativeSum()); + Assert.Throws(() => column.Max()); + Assert.Throws(() => column.Min()); + Assert.Throws(() => column.Product()); + Assert.Throws(() => column.Sum()); + continue; + } + column.CumulativeMax(); + column.CumulativeMin(); + column.CumulativeProduct(); + column.CumulativeSum(); + column.Max(); + column.Min(); + column.Product(); + column.Sum(); + } + } + + [Fact] + public void TestSort() + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(20); + df["Int"][0] = 100; + df["Int"][19] = -1; + df["Int"][5] = 2000; + + // Sort by "Int" in ascending order + var sortedDf = df.Sort("Int"); + Assert.Null(sortedDf["Int"][19]); + Assert.Equal(-1, sortedDf["Int"][0]); + Assert.Equal(100, sortedDf["Int"][17]); + Assert.Equal(2000, sortedDf["Int"][18]); + + // Sort by "Int" in descending order + sortedDf = df.Sort("Int", false); + Assert.Null(sortedDf["Int"][19]); + Assert.Equal(-1, sortedDf["Int"][18]); + Assert.Equal(100, sortedDf["Int"][1]); + Assert.Equal(2000, sortedDf["Int"][0]); + + // Sort by "String" in ascending order + sortedDf = df.Sort("String"); + Assert.Null(sortedDf["Int"][19]); + Assert.Equal(1, sortedDf["Int"][1]); + Assert.Equal(8, sortedDf["Int"][17]); + Assert.Equal(9, sortedDf["Int"][18]); + + sortedDf = df.Sort("String", false); + Assert.Null(sortedDf["Int"][19]); + Assert.Equal(8, sortedDf["Int"][1]); + Assert.Equal(9, sortedDf["Int"][0]); + } + + [Fact] + public void TestSplitAndSort() + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(20); + df["Int"][0] = 100000; + df["Int"][df.RowCount - 1] = -1; + df["Int"][5] = 200000; + DataFrame dfTest; + DataFrame dfTrain = SplitTrainTest(df, 0.8f, out dfTest); + + // Sort by "Int" in ascending order + var sortedDf = dfTrain.Sort("Int"); + Assert.Null(sortedDf["Int"][sortedDf.RowCount - 1]); + Assert.Equal(1, sortedDf["Int"][0]); + Assert.Equal(100000, sortedDf["Int"][sortedDf.RowCount - 3]); + Assert.Equal(200000, sortedDf["Int"][sortedDf.RowCount - 2]); + } + + [Fact] + public void TestStringColumnSort() + { + // StringDataFrameColumn specific sort tests + StringDataFrameColumn strColumn = new StringDataFrameColumn("String", 0); + Assert.Equal(0, strColumn.NullCount); + for (int i = 0; i < 5; i++) + { + strColumn.Append(null); + } + Assert.Equal(5, strColumn.NullCount); + // Should handle all nulls + StringDataFrameColumn sortedStrColumn = strColumn.Sort() as StringDataFrameColumn; + Assert.Equal(5, sortedStrColumn.NullCount); + Assert.Null(sortedStrColumn[0]); + + for (int i = 0; i < 5; i++) + { + strColumn.Append(i.ToString()); + } + Assert.Equal(5, strColumn.NullCount); + + // Ascending sort + sortedStrColumn = strColumn.Sort() as StringDataFrameColumn; + Assert.Equal("0", sortedStrColumn[0]); + Assert.Null(sortedStrColumn[9]); + + // Descending sort + sortedStrColumn = strColumn.Sort(false) as StringDataFrameColumn; + Assert.Equal("4", sortedStrColumn[0]); + Assert.Null(sortedStrColumn[9]); + } + + [Theory] + [InlineData(5)] + [InlineData(12)] + [InlineData(100)] + [InlineData(1000)] + public void TestPrimitiveColumnSort(int numberOfNulls) + { + // Primitive Column Sort + PrimitiveDataFrameColumn intColumn = new PrimitiveDataFrameColumn("Int", 0); + Assert.Equal(0, intColumn.NullCount); + intColumn.AppendMany(null, numberOfNulls); + Assert.Equal(numberOfNulls, intColumn.NullCount); + + // Should handle all nulls + PrimitiveDataFrameColumn sortedIntColumn = intColumn.Sort() as PrimitiveDataFrameColumn; + Assert.Equal(numberOfNulls, sortedIntColumn.NullCount); + Assert.Null(sortedIntColumn[0]); + + for (int i = 0; i < 5; i++) + { + intColumn.Append(i); + } + Assert.Equal(numberOfNulls, intColumn.NullCount); + + // Ascending sort + sortedIntColumn = intColumn.Sort() as PrimitiveDataFrameColumn; + Assert.Equal(0, sortedIntColumn[0]); + Assert.Null(sortedIntColumn[9]); + + // Descending sort + sortedIntColumn = intColumn.Sort(false) as PrimitiveDataFrameColumn; + Assert.Equal(4, sortedIntColumn[0]); + Assert.Null(sortedIntColumn[9]); + } + + private void VerifyJoin(DataFrame join, DataFrame left, DataFrame right, JoinAlgorithm joinAlgorithm) + { + PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("map", join.RowCount); + for (long i = 0; i < join.RowCount; i++) + { + mapIndices[i] = i; + } + for (int i = 0; i < join.Columns.Count; i++) + { + DataFrameColumn joinColumn = join.Columns[i]; + DataFrameColumn isEqual; + + if (joinAlgorithm == JoinAlgorithm.Left) + { + if (i < left.Columns.Count) + { + DataFrameColumn leftColumn = left.Columns[i]; + isEqual = joinColumn.ElementwiseEquals(leftColumn); + } + else + { + int columnIndex = i - left.Columns.Count; + DataFrameColumn rightColumn = right.Columns[columnIndex]; + DataFrameColumn compareColumn = rightColumn.Length <= join.RowCount ? rightColumn.Clone(numberOfNullsToAppend: join.RowCount - rightColumn.Length) : rightColumn.Clone(mapIndices); + isEqual = joinColumn.ElementwiseEquals(compareColumn); + } + } + else if (joinAlgorithm == JoinAlgorithm.Right) + { + if (i < left.Columns.Count) + { + DataFrameColumn leftColumn = left.Columns[i]; + DataFrameColumn compareColumn = leftColumn.Length <= join.RowCount ? leftColumn.Clone(numberOfNullsToAppend: join.RowCount - leftColumn.Length) : leftColumn.Clone(mapIndices); + isEqual = joinColumn.ElementwiseEquals(compareColumn); + } + else + { + int columnIndex = i - left.Columns.Count; + DataFrameColumn rightColumn = right.Columns[columnIndex]; + isEqual = joinColumn.ElementwiseEquals(rightColumn); + } + } + else if (joinAlgorithm == JoinAlgorithm.Inner) + { + if (i < left.Columns.Count) + { + DataFrameColumn leftColumn = left.Columns[i]; + isEqual = joinColumn.ElementwiseEquals(leftColumn.Clone(mapIndices)); + } + else + { + int columnIndex = i - left.Columns.Count; + DataFrameColumn rightColumn = right.Columns[columnIndex]; + isEqual = joinColumn.ElementwiseEquals(rightColumn.Clone(mapIndices)); + } + } + else + { + if (i < left.Columns.Count) + { + DataFrameColumn leftColumn = left.Columns[i]; + isEqual = joinColumn.ElementwiseEquals(leftColumn.Clone(numberOfNullsToAppend: join.RowCount - leftColumn.Length)); + } + else + { + int columnIndex = i - left.Columns.Count; + DataFrameColumn rightColumn = right.Columns[columnIndex]; + isEqual = joinColumn.ElementwiseEquals(rightColumn.Clone(numberOfNullsToAppend: join.RowCount - rightColumn.Length)); + } + } + for (int j = 0; j < join.RowCount; j++) + { + Assert.Equal(true, isEqual[j]); + } + } + } + + private void VerifyMerge(DataFrame merge, DataFrame left, DataFrame right, JoinAlgorithm joinAlgorithm) + { + if (joinAlgorithm == JoinAlgorithm.Left || joinAlgorithm == JoinAlgorithm.Inner) + { + HashSet intersection = new HashSet(); + for (int i = 0; i < merge["Int_left"].Length; i++) + { + if (merge["Int_left"][i] == null) + continue; + intersection.Add((int)merge["Int_left"][i]); + } + for (int i = 0; i < left["Int"].Length; i++) + { + if (left["Int"][i] != null && intersection.Contains((int)left["Int"][i])) + intersection.Remove((int)left["Int"][i]); + } + Assert.Empty(intersection); + } + else if (joinAlgorithm == JoinAlgorithm.Right) + { + HashSet intersection = new HashSet(); + for (int i = 0; i < merge["Int_right"].Length; i++) + { + if (merge["Int_right"][i] == null) + continue; + intersection.Add((int)merge["Int_right"][i]); + } + for (int i = 0; i < right["Int"].Length; i++) + { + if (right["Int"][i] != null && intersection.Contains((int)right["Int"][i])) + intersection.Remove((int)right["Int"][i]); + } + Assert.Empty(intersection); + } + else if (joinAlgorithm == JoinAlgorithm.FullOuter) + { + VerifyMerge(merge, left, right, JoinAlgorithm.Left); + VerifyMerge(merge, left, right, JoinAlgorithm.Right); + } + } + + [Fact] + public void TestJoin() + { + DataFrame left = MakeDataFrameWithAllMutableColumnTypes(10); + DataFrame right = MakeDataFrameWithAllMutableColumnTypes(5); + + // Tests with right.RowCount < left.RowCount + // Left join + DataFrame join = left.Join(right); + Assert.Equal(join.RowCount, left.RowCount); + Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Null(join["Int_right"][6]); + VerifyJoin(join, left, right, JoinAlgorithm.Left); + + // Right join + join = left.Join(right, joinAlgorithm: JoinAlgorithm.Right); + Assert.Equal(join.RowCount, right.RowCount); + Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(join["Int_right"][3], right["Int"][3]); + Assert.Null(join["Int_right"][2]); + VerifyJoin(join, left, right, JoinAlgorithm.Right); + + // Outer join + join = left.Join(right, joinAlgorithm: JoinAlgorithm.FullOuter); + Assert.Equal(join.RowCount, left.RowCount); + Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Null(join["Int_right"][6]); + VerifyJoin(join, left, right, JoinAlgorithm.FullOuter); + + // Inner join + join = left.Join(right, joinAlgorithm: JoinAlgorithm.Inner); + Assert.Equal(join.RowCount, right.RowCount); + Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(join["Int_right"][3], right["Int"][3]); + Assert.Null(join["Int_right"][2]); + VerifyJoin(join, left, right, JoinAlgorithm.Inner); + + // Tests with right.RowCount > left.RowCount + // Left join + right = MakeDataFrameWithAllMutableColumnTypes(15); + join = left.Join(right); + Assert.Equal(join.RowCount, left.RowCount); + Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(join["Int_right"][6], right["Int"][6]); + VerifyJoin(join, left, right, JoinAlgorithm.Left); + + // Right join + join = left.Join(right, joinAlgorithm: JoinAlgorithm.Right); + Assert.Equal(join.RowCount, right.RowCount); + Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(join["Int_right"][2], right["Int"][2]); + Assert.Null(join["Int_left"][12]); + VerifyJoin(join, left, right, JoinAlgorithm.Right); + + // Outer join + join = left.Join(right, joinAlgorithm: JoinAlgorithm.FullOuter); + Assert.Equal(join.RowCount, right.RowCount); + Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Null(join["Int_left"][12]); + VerifyJoin(join, left, right, JoinAlgorithm.FullOuter); + + // Inner join + join = left.Join(right, joinAlgorithm: JoinAlgorithm.Inner); + Assert.Equal(join.RowCount, left.RowCount); + Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(join["Int_right"][2], right["Int"][2]); + VerifyJoin(join, left, right, JoinAlgorithm.Inner); + } + + [Fact] + public void TestGroupBy() + { + DataFrame df = MakeDataFrameWithNumericAndBoolColumns(10); + DataFrame count = df.GroupBy("Bool").Count(); + Assert.Equal(2, count.RowCount); + Assert.Equal((long)5, count["Int"][0]); + Assert.Equal((long)4, count["Decimal"][1]); + for (int r = 0; r < count.RowCount; r++) + { + for (int c = 1; c < count.Columns.Count; c++) + { + Assert.Equal((long)(r == 0 ? 5 : 4), count.Columns[c][r]); + } + } + + DataFrame first = df.GroupBy("Bool").First(); + Assert.Equal(2, first.RowCount); + for (int r = 0; r < 2; r++) + { + for (int c = 0; c < count.Columns.Count; c++) + { + DataFrameColumn originalColumn = df.Columns[c]; + DataFrameColumn firstColumn = first[originalColumn.Name]; + Assert.Equal(originalColumn[r], firstColumn[r]); + } + } + + DataFrame head = df.GroupBy("Bool").Head(3); + List verify = new List() { 0, 3, 1, 4, 2, 5 }; + for (int r = 0; r < 5; r++) + { + for (int c = 0; c < count.Columns.Count; c++) + { + DataFrameColumn originalColumn = df.Columns[c]; + DataFrameColumn headColumn = head[originalColumn.Name]; + Assert.Equal(originalColumn[r].ToString(), headColumn[verify[r]].ToString()); + } + } + for (int c = 0; c < count.Columns.Count; c++) + { + DataFrameColumn originalColumn = df.Columns[c]; + if (originalColumn.Name == "Bool") + continue; + DataFrameColumn headColumn = head[originalColumn.Name]; + Assert.Equal(originalColumn[5], headColumn[verify[5]]); + } + Assert.Equal(6, head.RowCount); + + DataFrame tail = df.GroupBy("Bool").Tail(3); + Assert.Equal(6, tail.RowCount); + List originalColumnVerify = new List() { 6, 8, 7, 9 }; + List tailColumnVerity = new List() { 1, 2, 4, 5 }; + for (int r = 0; r < 4; r++) + { + for (int c = 0; c < count.Columns.Count; c++) + { + DataFrameColumn originalColumn = df.Columns[c]; + DataFrameColumn tailColumn = tail[originalColumn.Name]; + Assert.Equal(originalColumn[originalColumnVerify[r]].ToString(), tailColumn[tailColumnVerity[r]].ToString()); + } + } + + DataFrame max = df.GroupBy("Bool").Max(); + Assert.Equal(2, max.RowCount); + for (int r = 0; r < 2; r++) + { + for (int c = 0; c < count.Columns.Count; c++) + { + DataFrameColumn originalColumn = df.Columns[c]; + if (originalColumn.Name == "Bool" || originalColumn.Name == "Char") + continue; + DataFrameColumn maxColumn = max[originalColumn.Name]; + Assert.Equal(((long)(r == 0 ? 8 : 9)).ToString(), maxColumn[r].ToString()); + } + } + + DataFrame min = df.GroupBy("Bool").Min(); + Assert.Equal(2, min.RowCount); + + DataFrame product = df.GroupBy("Bool").Product(); + Assert.Equal(2, product.RowCount); + + DataFrame sum = df.GroupBy("Bool").Sum(); + Assert.Equal(2, sum.RowCount); + + DataFrame mean = df.GroupBy("Bool").Mean(); + Assert.Equal(2, mean.RowCount); + for (int r = 0; r < 2; r++) + { + for (int c = 0; c < count.Columns.Count; c++) + { + DataFrameColumn originalColumn = df.Columns[c]; + if (originalColumn.Name == "Bool" || originalColumn.Name == "Char") + continue; + DataFrameColumn minColumn = min[originalColumn.Name]; + Assert.Equal("0", minColumn[r].ToString()); + + DataFrameColumn productColumn = product[originalColumn.Name]; + Assert.Equal("0", productColumn[r].ToString()); + + DataFrameColumn sumColumn = sum[originalColumn.Name]; + Assert.Equal("20", sumColumn[r].ToString()); + } + } + + DataFrame columnSum = df.GroupBy("Bool").Sum("Int"); + Assert.Equal(2, columnSum.Columns.Count); + Assert.Equal(20, columnSum["Int"][0]); + Assert.Equal(20, columnSum["Int"][1]); + DataFrame columnMax = df.GroupBy("Bool").Max("Int"); + Assert.Equal(2, columnMax.Columns.Count); + Assert.Equal(8, columnMax["Int"][0]); + Assert.Equal(9, columnMax["Int"][1]); + DataFrame columnProduct = df.GroupBy("Bool").Product("Int"); + Assert.Equal(2, columnProduct.Columns.Count); + Assert.Equal(0, columnProduct["Int"][0]); + Assert.Equal(0, columnProduct["Int"][1]); + DataFrame columnMin = df.GroupBy("Bool").Min("Int"); + Assert.Equal(2, columnMin.Columns.Count); + Assert.Equal(0, columnMin["Int"][0]); + Assert.Equal(0, columnMin["Int"][1]); + + DataFrame countIntColumn = df.GroupBy("Bool").Count("Int"); + Assert.Equal(2, countIntColumn.Columns.Count); + Assert.Equal(2, countIntColumn.RowCount); + Assert.Equal((long)5, countIntColumn["Int"][0]); + Assert.Equal((long)4, countIntColumn["Int"][1]); + + DataFrame firstDecimalColumn = df.GroupBy("Bool").First("Decimal"); + Assert.Equal(2, firstDecimalColumn.Columns.Count); + Assert.Equal(2, firstDecimalColumn.RowCount); + Assert.Equal((decimal)0, firstDecimalColumn["Decimal"][0]); + Assert.Equal((decimal)1, firstDecimalColumn["Decimal"][1]); + } + + [Fact] + public void TestGoupByDifferentColumnTypes() + { + void GroupCountAndAssert(DataFrame frame) + { + DataFrame grouped = frame.GroupBy("Column1").Count(); + Assert.Equal(2, grouped.RowCount); + } + + DataFrame df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + + df = MakeDataFrame(10, false); + GroupCountAndAssert(df); + } + + [Fact] + public void TestIEnumerable() + { + DataFrame df = MakeDataFrameWithAllColumnTypes(10); + + int totalValueCount = 0; + for (int i = 0; i < df.Columns.Count; i++) + { + DataFrameColumn baseColumn = df.Columns[i]; + foreach (object value in baseColumn) + { + totalValueCount++; + } + } + Assert.Equal(10 * df.Columns.Count, totalValueCount); + + // spot check a few column types: + + StringDataFrameColumn stringColumn = (StringDataFrameColumn)df["String"]; + StringBuilder actualStrings = new StringBuilder(); + foreach (string value in stringColumn) + { + if (value == null) + { + actualStrings.Append(""); + } + else + { + actualStrings.Append(value); + } + } + Assert.Equal("012346789", actualStrings.ToString()); + + ArrowStringDataFrameColumn arrowStringColumn = (ArrowStringDataFrameColumn)df["ArrowString"]; + actualStrings.Clear(); + foreach (string value in arrowStringColumn) + { + if (value == null) + { + actualStrings.Append(""); + } + else + { + actualStrings.Append(value); + } + } + Assert.Equal("foofoofoofoofoofoofoofoofoo", actualStrings.ToString()); + + PrimitiveDataFrameColumn floatColumn = (PrimitiveDataFrameColumn)df["Float"]; + actualStrings.Clear(); + foreach (float? value in floatColumn) + { + if (value == null) + { + actualStrings.Append(""); + } + else + { + actualStrings.Append(value); + } + } + Assert.Equal("012346789", actualStrings.ToString()); + + PrimitiveDataFrameColumn intColumn = (PrimitiveDataFrameColumn)df["Int"]; + actualStrings.Clear(); + foreach (int? value in intColumn) + { + if (value == null) + { + actualStrings.Append(""); + } + else + { + actualStrings.Append(value); + } + } + Assert.Equal("012346789", actualStrings.ToString()); + } + + [Fact] + public void TestColumnClip() + { + DataFrame df = MakeDataFrameWithNumericColumns(10); + // Out of place + DataFrameColumn clipped = df["Int"].Clip(3, 7); + Assert.Equal(3, clipped[0]); + Assert.Equal(0, df["Int"][0]); + Assert.Equal(3, clipped[1]); + Assert.Equal(1, df["Int"][1]); + Assert.Equal(3, clipped[2]); + Assert.Equal(2, df["Int"][2]); + Assert.Equal(3, clipped[3]); + Assert.Equal(3, df["Int"][3]); + Assert.Equal(4, clipped[4]); + Assert.Equal(4, df["Int"][4]); + Assert.Null(clipped[5]); + Assert.Null(df["Int"][5]); + Assert.Equal(6, clipped[6]); + Assert.Equal(6, df["Int"][6]); + Assert.Equal(7, clipped[7]); + Assert.Equal(7, df["Int"][7]); + Assert.Equal(7, clipped[8]); + Assert.Equal(8, df["Int"][8]); + Assert.Equal(7, clipped[9]); + Assert.Equal(9, df["Int"][9]); + + // In place + df["Int"].Clip(3, 7, true); + Assert.Equal(3, df["Int"][0]); + Assert.Equal(3, df["Int"][1]); + Assert.Equal(3, df["Int"][2]); + Assert.Equal(3, df["Int"][3]); + Assert.Equal(4, df["Int"][4]); + Assert.Null(df["Int"][5]); + Assert.Equal(6, df["Int"][6]); + Assert.Equal(7, df["Int"][7]); + Assert.Equal(7, df["Int"][8]); + Assert.Equal(7, df["Int"][9]); + } + + [Fact] + public void TestColumnFilter() + { + DataFrame df = MakeDataFrameWithNumericColumns(10); + DataFrameColumn filtered = df["Int"].Filter(3, 7); + Assert.Equal(4, filtered.Length); + Assert.Equal(3, filtered[0]); + Assert.Equal(4, filtered[1]); + Assert.Equal(6, filtered[2]); + Assert.Equal(7, filtered[3]); + } + + [Fact] + public void TestDataFrameClip() + { + DataFrame df = MakeDataFrameWithAllColumnTypes(10); + IEnumerable dfColumns = ((IDataView)df).Schema; + + void VerifyDataFrameClip(DataFrame clippedColumn) + { + + IEnumerable clippedColumns = ((IDataView)clippedColumn).Schema; + Assert.Equal(df.Columns.Count, clippedColumn.Columns.Count); + Assert.Equal(dfColumns, clippedColumns); + for (int c = 0; c < df.Columns.Count; c++) + { + DataFrameColumn column = clippedColumn.Columns[c]; + if (column.IsNumericColumn()) + { + for (int i = 0; i < 4; i++) + { + Assert.Equal("3", column[i].ToString()); + } + Assert.Equal(4.ToString(), column[4].ToString()); + Assert.Null(column[5]); + Assert.Equal(6.ToString(), column[6].ToString()); + for (int i = 7; i < 10; i++) + { + Assert.Equal("7", column[i].ToString()); + } + } + else + { + for (int i = 0; i < column.Length; i++) + { + var colD = df.Columns[c][i]; + var ocD = column[i]; + Assert.Equal(df.Columns[c][i], column[i]); + } + } + } + } + + // Out of place + DataFrame clipped = df.Clip(3, 7); + VerifyDataFrameClip(clipped); + for (int i = 0; i < 10; i++) + { + if (i != 5) + Assert.Equal(i, df["Int"][i]); + else + Assert.Null(df["Int"][5]); + } + + // Inplace + df.Clip(3, 7, true); + VerifyDataFrameClip(df); + + } + + [Fact] + public void TestDataFrameFilter() + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); + DataFrame boolColumnFiltered = df[df["Bool"].ElementwiseEquals(true)]; + List verify = new List { 0, 2, 4, 6, 8 }; + Assert.Equal(5, boolColumnFiltered.RowCount); + for (int i = 0; i < boolColumnFiltered.Columns.Count; i++) + { + DataFrameColumn column = boolColumnFiltered.Columns[i]; + if (column.Name == "Char" || column.Name == "Bool" || column.Name == "String") + continue; + for (int j = 0; j < column.Length; j++) + { + Assert.Equal(verify[j].ToString(), column[j].ToString()); + } + } + DataFrame intEnumerableFiltered = df[Enumerable.Range(0, 10)]; + DataFrame boolEnumerableFiltered = df[Enumerable.Range(0, 10).Select(x => true)]; + DataFrame longEnumerableFiltered = df[Enumerable.Range(0, 10).Select(x => (long)x)]; + Assert.Equal(intEnumerableFiltered.Columns.Count, df.Columns.Count); + Assert.Equal(boolEnumerableFiltered.Columns.Count, df.Columns.Count); + Assert.Equal(longEnumerableFiltered.Columns.Count, df.Columns.Count); + for (int i = 0; i < intEnumerableFiltered.Columns.Count; i++) + { + DataFrameColumn intFilteredColumn = intEnumerableFiltered.Columns[i]; + DataFrameColumn dfColumn = df.Columns[i]; + DataFrameColumn boolFilteredColumn = boolEnumerableFiltered.Columns[i]; + DataFrameColumn longFilteredColumn = longEnumerableFiltered.Columns[i]; + Assert.True(intFilteredColumn.ElementwiseEquals(dfColumn).All()); + Assert.True(boolFilteredColumn.ElementwiseEquals(dfColumn).All()); + Assert.True(longFilteredColumn.ElementwiseEquals(dfColumn).All()); + } + } + + [Fact] + public void TestPrefixAndSuffix() + { + DataFrame df = MakeDataFrameWithAllColumnTypes(10); + IEnumerable columnNames = ((IDataView)df).Schema; + + DataFrame prefix = df.AddPrefix("Prefix_"); + IEnumerable prefixNames = ((IDataView)prefix).Schema; + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(((IDataView)df).Schema)) + { + Assert.Equal(First.Name, Second.Name); + } + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in prefixNames.Zip(columnNames)) + { + Assert.Equal(First.Name, "Prefix_" + Second.Name); + } + + // Inplace + df.AddPrefix("Prefix_", true); + prefixNames = ((IDataView)df).Schema; + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(prefixNames)) + { + Assert.Equal("Prefix_" + First.Name, Second.Name); + } + + DataFrame suffix = df.AddSuffix("_Suffix"); + IEnumerable suffixNames = ((IDataView)suffix).Schema; + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in ((IDataView)df).Schema.Zip(columnNames)) + { + Assert.Equal(First.Name, "Prefix_" + Second.Name); + } + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(suffixNames)) + { + Assert.Equal("Prefix_" + First.Name + "_Suffix", Second.Name); + } + + // InPlace + df.AddSuffix("_Suffix", true); + suffixNames = ((IDataView)df).Schema; + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(suffixNames)) + { + Assert.Equal("Prefix_" + First.Name + "_Suffix", Second.Name); + } + } + + [Fact] + public void TestSample() + { + DataFrame df = MakeDataFrameWithAllColumnTypes(10); + DataFrame sampled = df.Sample(3); + Assert.Equal(3, sampled.RowCount); + Assert.Equal(df.Columns.Count, sampled.Columns.Count); + } + + [Fact] + public void TestMerge() + { + DataFrame left = MakeDataFrameWithAllMutableColumnTypes(10); + DataFrame right = MakeDataFrameWithAllMutableColumnTypes(5); + + // Tests with right.RowCount < left.RowCount + // Left merge + DataFrame merge = left.Merge(right, "Int", "Int"); + Assert.Equal(10, merge.RowCount); + Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Null(merge["Int_right"][6]); + Assert.Null(merge["Int_left"][5]); + VerifyMerge(merge, left, right, JoinAlgorithm.Left); + + // Right merge + merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Right); + Assert.Equal(5, merge.RowCount); + Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(merge["Int_right"][3], right["Int"][3]); + Assert.Null(merge["Int_right"][2]); + VerifyMerge(merge, left, right, JoinAlgorithm.Right); + + // Outer merge + merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.FullOuter); + Assert.Equal(merge.RowCount, left.RowCount); + Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Null(merge["Int_right"][6]); + VerifyMerge(merge, left, right, JoinAlgorithm.FullOuter); + + // Inner merge + merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Inner); + Assert.Equal(merge.RowCount, right.RowCount); + Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(merge["Int_right"][2], right["Int"][3]); + Assert.Null(merge["Int_right"][4]); + VerifyMerge(merge, left, right, JoinAlgorithm.Inner); + + // Tests with right.RowCount > left.RowCount + // Left merge + right = MakeDataFrameWithAllMutableColumnTypes(15); + merge = left.Merge(right, "Int", "Int"); + Assert.Equal(merge.RowCount, left.RowCount); + Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(merge["Int_right"][6], right["Int"][6]); + VerifyMerge(merge, left, right, JoinAlgorithm.Left); + + // Right merge + merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Right); + Assert.Equal(merge.RowCount, right.RowCount); + Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(merge["Int_right"][2], right["Int"][2]); + Assert.Null(merge["Int_left"][12]); + VerifyMerge(merge, left, right, JoinAlgorithm.Right); + + // Outer merge + merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.FullOuter); + Assert.Equal(16, merge.RowCount); + Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Null(merge["Int_left"][12]); + Assert.Null(merge["Int_left"][5]); + VerifyMerge(merge, left, right, JoinAlgorithm.FullOuter); + + // Inner merge + merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Inner); + Assert.Equal(9, merge.RowCount); + Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); + Assert.Equal(merge["Int_right"][2], right["Int"][2]); + VerifyMerge(merge, left, right, JoinAlgorithm.Inner); + } + + [Fact] + public void TestDescription() + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); + DataFrame description = df.Description(); + DataFrameColumn descriptionColumn = description.Columns[0]; + Assert.Equal("Description", descriptionColumn.Name); + Assert.Equal("Length", descriptionColumn[0]); + Assert.Equal("Max", descriptionColumn[1]); + Assert.Equal("Min", descriptionColumn[2]); + Assert.Equal("Mean", descriptionColumn[3]); + for (int i = 1; i < description.Columns.Count; i++) + { + DataFrameColumn column = description.Columns[i]; + Assert.Equal(df.Columns[i - 1].Name, column.Name); + Assert.Equal(4, column.Length); + Assert.Equal((float)9, column[0]); + Assert.Equal((float)9, column[1]); + Assert.Equal((float)0, column[2]); + Assert.Equal((float)4, column[3]); + } + } + + [Fact] + public void TestDropNulls() + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(20); + DataFrame anyNulls = df.DropNulls(); + Assert.Equal(19, anyNulls.RowCount); + + DataFrame allNulls = df.DropNulls(DropNullOptions.All); + Assert.Equal(19, allNulls.RowCount); + } + + [Fact] + public void TestFillNulls() + { + DataFrame df = MakeDataFrameWithTwoColumns(20); + Assert.Null(df[10, 0]); + DataFrame fillNulls = df.FillNulls(1000); + Assert.Equal(1000, (int)fillNulls[10, 1]); + Assert.Null(df[10, 0]); + df.FillNulls(1000, true); + Assert.Equal(1000, df[10, 1]); + + StringDataFrameColumn strColumn = new StringDataFrameColumn("String", 0); + strColumn.Append(null); + strColumn.Append(null); + Assert.Equal(2, strColumn.Length); + Assert.Equal(2, strColumn.NullCount); + DataFrameColumn filled = strColumn.FillNulls("foo"); + Assert.Equal(2, strColumn.Length); + Assert.Equal(2, strColumn.NullCount); + Assert.Equal(2, filled.Length); + Assert.Equal(0, filled.NullCount); + Assert.Equal("foo", filled[0]); + Assert.Equal("foo", filled[1]); + Assert.Null(strColumn[0]); + Assert.Null(strColumn[1]); + + // In place + strColumn.FillNulls("foo", true); + Assert.Equal(2, strColumn.Length); + Assert.Equal(0, strColumn.NullCount); + Assert.Equal("foo", strColumn[0]); + Assert.Equal("foo", strColumn[1]); + } + + [Fact] + public void TestValueCounts() + { + DataFrame df = MakeDataFrameWithAllColumnTypes(10, withNulls: false); + DataFrame valueCounts = df["Bool"].ValueCounts(); + Assert.Equal(2, valueCounts.RowCount); + Assert.Equal((long)5, valueCounts["Counts"][0]); + Assert.Equal((long)5, valueCounts["Counts"][1]); + } + + [Fact] + public void TestApplyElementwiseNullCount() + { + DataFrame df = MakeDataFrameWithTwoColumns(10); + PrimitiveDataFrameColumn column = df["Int1"] as PrimitiveDataFrameColumn; + Assert.Equal(1, column.NullCount); + + // Change all existing values to null + column.ApplyElementwise((int? value, long rowIndex) => + { + if (!(value is null)) + return null; + return value; + }); + Assert.Equal(column.Length, column.NullCount); + + // Don't change null values + column.ApplyElementwise((int? value, long rowIndex) => + { + return value; + }); + Assert.Equal(column.Length, column.NullCount); + + // Change all null values to real values + column.ApplyElementwise((int? value, long rowIndex) => + { + return 5; + }); + Assert.Equal(0, column.NullCount); + + // Don't change real values + column.ApplyElementwise((int? value, long rowIndex) => + { + return value; + }); + Assert.Equal(0, column.NullCount); + + } + + [Theory] + [InlineData(10, 5)] + [InlineData(20, 20)] + public void TestClone(int dfLength, int intDfLength) + { + DataFrame df = MakeDataFrameWithAllColumnTypes(dfLength, withNulls: true); + DataFrame intDf = MakeDataFrameWithTwoColumns(intDfLength, false); + PrimitiveDataFrameColumn intColumn = intDf["Int1"] as PrimitiveDataFrameColumn; + DataFrame clone = df[intColumn]; + Assert.Equal(intDfLength, clone.RowCount); + Assert.Equal(df.Columns.Count, clone.Columns.Count); + for (int i = 0; i < df.Columns.Count; i++) + { + DataFrameColumn dfColumn = df.Columns[i]; + DataFrameColumn cloneColumn = clone.Columns[i]; + for (long r = 0; r < clone.RowCount; r++) + { + Assert.Equal(dfColumn[r], cloneColumn[r]); + } + } + } + + [Fact] + public void TestColumnCreationFromExisitingColumn() + { + DataFrame df = MakeDataFrameWithAllColumnTypes(10); + PrimitiveDataFrameColumn bigInts = new PrimitiveDataFrameColumn("BigInts", df["Int"].ElementwiseGreaterThan(5)); + for (int i = 0; i < 10; i++) + { + if (i <= 5) + Assert.False(bigInts[i]); + else + Assert.True(bigInts[i]); + } + } + + [Fact] + public void TestColumns() + { + DataFrame df = MakeDataFrameWithAllColumnTypes(10); + IReadOnlyList columns = df.Columns; + int i = 0; + Assert.Equal(columns.Count, df.Columns.Count); + foreach (DataFrameColumn dataFrameColumn in columns) + { + Assert.Equal(dataFrameColumn, df.Columns[i++]); + } + + } + + [Fact] + public void TestAppendRow() + { + DataFrame df = MakeDataFrame(10); + df.Append(new List { 5, true }); + Assert.Equal(11, df.RowCount); + Assert.Equal(1, df.Columns[0].NullCount); + Assert.Equal(1, df.Columns[1].NullCount); + + df.Append(new List { 100 }); + Assert.Equal(12, df.RowCount); + Assert.Equal(1, df.Columns[0].NullCount); + Assert.Equal(2, df.Columns[1].NullCount); + + df.Append(new List { null, null }); + Assert.Equal(13, df.RowCount); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(3, df.Columns[1].NullCount); + + df.Append(new List> { KeyValuePair.Create("Column1", (object)5), KeyValuePair.Create("Column2", (object)false) }); + Assert.Equal(14, df.RowCount); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(3, df.Columns[1].NullCount); + + df.Append(new List> { KeyValuePair.Create("Column1", (object)5)}); + Assert.Equal(15, df.RowCount); + Assert.Equal(15, df["Column1"].Length); + Assert.Equal(15, df["Column2"].Length); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(4, df.Columns[1].NullCount); + + df.Append(new List> { KeyValuePair.Create("Column2", (object)false) }); + Assert.Equal(16, df.RowCount); + Assert.Equal(16, df["Column1"].Length); + Assert.Equal(16, df["Column2"].Length); + Assert.Equal(3, df.Columns[0].NullCount); + Assert.Equal(4, df.Columns[1].NullCount); + + df.Append((IEnumerable)null); + Assert.Equal(17, df.RowCount); + Assert.Equal(17, df["Column1"].Length); + Assert.Equal(17, df["Column2"].Length); + Assert.Equal(4, df.Columns[0].NullCount); + Assert.Equal(5, df.Columns[1].NullCount); + + // DataFrame must remain usable even if Append throws + Assert.Throws(() => df.Append(new List { 5, "str" })); + Assert.Throws(() => df.Append(new List> { KeyValuePair.Create("Column2", (object)"str") })); + Assert.Throws(() => df.Append(new List { 5, true, true })); + + df.Append(); + Assert.Equal(18, df.RowCount); + Assert.Equal(18, df["Column1"].Length); + Assert.Equal(18, df["Column2"].Length); + Assert.Equal(5, df.Columns[0].NullCount); + Assert.Equal(6, df.Columns[1].NullCount); + } + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj new file mode 100644 index 0000000000..fb7ad0c725 --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj @@ -0,0 +1,18 @@ + + + + netcoreapp3.0 + + + + + + + + + + + + + + From f09c30c2d7442eacf6128bcf47aa2b91fa3324a3 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 7 Nov 2019 09:20:31 -0800 Subject: [PATCH 02/53] APIs for reversed binary operators (#2769) * Support reverse binary operators * Fix file left behind in a rebase * Fix whitespace --- .../ColumnArithmeticTemplate.ttinclude | 66 +- .../DataFrame.BinaryOperations.cs | 193 ++- .../DataFrame.BinaryOperations.tt | 45 +- .../DataFrame.BinaryOperators.cs | 343 ++++ .../DataFrame.BinaryOperators.tt | 11 + .../DataFrameColumn.BinaryOperations.cs | 117 ++ .../DataFrameColumn.BinaryOperations.tt | 30 + .../DataFrameColumn.BinaryOperators.cs | 408 +++++ .../DataFrameColumn.BinaryOperators.tt | 12 + .../Microsoft.Data.Analysis.csproj | 9 + ...imitiveColumnContainer.BinaryOperations.cs | 76 +- ...imitiveColumnContainer.BinaryOperations.tt | 11 +- ...ataFrameColumn.ReversedBinaryOperations.cs | 394 +++++ ...ataFrameColumn.ReversedBinaryOperations.tt | 110 ++ .../PrimitiveDataFrameColumnArithmetic.cs | 1438 ++++++++++++++++- .../PrimitiveDataFrameColumnArithmetic.tt | 28 + .../DataFrameTests.cs | 90 ++ 17 files changed, 3335 insertions(+), 46 deletions(-) create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt diff --git a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude index 5176fb3680..55960ee376 100644 --- a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude +++ b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude @@ -96,36 +96,36 @@ public MethodConfiguration[] methodConfiguration = new [] { new MethodConfiguration("Add", MethodType.Binary, "+", isNumeric:true), - new MethodConfiguration("Add", MethodType.BinaryScalar, "+", isNumeric:true), + new MethodConfiguration("Add", MethodType.BinaryScalar, "+", isNumeric:true, methodComments: "Performs an element wise addition on each column"), new MethodConfiguration("Subtract", MethodType.Binary, "-", isNumeric:true), - new MethodConfiguration("Subtract", MethodType.BinaryScalar, "-", isNumeric:true), + new MethodConfiguration("Subtract", MethodType.BinaryScalar, "-", isNumeric:true, methodComments: "Performs an element wise subtraction on each column"), new MethodConfiguration("Multiply", MethodType.Binary, "*", isNumeric:true), // element-wise product, not matrix product - new MethodConfiguration("Multiply", MethodType.BinaryScalar, "*", isNumeric:true), + new MethodConfiguration("Multiply", MethodType.BinaryScalar, "*", isNumeric:true, methodComments: "Performs an element wise multiplication on each column"), new MethodConfiguration("Divide", MethodType.Binary, "/", isNumeric:true), - new MethodConfiguration("Divide", MethodType.BinaryScalar, "/", isNumeric:true), + new MethodConfiguration("Divide", MethodType.BinaryScalar, "/", isNumeric:true, methodComments: "Performs an element wise division on each column"), new MethodConfiguration("Modulo", MethodType.Binary, "%", isNumeric:true), - new MethodConfiguration("Modulo", MethodType.BinaryScalar, "%", isNumeric:true), + new MethodConfiguration("Modulo", MethodType.BinaryScalar, "%", isNumeric:true, methodComments: "Performs an element wise modulus operation on each column"), new MethodConfiguration("And", MethodType.Binary, "&", isBitwise: true), - new MethodConfiguration("And", MethodType.BinaryScalar, "&", isBitwise: true), + new MethodConfiguration("And", MethodType.BinaryScalar, "&", isBitwise: true, methodComments: "Performs an element wise boolean And on each column"), new MethodConfiguration("Or", MethodType.Binary, "|", isBitwise: true), - new MethodConfiguration("Or", MethodType.BinaryScalar, "|", isBitwise: true), + new MethodConfiguration("Or", MethodType.BinaryScalar, "|", isBitwise: true, methodComments: "Performs an element wise boolean Or on each column"), new MethodConfiguration("Xor", MethodType.Binary, "^", isBitwise: true), - new MethodConfiguration("Xor", MethodType.BinaryScalar, "^", isBitwise: true), - new MethodConfiguration("LeftShift", MethodType.BinaryInt, "<<", isBitwise: true), - new MethodConfiguration("RightShift", MethodType.BinaryInt, ">>", isBitwise: true), + new MethodConfiguration("Xor", MethodType.BinaryScalar, "^", isBitwise: true, methodComments: "Performs an element wise boolean Xor on each column"), + new MethodConfiguration("LeftShift", MethodType.BinaryInt, "<<", isBitwise: true, methodComments: "Performs an element wise left shift on each column"), + new MethodConfiguration("RightShift", MethodType.BinaryInt, ">>", isBitwise: true, methodComments: "Performs an element wise right shift on each column"), new MethodConfiguration("ElementwiseEquals", MethodType.Comparison, "=="), - new MethodConfiguration("ElementwiseEquals", MethodType.ComparisonScalar, "=="), + new MethodConfiguration("ElementwiseEquals", MethodType.ComparisonScalar, "==", methodComments: "Performs an element wise equals on each column"), new MethodConfiguration("ElementwiseNotEquals", MethodType.Comparison, "!="), - new MethodConfiguration("ElementwiseNotEquals", MethodType.ComparisonScalar, "!="), + new MethodConfiguration("ElementwiseNotEquals", MethodType.ComparisonScalar, "!=", methodComments: "Performs an element wise not-equals on each column"), new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.Comparison, ">=", isNumeric:true), - new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.ComparisonScalar, ">=", isNumeric:true), + new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.ComparisonScalar, ">=", isNumeric:true, methodComments: "Performs an element wise greater than or equal on each column"), new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.Comparison, "<=", isNumeric:true), - new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.ComparisonScalar, "<=", isNumeric:true), + new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.ComparisonScalar, "<=", isNumeric:true, methodComments: "Performs an element wise less than or equal on each column"), new MethodConfiguration("ElementwiseGreaterThan", MethodType.Comparison, ">", isNumeric:true), - new MethodConfiguration("ElementwiseGreaterThan", MethodType.ComparisonScalar, ">", isNumeric:true), + new MethodConfiguration("ElementwiseGreaterThan", MethodType.ComparisonScalar, ">", isNumeric:true, methodComments: "Performs an element wise greater than on each column"), new MethodConfiguration("ElementwiseLessThan", MethodType.Comparison, "<", isNumeric:true), - new MethodConfiguration("ElementwiseLessThan", MethodType.ComparisonScalar, "<", isNumeric:true), + new MethodConfiguration("ElementwiseLessThan", MethodType.ComparisonScalar, "<", isNumeric:true, methodComments: "Performs an element wise less than on each column"), }; public class MethodConfiguration @@ -196,12 +196,35 @@ public string Operator { get; } public string MethodComments { get; } + public string GetColumnSpecificMethodComments() + { + var str = MethodComments; + return str.Replace("column", "value in the column"); + } + + public string GetReverseMethodComments() + { + var str = MethodComments; + return str.Replace(" an", " a reversed"); + } + + public string GetColumnSpecificReverseMethodComments() + { + return GetColumnSpecificMethodComments().Replace(" an", " a reversed"); + } + public string GetMethodSignature(string columnType, string genericType) { var arguments = GetMethodArguments(columnType, genericType); return $"void {MethodName}({arguments})"; } + public string GetInvertedMethodSignatureForBinaryScalarsOps(string columnType, string genericType) + { + var arguments = GetInvertedMethodArguments(columnType, genericType); + return $"void {MethodName}({arguments})"; + } + public string GetSingleArgumentMethodSignature(string columnType, string genericType) { var arguments = GetSingleParameterMethodArguments(columnType, genericType); @@ -222,6 +245,17 @@ } } + public string GetInvertedMethodArguments(string dataFrameType, string genericType) + { + switch (MethodType) + { + case MethodType.BinaryScalar: + return $"{genericType} {Op2Name}, {dataFrameType}<{genericType}> {Op1Name}"; + default: + throw new ArgumentException(); + } + } + public string GetMethodArguments(string dataFrameType, string genericType) { switch (MethodType) diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs index 0a0119dc2b..fbb9314b89 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs @@ -12,8 +12,6 @@ namespace Microsoft.Data.Analysis { public partial class DataFrame { - #region Binary Operations - public DataFrame Add(IReadOnlyList values, bool inPlace = false) where T : unmanaged { @@ -34,6 +32,9 @@ public DataFrame Add(IReadOnlyList values, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise addition on each column + /// public DataFrame Add(T value, bool inPlace = false) where T : unmanaged { @@ -70,6 +71,9 @@ public DataFrame Subtract(IReadOnlyList values, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise subtraction on each column + /// public DataFrame Subtract(T value, bool inPlace = false) where T : unmanaged { @@ -106,6 +110,9 @@ public DataFrame Multiply(IReadOnlyList values, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise multiplication on each column + /// public DataFrame Multiply(T value, bool inPlace = false) where T : unmanaged { @@ -142,6 +149,9 @@ public DataFrame Divide(IReadOnlyList values, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise division on each column + /// public DataFrame Divide(T value, bool inPlace = false) where T : unmanaged { @@ -178,6 +188,9 @@ public DataFrame Modulo(IReadOnlyList values, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise modulus operation on each column + /// public DataFrame Modulo(T value, bool inPlace = false) where T : unmanaged { @@ -213,6 +226,9 @@ public DataFrame And(IReadOnlyList values, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise boolean And on each column + /// public DataFrame And(bool value, bool inPlace = false) { DataFrame retDataFrame = inPlace ? this : new DataFrame(); @@ -247,6 +263,9 @@ public DataFrame Or(IReadOnlyList values, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise boolean Or on each column + /// public DataFrame Or(bool value, bool inPlace = false) { DataFrame retDataFrame = inPlace ? this : new DataFrame(); @@ -281,6 +300,9 @@ public DataFrame Xor(IReadOnlyList values, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise boolean Xor on each column + /// public DataFrame Xor(bool value, bool inPlace = false) { DataFrame retDataFrame = inPlace ? this : new DataFrame(); @@ -296,6 +318,9 @@ public DataFrame Xor(bool value, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise left shift on each column + /// public DataFrame LeftShift(int value, bool inPlace = false) { DataFrame retDataFrame = inPlace ? this : new DataFrame(); @@ -311,6 +336,9 @@ public DataFrame LeftShift(int value, bool inPlace = false) } return retDataFrame; } + /// + /// Performs an element wise right shift on each column + /// public DataFrame RightShift(int value, bool inPlace = false) { DataFrame retDataFrame = inPlace ? this : new DataFrame(); @@ -343,6 +371,9 @@ public DataFrame ElementwiseEquals(IReadOnlyList values) } return retDataFrame; } + /// + /// Performs an element wise equals on each column + /// public DataFrame ElementwiseEquals(T value) where T : unmanaged { @@ -373,6 +404,9 @@ public DataFrame ElementwiseNotEquals(IReadOnlyList values) } return retDataFrame; } + /// + /// Performs an element wise not-equals on each column + /// public DataFrame ElementwiseNotEquals(T value) where T : unmanaged { @@ -403,6 +437,9 @@ public DataFrame ElementwiseGreaterThanOrEqual(IReadOnlyList values) } return retDataFrame; } + /// + /// Performs an element wise greater than or equal on each column + /// public DataFrame ElementwiseGreaterThanOrEqual(T value) where T : unmanaged { @@ -433,6 +470,9 @@ public DataFrame ElementwiseLessThanOrEqual(IReadOnlyList values) } return retDataFrame; } + /// + /// Performs an element wise less than or equal on each column + /// public DataFrame ElementwiseLessThanOrEqual(T value) where T : unmanaged { @@ -463,6 +503,9 @@ public DataFrame ElementwiseGreaterThan(IReadOnlyList values) } return retDataFrame; } + /// + /// Performs an element wise greater than on each column + /// public DataFrame ElementwiseGreaterThan(T value) where T : unmanaged { @@ -493,6 +536,9 @@ public DataFrame ElementwiseLessThan(IReadOnlyList values) } return retDataFrame; } + /// + /// Performs an element wise less than on each column + /// public DataFrame ElementwiseLessThan(T value) where T : unmanaged { @@ -506,6 +552,147 @@ public DataFrame ElementwiseLessThan(T value) } return retDataFrame; } - #endregion + + /// + /// Performs a reversed element wise addition on each column + /// + public DataFrame ReverseAdd(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ReverseAdd(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + /// + /// Performs a reversed element wise subtraction on each column + /// + public DataFrame ReverseSubtract(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ReverseSubtract(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + /// + /// Performs a reversed element wise multiplication on each column + /// + public DataFrame ReverseMultiply(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ReverseMultiply(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + /// + /// Performs a reversed element wise division on each column + /// + public DataFrame ReverseDivide(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ReverseDivide(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + /// + /// Performs a reversed element wise modulus operation on each column + /// + public DataFrame ReverseModulo(T value, bool inPlace = false) + where T : unmanaged + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ReverseModulo(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + /// + /// Performs a reversed element wise boolean And on each column + /// + public DataFrame ReverseAnd(bool value, bool inPlace = false) + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ReverseAnd(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + /// + /// Performs a reversed element wise boolean Or on each column + /// + public DataFrame ReverseOr(bool value, bool inPlace = false) + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ReverseOr(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } + /// + /// Performs a reversed element wise boolean Xor on each column + /// + public DataFrame ReverseXor(bool value, bool inPlace = false) + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.ReverseXor(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } } } diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.tt b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.tt index 40f0e008b1..cbd854109e 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.tt @@ -18,18 +18,25 @@ namespace Microsoft.Data.Analysis { public partial class DataFrame { - #region Binary Operations - <# foreach (MethodConfiguration method in methodConfiguration) { #> <# if (method.MethodType == MethodType.BinaryScalar) { #> <# if (method.IsBitwise == true) { #> + /// + /// <#=method.MethodComments#> + /// public DataFrame <#=method.MethodName#>(bool value, bool inPlace = false) <# } else { #> + /// + /// <#=method.MethodComments#> + /// public DataFrame <#=method.MethodName#>(T value, bool inPlace = false) where T : unmanaged <# } #> <# } #> <# if (method.MethodType == MethodType.ComparisonScalar) { #> + /// + /// <#=method.MethodComments#> + /// public DataFrame <#=method.MethodName#>(T value) where T : unmanaged <# } #> @@ -46,6 +53,9 @@ namespace Microsoft.Data.Analysis where T : unmanaged <# } #> <# if (method.MethodType == MethodType.BinaryInt ) {#> + /// + /// <#=method.MethodComments#> + /// public DataFrame <#=method.MethodName#>(int value, bool inPlace = false) <# } #> { @@ -92,6 +102,35 @@ namespace Microsoft.Data.Analysis return retDataFrame; } <# } #> - #endregion + +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.BinaryScalar) { #> +<# if (method.IsBitwise == true) { #> + /// + /// <#=method.GetReverseMethodComments()#> + /// + public DataFrame Reverse<#=method.MethodName#>(bool value, bool inPlace = false) +<# } else { #> + /// + /// <#=method.GetReverseMethodComments()#> + /// + public DataFrame Reverse<#=method.MethodName#>(T value, bool inPlace = false) + where T : unmanaged +<# } #> + { + DataFrame retDataFrame = inPlace ? this : new DataFrame(); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn baseColumn = _columnCollection[i]; + DataFrameColumn newColumn = baseColumn.Reverse<#=method.MethodName#>(value, inPlace); + if (inPlace) + retDataFrame.Columns[i] = newColumn; + else + retDataFrame.Columns.Insert(i, newColumn); + } + return retDataFrame; + } +<# } #> +<# } #> } } diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs index aa6a810c98..e55e847409 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs @@ -16,339 +16,682 @@ public partial class DataFrame { return df.Add(value); } + + public static DataFrame operator +(bool value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, byte value) { return df.Add(value); } + + public static DataFrame operator +(byte value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, char value) { return df.Add(value); } + + public static DataFrame operator +(char value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, decimal value) { return df.Add(value); } + + public static DataFrame operator +(decimal value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, double value) { return df.Add(value); } + + public static DataFrame operator +(double value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, float value) { return df.Add(value); } + + public static DataFrame operator +(float value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, int value) { return df.Add(value); } + + public static DataFrame operator +(int value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, long value) { return df.Add(value); } + + public static DataFrame operator +(long value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, sbyte value) { return df.Add(value); } + + public static DataFrame operator +(sbyte value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, short value) { return df.Add(value); } + + public static DataFrame operator +(short value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, uint value) { return df.Add(value); } + + public static DataFrame operator +(uint value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, ulong value) { return df.Add(value); } + + public static DataFrame operator +(ulong value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator +(DataFrame df, ushort value) { return df.Add(value); } + + public static DataFrame operator +(ushort value, DataFrame df) + { + return df.ReverseAdd(value); + } public static DataFrame operator -(DataFrame df, bool value) { return df.Subtract(value); } + + public static DataFrame operator -(bool value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, byte value) { return df.Subtract(value); } + + public static DataFrame operator -(byte value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, char value) { return df.Subtract(value); } + + public static DataFrame operator -(char value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, decimal value) { return df.Subtract(value); } + + public static DataFrame operator -(decimal value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, double value) { return df.Subtract(value); } + + public static DataFrame operator -(double value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, float value) { return df.Subtract(value); } + + public static DataFrame operator -(float value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, int value) { return df.Subtract(value); } + + public static DataFrame operator -(int value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, long value) { return df.Subtract(value); } + + public static DataFrame operator -(long value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, sbyte value) { return df.Subtract(value); } + + public static DataFrame operator -(sbyte value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, short value) { return df.Subtract(value); } + + public static DataFrame operator -(short value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, uint value) { return df.Subtract(value); } + + public static DataFrame operator -(uint value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, ulong value) { return df.Subtract(value); } + + public static DataFrame operator -(ulong value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator -(DataFrame df, ushort value) { return df.Subtract(value); } + + public static DataFrame operator -(ushort value, DataFrame df) + { + return df.ReverseSubtract(value); + } public static DataFrame operator *(DataFrame df, bool value) { return df.Multiply(value); } + + public static DataFrame operator *(bool value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, byte value) { return df.Multiply(value); } + + public static DataFrame operator *(byte value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, char value) { return df.Multiply(value); } + + public static DataFrame operator *(char value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, decimal value) { return df.Multiply(value); } + + public static DataFrame operator *(decimal value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, double value) { return df.Multiply(value); } + + public static DataFrame operator *(double value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, float value) { return df.Multiply(value); } + + public static DataFrame operator *(float value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, int value) { return df.Multiply(value); } + + public static DataFrame operator *(int value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, long value) { return df.Multiply(value); } + + public static DataFrame operator *(long value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, sbyte value) { return df.Multiply(value); } + + public static DataFrame operator *(sbyte value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, short value) { return df.Multiply(value); } + + public static DataFrame operator *(short value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, uint value) { return df.Multiply(value); } + + public static DataFrame operator *(uint value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, ulong value) { return df.Multiply(value); } + + public static DataFrame operator *(ulong value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator *(DataFrame df, ushort value) { return df.Multiply(value); } + + public static DataFrame operator *(ushort value, DataFrame df) + { + return df.ReverseMultiply(value); + } public static DataFrame operator /(DataFrame df, bool value) { return df.Divide(value); } + + public static DataFrame operator /(bool value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, byte value) { return df.Divide(value); } + + public static DataFrame operator /(byte value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, char value) { return df.Divide(value); } + + public static DataFrame operator /(char value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, decimal value) { return df.Divide(value); } + + public static DataFrame operator /(decimal value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, double value) { return df.Divide(value); } + + public static DataFrame operator /(double value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, float value) { return df.Divide(value); } + + public static DataFrame operator /(float value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, int value) { return df.Divide(value); } + + public static DataFrame operator /(int value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, long value) { return df.Divide(value); } + + public static DataFrame operator /(long value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, sbyte value) { return df.Divide(value); } + + public static DataFrame operator /(sbyte value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, short value) { return df.Divide(value); } + + public static DataFrame operator /(short value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, uint value) { return df.Divide(value); } + + public static DataFrame operator /(uint value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, ulong value) { return df.Divide(value); } + + public static DataFrame operator /(ulong value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator /(DataFrame df, ushort value) { return df.Divide(value); } + + public static DataFrame operator /(ushort value, DataFrame df) + { + return df.ReverseDivide(value); + } public static DataFrame operator %(DataFrame df, bool value) { return df.Modulo(value); } + + public static DataFrame operator %(bool value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, byte value) { return df.Modulo(value); } + + public static DataFrame operator %(byte value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, char value) { return df.Modulo(value); } + + public static DataFrame operator %(char value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, decimal value) { return df.Modulo(value); } + + public static DataFrame operator %(decimal value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, double value) { return df.Modulo(value); } + + public static DataFrame operator %(double value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, float value) { return df.Modulo(value); } + + public static DataFrame operator %(float value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, int value) { return df.Modulo(value); } + + public static DataFrame operator %(int value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, long value) { return df.Modulo(value); } + + public static DataFrame operator %(long value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, sbyte value) { return df.Modulo(value); } + + public static DataFrame operator %(sbyte value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, short value) { return df.Modulo(value); } + + public static DataFrame operator %(short value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, uint value) { return df.Modulo(value); } + + public static DataFrame operator %(uint value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, ulong value) { return df.Modulo(value); } + + public static DataFrame operator %(ulong value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator %(DataFrame df, ushort value) { return df.Modulo(value); } + + public static DataFrame operator %(ushort value, DataFrame df) + { + return df.ReverseModulo(value); + } public static DataFrame operator &(DataFrame df, bool value) { return df.And(value); } + + public static DataFrame operator &(bool value, DataFrame df) + { + return df.ReverseAnd(value, inPlace: false); + } + public static DataFrame operator |(DataFrame df, bool value) { return df.Or(value); } + + public static DataFrame operator |(bool value, DataFrame df) + { + return df.ReverseOr(value, inPlace: false); + } + public static DataFrame operator ^(DataFrame df, bool value) { return df.Xor(value); } + + public static DataFrame operator ^(bool value, DataFrame df) + { + return df.ReverseXor(value, inPlace: false); + } + public static DataFrame operator <<(DataFrame df, int value) { return df.LeftShift(value); diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt index 169b90f328..056e1f4b80 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt @@ -25,12 +25,23 @@ namespace Microsoft.Data.Analysis { return df.<#=method.MethodName#>(value); } + + public static DataFrame operator <#=method.Operator#>(bool value, DataFrame df) + { + return df.Reverse<#=method.MethodName#>(value, inPlace: false); + } + <# } else { #> <# foreach (TypeConfiguration type in typeConfiguration) { #> public static DataFrame operator <#=method.Operator#>(DataFrame df, <#=type.TypeName#> value) { return df.<#=method.MethodName#>(value); } + + public static DataFrame operator <#=method.Operator#>(<#=type.TypeName#> value, DataFrame df) + { + return df.Reverse<#=method.MethodName#>(value); + } <# } #> <# } #> diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs index 3cbc978458..5fbb83d7ab 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs @@ -17,91 +17,190 @@ public virtual DataFrameColumn Add(DataFrameColumn column, bool inPlace = false) throw new NotImplementedException(); } + /// + /// Performs an element wise addition on each value in the column + /// public virtual DataFrameColumn Add(T value, bool inPlace = false) where T : unmanaged { throw new NotImplementedException(); } + /// + /// Performs a reversed element wise addition on each value in the column + /// + public virtual DataFrameColumn ReverseAdd(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + public virtual DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs an element wise subtraction on each value in the column + /// public virtual DataFrameColumn Subtract(T value, bool inPlace = false) where T : unmanaged { throw new NotImplementedException(); } + /// + /// Performs a reversed element wise subtraction on each value in the column + /// + public virtual DataFrameColumn ReverseSubtract(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + public virtual DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs an element wise multiplication on each value in the column + /// public virtual DataFrameColumn Multiply(T value, bool inPlace = false) where T : unmanaged { throw new NotImplementedException(); } + /// + /// Performs a reversed element wise multiplication on each value in the column + /// + public virtual DataFrameColumn ReverseMultiply(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + public virtual DataFrameColumn Divide(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs an element wise division on each value in the column + /// public virtual DataFrameColumn Divide(T value, bool inPlace = false) where T : unmanaged { throw new NotImplementedException(); } + /// + /// Performs a reversed element wise division on each value in the column + /// + public virtual DataFrameColumn ReverseDivide(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + public virtual DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs an element wise modulus operation on each value in the column + /// public virtual DataFrameColumn Modulo(T value, bool inPlace = false) where T : unmanaged { throw new NotImplementedException(); } + /// + /// Performs a reversed element wise modulus operation on each value in the column + /// + public virtual DataFrameColumn ReverseModulo(T value, bool inPlace = false) + where T : unmanaged + { + throw new NotImplementedException(); + } + public virtual DataFrameColumn And(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs an element wise boolean And on each value in the column + /// public virtual PrimitiveDataFrameColumn And(bool value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs a reversed element wise boolean And on each value in the column + /// + public virtual PrimitiveDataFrameColumn ReverseAnd(bool value, bool inPlace = false) + { + throw new NotImplementedException(); + } + public virtual DataFrameColumn Or(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs an element wise boolean Or on each value in the column + /// public virtual PrimitiveDataFrameColumn Or(bool value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs a reversed element wise boolean Or on each value in the column + /// + public virtual PrimitiveDataFrameColumn ReverseOr(bool value, bool inPlace = false) + { + throw new NotImplementedException(); + } + public virtual DataFrameColumn Xor(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs an element wise boolean Xor on each value in the column + /// public virtual PrimitiveDataFrameColumn Xor(bool value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs a reversed element wise boolean Xor on each value in the column + /// + public virtual PrimitiveDataFrameColumn ReverseXor(bool value, bool inPlace = false) + { + throw new NotImplementedException(); + } + + /// + /// Performs an element wise left shift on each value in the column + /// public virtual DataFrameColumn LeftShift(int value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs an element wise right shift on each value in the column + /// public virtual DataFrameColumn RightShift(int value, bool inPlace = false) { throw new NotImplementedException(); @@ -112,6 +211,9 @@ public virtual PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn throw new NotImplementedException(); } + /// + /// Performs an element wise equals on each value in the column + /// public virtual PrimitiveDataFrameColumn ElementwiseEquals(T value) where T : unmanaged { @@ -123,6 +225,9 @@ public virtual PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColu throw new NotImplementedException(); } + /// + /// Performs an element wise not-equals on each value in the column + /// public virtual PrimitiveDataFrameColumn ElementwiseNotEquals(T value) where T : unmanaged { @@ -134,6 +239,9 @@ public virtual PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(Data throw new NotImplementedException(); } + /// + /// Performs an element wise greater than or equal on each value in the column + /// public virtual PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(T value) where T : unmanaged { @@ -145,6 +253,9 @@ public virtual PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFra throw new NotImplementedException(); } + /// + /// Performs an element wise less than or equal on each value in the column + /// public virtual PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(T value) where T : unmanaged { @@ -156,6 +267,9 @@ public virtual PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameCo throw new NotImplementedException(); } + /// + /// Performs an element wise greater than on each value in the column + /// public virtual PrimitiveDataFrameColumn ElementwiseGreaterThan(T value) where T : unmanaged { @@ -167,6 +281,9 @@ public virtual PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColum throw new NotImplementedException(); } + /// + /// Performs an element wise less than on each value in the column + /// public virtual PrimitiveDataFrameColumn ElementwiseLessThan(T value) where T : unmanaged { diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt index 23ecfc3df4..6a05018736 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt @@ -21,13 +21,22 @@ namespace Microsoft.Data.Analysis <# foreach (MethodConfiguration method in methodConfiguration) { #> <# if (method.MethodType == MethodType.BinaryScalar) { #> <# if (method.IsBitwise == true) { #> + /// + /// <#=method.GetColumnSpecificMethodComments()#> + /// public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(bool value, bool inPlace = false) <# } else { #> + /// + /// <#=method.GetColumnSpecificMethodComments()#> + /// public virtual DataFrameColumn <#=method.MethodName#>(T value, bool inPlace = false) where T : unmanaged <# } #> <# } #> <# if (method.MethodType == MethodType.ComparisonScalar) { #> + /// + /// <#=method.GetColumnSpecificMethodComments()#> + /// public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(T value) where T : unmanaged <# } #> @@ -38,12 +47,33 @@ namespace Microsoft.Data.Analysis public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(DataFrameColumn column) <# } #> <# if (method.MethodType == MethodType.BinaryInt ) {#> + /// + /// <#=method.GetColumnSpecificMethodComments()#> + /// public virtual DataFrameColumn <#=method.MethodName#>(int value, bool inPlace = false) <# } #> { throw new NotImplementedException(); } +<# if (method.MethodType == MethodType.BinaryScalar) { #> +<# if (method.IsBitwise == true) { #> + /// + /// <#=method.GetColumnSpecificReverseMethodComments()#> + /// + public virtual PrimitiveDataFrameColumn Reverse<#=method.MethodName#>(bool value, bool inPlace = false) +<# } else { #> + /// + /// <#=method.GetColumnSpecificReverseMethodComments()#> + /// + public virtual DataFrameColumn Reverse<#=method.MethodName#>(T value, bool inPlace = false) + where T : unmanaged +<# } #> + { + throw new NotImplementedException(); + } + +<# } #> <# } #> } } diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs index df945ce975..e6635398d5 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs @@ -21,55 +21,133 @@ public abstract partial class DataFrameColumn { return column.Add(value); } + + public static DataFrameColumn operator +(bool value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, byte value) { return column.Add(value); } + + public static DataFrameColumn operator +(byte value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, char value) { return column.Add(value); } + + public static DataFrameColumn operator +(char value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, decimal value) { return column.Add(value); } + + public static DataFrameColumn operator +(decimal value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, double value) { return column.Add(value); } + + public static DataFrameColumn operator +(double value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, float value) { return column.Add(value); } + + public static DataFrameColumn operator +(float value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, int value) { return column.Add(value); } + + public static DataFrameColumn operator +(int value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, long value) { return column.Add(value); } + + public static DataFrameColumn operator +(long value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, sbyte value) { return column.Add(value); } + + public static DataFrameColumn operator +(sbyte value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, short value) { return column.Add(value); } + + public static DataFrameColumn operator +(short value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, uint value) { return column.Add(value); } + + public static DataFrameColumn operator +(uint value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, ulong value) { return column.Add(value); } + + public static DataFrameColumn operator +(ulong value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + public static DataFrameColumn operator +(DataFrameColumn column, ushort value) { return column.Add(value); } + public static DataFrameColumn operator +(ushort value, DataFrameColumn column) + { + return column.ReverseAdd(value); + } + + public static DataFrameColumn operator -(DataFrameColumn left, DataFrameColumn right) { return left.Subtract(right); @@ -79,55 +157,133 @@ public abstract partial class DataFrameColumn { return column.Subtract(value); } + + public static DataFrameColumn operator -(bool value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, byte value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(byte value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, char value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(char value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, decimal value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(decimal value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, double value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(double value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, float value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(float value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, int value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(int value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, long value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(long value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, sbyte value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(sbyte value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, short value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(short value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, uint value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(uint value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, ulong value) { return column.Subtract(value); } + + public static DataFrameColumn operator -(ulong value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + public static DataFrameColumn operator -(DataFrameColumn column, ushort value) { return column.Subtract(value); } + public static DataFrameColumn operator -(ushort value, DataFrameColumn column) + { + return column.ReverseSubtract(value); + } + + public static DataFrameColumn operator *(DataFrameColumn left, DataFrameColumn right) { return left.Multiply(right); @@ -137,55 +293,133 @@ public abstract partial class DataFrameColumn { return column.Multiply(value); } + + public static DataFrameColumn operator *(bool value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, byte value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(byte value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, char value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(char value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, decimal value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(decimal value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, double value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(double value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, float value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(float value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, int value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(int value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, long value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(long value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, sbyte value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(sbyte value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, short value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(short value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, uint value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(uint value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, ulong value) { return column.Multiply(value); } + + public static DataFrameColumn operator *(ulong value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + public static DataFrameColumn operator *(DataFrameColumn column, ushort value) { return column.Multiply(value); } + public static DataFrameColumn operator *(ushort value, DataFrameColumn column) + { + return column.ReverseMultiply(value); + } + + public static DataFrameColumn operator /(DataFrameColumn left, DataFrameColumn right) { return left.Divide(right); @@ -195,55 +429,133 @@ public abstract partial class DataFrameColumn { return column.Divide(value); } + + public static DataFrameColumn operator /(bool value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, byte value) { return column.Divide(value); } + + public static DataFrameColumn operator /(byte value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, char value) { return column.Divide(value); } + + public static DataFrameColumn operator /(char value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, decimal value) { return column.Divide(value); } + + public static DataFrameColumn operator /(decimal value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, double value) { return column.Divide(value); } + + public static DataFrameColumn operator /(double value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, float value) { return column.Divide(value); } + + public static DataFrameColumn operator /(float value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, int value) { return column.Divide(value); } + + public static DataFrameColumn operator /(int value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, long value) { return column.Divide(value); } + + public static DataFrameColumn operator /(long value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, sbyte value) { return column.Divide(value); } + + public static DataFrameColumn operator /(sbyte value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, short value) { return column.Divide(value); } + + public static DataFrameColumn operator /(short value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, uint value) { return column.Divide(value); } + + public static DataFrameColumn operator /(uint value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, ulong value) { return column.Divide(value); } + + public static DataFrameColumn operator /(ulong value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + public static DataFrameColumn operator /(DataFrameColumn column, ushort value) { return column.Divide(value); } + public static DataFrameColumn operator /(ushort value, DataFrameColumn column) + { + return column.ReverseDivide(value); + } + + public static DataFrameColumn operator %(DataFrameColumn left, DataFrameColumn right) { return left.Modulo(right); @@ -253,55 +565,133 @@ public abstract partial class DataFrameColumn { return column.Modulo(value); } + + public static DataFrameColumn operator %(bool value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, byte value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(byte value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, char value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(char value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, decimal value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(decimal value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, double value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(double value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, float value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(float value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, int value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(int value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, long value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(long value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, sbyte value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(sbyte value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, short value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(short value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, uint value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(uint value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, ulong value) { return column.Modulo(value); } + + public static DataFrameColumn operator %(ulong value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + public static DataFrameColumn operator %(DataFrameColumn column, ushort value) { return column.Modulo(value); } + public static DataFrameColumn operator %(ushort value, DataFrameColumn column) + { + return column.ReverseModulo(value); + } + + public static DataFrameColumn operator &(DataFrameColumn left, DataFrameColumn right) { return left.And(right); @@ -311,6 +701,12 @@ public abstract partial class DataFrameColumn { return column.And(value); } + + public static DataFrameColumn operator &(bool value, DataFrameColumn column) + { + return column.ReverseAnd(value); + } + public static DataFrameColumn operator |(DataFrameColumn left, DataFrameColumn right) { return left.Or(right); @@ -320,6 +716,12 @@ public abstract partial class DataFrameColumn { return column.Or(value); } + + public static DataFrameColumn operator |(bool value, DataFrameColumn column) + { + return column.ReverseOr(value); + } + public static DataFrameColumn operator ^(DataFrameColumn left, DataFrameColumn right) { return left.Xor(right); @@ -329,6 +731,12 @@ public abstract partial class DataFrameColumn { return column.Xor(value); } + + public static DataFrameColumn operator ^(bool value, DataFrameColumn column) + { + return column.ReverseXor(value); + } + public static DataFrameColumn operator <<(DataFrameColumn column, int value) { return column.LeftShift(value); diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt index ccd54b0fc9..001dd39a11 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt @@ -25,12 +25,24 @@ namespace Microsoft.Data.Analysis { return column.<#=method.MethodName#>(value); } + + public static DataFrameColumn operator <#=method.Operator#>(bool value, DataFrameColumn column) + { + return column.Reverse<#=method.MethodName#>(value); + } + <# } else { #> <# foreach (TypeConfiguration type in typeConfiguration) { #> public static DataFrameColumn operator <#=method.Operator#>(DataFrameColumn column, <#=type.TypeName#> value) { return column.<#=method.MethodName#>(value); } + + public static DataFrameColumn operator <#=method.Operator#>(<#=type.TypeName#> value, DataFrameColumn column) + { + return column.Reverse<#=method.MethodName#>(value); + } + <# } #> <# } #> diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index f902aaffd5..20a8c9551f 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -52,6 +52,10 @@ TextTemplatingFileGenerator PrimitiveDataFrameColumn.Computations.cs + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.ReversedBinaryOperations.cs + TextTemplatingFileGenerator PrimitiveColumnArithmetic.cs @@ -119,6 +123,11 @@ True PrimitiveDataFrameColumn.Computations.tt + + True + True + PrimitiveDataFrameColumn.ReversedBinaryOperations.tt + True True diff --git a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.cs index 63cb1c5d08..f8a8410a39 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.cs @@ -10,109 +10,109 @@ namespace Microsoft.Data.Analysis internal partial class PrimitiveColumnContainer where T : struct { - public PrimitiveColumnContainer Add(PrimitiveColumnContainer right) + public PrimitiveColumnContainer Add(PrimitiveColumnContainer right) { PrimitiveDataFrameColumnArithmetic.Instance.Add(this, right); return this; } - public PrimitiveColumnContainer Add(T scalar) + public PrimitiveColumnContainer Add(T scalar) { PrimitiveDataFrameColumnArithmetic.Instance.Add(this, scalar); return this; } - public PrimitiveColumnContainer Subtract(PrimitiveColumnContainer right) + public PrimitiveColumnContainer Subtract(PrimitiveColumnContainer right) { PrimitiveDataFrameColumnArithmetic.Instance.Subtract(this, right); return this; } - public PrimitiveColumnContainer Subtract(T scalar) + public PrimitiveColumnContainer Subtract(T scalar) { PrimitiveDataFrameColumnArithmetic.Instance.Subtract(this, scalar); return this; } - public PrimitiveColumnContainer Multiply(PrimitiveColumnContainer right) + public PrimitiveColumnContainer Multiply(PrimitiveColumnContainer right) { PrimitiveDataFrameColumnArithmetic.Instance.Multiply(this, right); return this; } - public PrimitiveColumnContainer Multiply(T scalar) + public PrimitiveColumnContainer Multiply(T scalar) { PrimitiveDataFrameColumnArithmetic.Instance.Multiply(this, scalar); return this; } - public PrimitiveColumnContainer Divide(PrimitiveColumnContainer right) + public PrimitiveColumnContainer Divide(PrimitiveColumnContainer right) { PrimitiveDataFrameColumnArithmetic.Instance.Divide(this, right); return this; } - public PrimitiveColumnContainer Divide(T scalar) + public PrimitiveColumnContainer Divide(T scalar) { PrimitiveDataFrameColumnArithmetic.Instance.Divide(this, scalar); return this; } - public PrimitiveColumnContainer Modulo(PrimitiveColumnContainer right) + public PrimitiveColumnContainer Modulo(PrimitiveColumnContainer right) { PrimitiveDataFrameColumnArithmetic.Instance.Modulo(this, right); return this; } - public PrimitiveColumnContainer Modulo(T scalar) + public PrimitiveColumnContainer Modulo(T scalar) { PrimitiveDataFrameColumnArithmetic.Instance.Modulo(this, scalar); return this; } - public PrimitiveColumnContainer And(PrimitiveColumnContainer right) + public PrimitiveColumnContainer And(PrimitiveColumnContainer right) { PrimitiveDataFrameColumnArithmetic.Instance.And(this, right); return this; } - public PrimitiveColumnContainer And(T scalar) + public PrimitiveColumnContainer And(T scalar) { PrimitiveDataFrameColumnArithmetic.Instance.And(this, scalar); return this; } - public PrimitiveColumnContainer Or(PrimitiveColumnContainer right) + public PrimitiveColumnContainer Or(PrimitiveColumnContainer right) { PrimitiveDataFrameColumnArithmetic.Instance.Or(this, right); return this; } - public PrimitiveColumnContainer Or(T scalar) + public PrimitiveColumnContainer Or(T scalar) { PrimitiveDataFrameColumnArithmetic.Instance.Or(this, scalar); return this; } - public PrimitiveColumnContainer Xor(PrimitiveColumnContainer right) + public PrimitiveColumnContainer Xor(PrimitiveColumnContainer right) { PrimitiveDataFrameColumnArithmetic.Instance.Xor(this, right); return this; } - public PrimitiveColumnContainer Xor(T scalar) + public PrimitiveColumnContainer Xor(T scalar) { PrimitiveDataFrameColumnArithmetic.Instance.Xor(this, scalar); return this; } - public PrimitiveColumnContainer LeftShift(int value) + public PrimitiveColumnContainer LeftShift(int value) { PrimitiveDataFrameColumnArithmetic.Instance.LeftShift(this, value); return this; } - public PrimitiveColumnContainer RightShift(int value) + public PrimitiveColumnContainer RightShift(int value) { PrimitiveDataFrameColumnArithmetic.Instance.RightShift(this, value); return this; @@ -190,5 +190,45 @@ public PrimitiveColumnContainer ElementwiseLessThan(T scalar, PrimitiveColumn return this; } + public PrimitiveColumnContainer ReverseAdd(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Add(scalar, this); + return this; + } + public PrimitiveColumnContainer ReverseSubtract(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Subtract(scalar, this); + return this; + } + public PrimitiveColumnContainer ReverseMultiply(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Multiply(scalar, this); + return this; + } + public PrimitiveColumnContainer ReverseDivide(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Divide(scalar, this); + return this; + } + public PrimitiveColumnContainer ReverseModulo(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Modulo(scalar, this); + return this; + } + public PrimitiveColumnContainer ReverseAnd(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.And(scalar, this); + return this; + } + public PrimitiveColumnContainer ReverseOr(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Or(scalar, this); + return this; + } + public PrimitiveColumnContainer ReverseXor(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.Xor(scalar, this); + return this; + } } } diff --git a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.tt index 068dd0c012..1006508524 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.BinaryOperations.tt @@ -29,7 +29,7 @@ namespace Microsoft.Data.Analysis } <# } else { #> - public <#= method.GetSingleArgumentMethodSignature("PrimitiveColumnContainer", "T")#> + public <#= method.GetSingleArgumentMethodSignature("PrimitiveColumnContainer", "T")#> { <# if (method.MethodType == MethodType.BinaryScalar) { #> PrimitiveDataFrameColumnArithmetic.Instance.<#=method.MethodName#>(this, scalar); @@ -42,6 +42,15 @@ namespace Microsoft.Data.Analysis } <# } #> +<# } #> +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.BinaryScalar) { #> + public PrimitiveColumnContainer Reverse<#=method.MethodName#>(T scalar) + { + PrimitiveDataFrameColumnArithmetic.Instance.<#=method.MethodName#>(scalar, this); + return this; + } +<# } #> <# } #> } } diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs new file mode 100644 index 0000000000..dc6b2be5d9 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs @@ -0,0 +1,394 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumn.ReversedBinaryOperations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class PrimitiveDataFrameColumn : DataFrameColumn + where T : unmanaged + { + + public override DataFrameColumn ReverseAdd(U value, bool inPlace = false) + { + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + throw new NotSupportedException(); + case PrimitiveDataFrameColumn decimalColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseAdd(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); + clonedDecimalColumn._columnContainer.ReverseAdd(DecimalConverter.Instance.GetDecimal(value)); + return clonedDecimalColumn; + } + case PrimitiveDataFrameColumn byteColumn: + case PrimitiveDataFrameColumn charColumn: + case PrimitiveDataFrameColumn doubleColumn: + case PrimitiveDataFrameColumn floatColumn: + case PrimitiveDataFrameColumn intColumn: + case PrimitiveDataFrameColumn longColumn: + case PrimitiveDataFrameColumn sbyteColumn: + case PrimitiveDataFrameColumn shortColumn: + case PrimitiveDataFrameColumn uintColumn: + case PrimitiveDataFrameColumn ulongColumn: + case PrimitiveDataFrameColumn ushortColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseAdd(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ReverseAdd(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn clonedDoubleColumn = CloneAsDoubleColumn(); + clonedDoubleColumn._columnContainer.ReverseAdd(DoubleConverter.Instance.GetDouble(value)); + return clonedDoubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn ReverseSubtract(U value, bool inPlace = false) + { + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + throw new NotSupportedException(); + case PrimitiveDataFrameColumn decimalColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseSubtract(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); + clonedDecimalColumn._columnContainer.ReverseSubtract(DecimalConverter.Instance.GetDecimal(value)); + return clonedDecimalColumn; + } + case PrimitiveDataFrameColumn byteColumn: + case PrimitiveDataFrameColumn charColumn: + case PrimitiveDataFrameColumn doubleColumn: + case PrimitiveDataFrameColumn floatColumn: + case PrimitiveDataFrameColumn intColumn: + case PrimitiveDataFrameColumn longColumn: + case PrimitiveDataFrameColumn sbyteColumn: + case PrimitiveDataFrameColumn shortColumn: + case PrimitiveDataFrameColumn uintColumn: + case PrimitiveDataFrameColumn ulongColumn: + case PrimitiveDataFrameColumn ushortColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseSubtract(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ReverseSubtract(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn clonedDoubleColumn = CloneAsDoubleColumn(); + clonedDoubleColumn._columnContainer.ReverseSubtract(DoubleConverter.Instance.GetDouble(value)); + return clonedDoubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn ReverseMultiply(U value, bool inPlace = false) + { + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + throw new NotSupportedException(); + case PrimitiveDataFrameColumn decimalColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseMultiply(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); + clonedDecimalColumn._columnContainer.ReverseMultiply(DecimalConverter.Instance.GetDecimal(value)); + return clonedDecimalColumn; + } + case PrimitiveDataFrameColumn byteColumn: + case PrimitiveDataFrameColumn charColumn: + case PrimitiveDataFrameColumn doubleColumn: + case PrimitiveDataFrameColumn floatColumn: + case PrimitiveDataFrameColumn intColumn: + case PrimitiveDataFrameColumn longColumn: + case PrimitiveDataFrameColumn sbyteColumn: + case PrimitiveDataFrameColumn shortColumn: + case PrimitiveDataFrameColumn uintColumn: + case PrimitiveDataFrameColumn ulongColumn: + case PrimitiveDataFrameColumn ushortColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseMultiply(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ReverseMultiply(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn clonedDoubleColumn = CloneAsDoubleColumn(); + clonedDoubleColumn._columnContainer.ReverseMultiply(DoubleConverter.Instance.GetDouble(value)); + return clonedDoubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn ReverseDivide(U value, bool inPlace = false) + { + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + throw new NotSupportedException(); + case PrimitiveDataFrameColumn decimalColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseDivide(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); + clonedDecimalColumn._columnContainer.ReverseDivide(DecimalConverter.Instance.GetDecimal(value)); + return clonedDecimalColumn; + } + case PrimitiveDataFrameColumn byteColumn: + case PrimitiveDataFrameColumn charColumn: + case PrimitiveDataFrameColumn doubleColumn: + case PrimitiveDataFrameColumn floatColumn: + case PrimitiveDataFrameColumn intColumn: + case PrimitiveDataFrameColumn longColumn: + case PrimitiveDataFrameColumn sbyteColumn: + case PrimitiveDataFrameColumn shortColumn: + case PrimitiveDataFrameColumn uintColumn: + case PrimitiveDataFrameColumn ulongColumn: + case PrimitiveDataFrameColumn ushortColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseDivide(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ReverseDivide(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn clonedDoubleColumn = CloneAsDoubleColumn(); + clonedDoubleColumn._columnContainer.ReverseDivide(DoubleConverter.Instance.GetDouble(value)); + return clonedDoubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + public override DataFrameColumn ReverseModulo(U value, bool inPlace = false) + { + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + throw new NotSupportedException(); + case PrimitiveDataFrameColumn decimalColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseModulo(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); + clonedDecimalColumn._columnContainer.ReverseModulo(DecimalConverter.Instance.GetDecimal(value)); + return clonedDecimalColumn; + } + case PrimitiveDataFrameColumn byteColumn: + case PrimitiveDataFrameColumn charColumn: + case PrimitiveDataFrameColumn doubleColumn: + case PrimitiveDataFrameColumn floatColumn: + case PrimitiveDataFrameColumn intColumn: + case PrimitiveDataFrameColumn longColumn: + case PrimitiveDataFrameColumn sbyteColumn: + case PrimitiveDataFrameColumn shortColumn: + case PrimitiveDataFrameColumn uintColumn: + case PrimitiveDataFrameColumn ulongColumn: + case PrimitiveDataFrameColumn ushortColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.ReverseModulo(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.ReverseModulo(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn clonedDoubleColumn = CloneAsDoubleColumn(); + clonedDoubleColumn._columnContainer.ReverseModulo(DoubleConverter.Instance.GetDouble(value)); + return clonedDoubleColumn; + } + } + default: + throw new NotSupportedException(); + } + } + public override PrimitiveDataFrameColumn ReverseAnd(bool value, bool inPlace = false) + { + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + PrimitiveDataFrameColumn retColumn = inPlace ? boolColumn : boolColumn.Clone(); + retColumn._columnContainer.ReverseAnd(value); + return retColumn; + default: + throw new NotSupportedException(); + + } + } + public override PrimitiveDataFrameColumn ReverseOr(bool value, bool inPlace = false) + { + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + PrimitiveDataFrameColumn retColumn = inPlace ? boolColumn : boolColumn.Clone(); + retColumn._columnContainer.ReverseOr(value); + return retColumn; + default: + throw new NotSupportedException(); + + } + } + public override PrimitiveDataFrameColumn ReverseXor(bool value, bool inPlace = false) + { + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + PrimitiveDataFrameColumn retColumn = inPlace ? boolColumn : boolColumn.Clone(); + retColumn._columnContainer.ReverseXor(value); + return retColumn; + default: + throw new NotSupportedException(); + + } + } + + + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt new file mode 100644 index 0000000000..8e37dd8228 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt @@ -0,0 +1,110 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumn.ReversedBinaryOperations.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class PrimitiveDataFrameColumn : DataFrameColumn + where T : unmanaged + { + +<# foreach (MethodConfiguration method in methodConfiguration) { #> +<# if (method.MethodType == MethodType.BinaryScalar) {#> +<# if (method.IsBitwise == true) { #> + public override PrimitiveDataFrameColumn Reverse<#=method.MethodName#>(bool value, bool inPlace = false) +<# } else { #> + public override DataFrameColumn Reverse<#=method.MethodName#>(U value, bool inPlace = false) +<# } #> + { +<# if (method.IsBitwise == true) { #> + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + PrimitiveDataFrameColumn retColumn = inPlace ? boolColumn : boolColumn.Clone(); + retColumn._columnContainer.Reverse<#=method.MethodName#>(value); + return retColumn; + default: + throw new NotSupportedException(); + + } +<# } else { #> + switch (this) + { + case PrimitiveDataFrameColumn boolColumn: + throw new NotSupportedException(); + case PrimitiveDataFrameColumn decimalColumn: + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Reverse<#=method.MethodName#>(value); + return newColumn; + } + else + { + PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); + clonedDecimalColumn._columnContainer.Reverse<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value)); + return clonedDecimalColumn; + } +<# foreach (TypeConfiguration type in typeConfiguration) { #> +<# if (type.TypeName == "bool") { #> +<# } else if (type.TypeName == "decimal") { #> +<# } else { #> + case PrimitiveDataFrameColumn<<#=type.TypeName#>> <#=type.TypeName#>Column: +<# } #> +<# } #> + if (typeof(U) == typeof(bool)) + { + throw new NotSupportedException(); + } + if (typeof(U) == typeof(T)) + { + // No conversions + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Reverse<#=method.MethodName#>(value); + return newColumn; + } + else + { + if (typeof(U) == typeof(decimal)) + { + PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + decimalColumn._columnContainer.Reverse<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value)); + return decimalColumn; + } + else + { + PrimitiveDataFrameColumn clonedDoubleColumn = CloneAsDoubleColumn(); + clonedDoubleColumn._columnContainer.Reverse<#=method.MethodName#>(DoubleConverter.Instance.GetDouble(value)); + return clonedDoubleColumn; + } + } + default: + throw new NotSupportedException(); + } +<# } #> + } +<# } #> +<# } #> + + + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs index ad8b5eb5b0..c4129026a1 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs @@ -15,20 +15,28 @@ internal interface IPrimitiveDataFrameColumnArithmetic { void Add(PrimitiveColumnContainer left, PrimitiveColumnContainer right); void Add(PrimitiveColumnContainer column, T scalar); + void Add(T scalar, PrimitiveColumnContainer column); void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right); void Subtract(PrimitiveColumnContainer column, T scalar); + void Subtract(T scalar, PrimitiveColumnContainer column); void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right); void Multiply(PrimitiveColumnContainer column, T scalar); + void Multiply(T scalar, PrimitiveColumnContainer column); void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right); void Divide(PrimitiveColumnContainer column, T scalar); + void Divide(T scalar, PrimitiveColumnContainer column); void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right); void Modulo(PrimitiveColumnContainer column, T scalar); + void Modulo(T scalar, PrimitiveColumnContainer column); void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right); void And(PrimitiveColumnContainer column, T scalar); + void And(T scalar, PrimitiveColumnContainer column); void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right); void Or(PrimitiveColumnContainer column, T scalar); + void Or(T scalar, PrimitiveColumnContainer column); void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right); void Xor(PrimitiveColumnContainer column, T scalar); + void Xor(T scalar, PrimitiveColumnContainer column); void LeftShift(PrimitiveColumnContainer column, int value); void RightShift(PrimitiveColumnContainer column, int value); void ElementwiseEquals(PrimitiveColumnContainer left, PrimitiveColumnContainer right, PrimitiveColumnContainer ret); @@ -122,6 +130,11 @@ public void Add(PrimitiveColumnContainer column, bool scalar) { throw new NotSupportedException(); } + + public void Add(bool scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -130,6 +143,11 @@ public void Subtract(PrimitiveColumnContainer column, bool scalar) { throw new NotSupportedException(); } + + public void Subtract(bool scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -138,6 +156,11 @@ public void Multiply(PrimitiveColumnContainer column, bool scalar) { throw new NotSupportedException(); } + + public void Multiply(bool scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -146,6 +169,11 @@ public void Divide(PrimitiveColumnContainer column, bool scalar) { throw new NotSupportedException(); } + + public void Divide(bool scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -154,6 +182,11 @@ public void Modulo(PrimitiveColumnContainer column, bool scalar) { throw new NotSupportedException(); } + + public void Modulo(bool scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -183,6 +216,21 @@ public void And(PrimitiveColumnContainer column, bool scalar) } } } + + public void And(bool scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -212,6 +260,21 @@ public void Or(PrimitiveColumnContainer column, bool scalar) } } } + + public void Or(bool scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -241,6 +304,21 @@ public void Xor(PrimitiveColumnContainer column, bool scalar) } } } + + public void Xor(bool scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (bool)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { throw new NotSupportedException(); @@ -371,6 +449,21 @@ public void Add(PrimitiveColumnContainer column, byte scalar) } } } + + public void Add(byte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -400,6 +493,21 @@ public void Subtract(PrimitiveColumnContainer column, byte scalar) } } } + + public void Subtract(byte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -429,6 +537,21 @@ public void Multiply(PrimitiveColumnContainer column, byte scalar) } } } + + public void Multiply(byte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -458,6 +581,21 @@ public void Divide(PrimitiveColumnContainer column, byte scalar) } } } + + public void Divide(byte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -487,6 +625,21 @@ public void Modulo(PrimitiveColumnContainer column, byte scalar) } } } + + public void Modulo(byte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -516,6 +669,21 @@ public void And(PrimitiveColumnContainer column, byte scalar) } } } + + public void And(byte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -545,6 +713,21 @@ public void Or(PrimitiveColumnContainer column, byte scalar) } } } + + public void Or(byte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -574,6 +757,21 @@ public void Xor(PrimitiveColumnContainer column, byte scalar) } } } + + public void Xor(byte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (byte)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) @@ -808,6 +1006,21 @@ public void Add(PrimitiveColumnContainer column, char scalar) } } } + + public void Add(char scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -837,6 +1050,21 @@ public void Subtract(PrimitiveColumnContainer column, char scalar) } } } + + public void Subtract(char scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -866,6 +1094,21 @@ public void Multiply(PrimitiveColumnContainer column, char scalar) } } } + + public void Multiply(char scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -895,6 +1138,21 @@ public void Divide(PrimitiveColumnContainer column, char scalar) } } } + + public void Divide(char scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -924,6 +1182,21 @@ public void Modulo(PrimitiveColumnContainer column, char scalar) } } } + + public void Modulo(char scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -953,6 +1226,21 @@ public void And(PrimitiveColumnContainer column, char scalar) } } } + + public void And(char scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -982,6 +1270,21 @@ public void Or(PrimitiveColumnContainer column, char scalar) } } } + + public void Or(char scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1011,6 +1314,21 @@ public void Xor(PrimitiveColumnContainer column, char scalar) } } } + + public void Xor(char scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (char)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) @@ -1245,6 +1563,21 @@ public void Add(PrimitiveColumnContainer column, decimal scalar) } } } + + public void Add(decimal scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1274,6 +1607,21 @@ public void Subtract(PrimitiveColumnContainer column, decimal scalar) } } } + + public void Subtract(decimal scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1303,6 +1651,21 @@ public void Multiply(PrimitiveColumnContainer column, decimal scalar) } } } + + public void Multiply(decimal scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1332,6 +1695,21 @@ public void Divide(PrimitiveColumnContainer column, decimal scalar) } } } + + public void Divide(decimal scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1361,6 +1739,21 @@ public void Modulo(PrimitiveColumnContainer column, decimal scalar) } } } + + public void Modulo(decimal scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (decimal)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -1369,6 +1762,11 @@ public void And(PrimitiveColumnContainer column, decimal scalar) { throw new NotSupportedException(); } + + public void And(decimal scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -1377,6 +1775,11 @@ public void Or(PrimitiveColumnContainer column, decimal scalar) { throw new NotSupportedException(); } + + public void Or(decimal scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -1385,6 +1788,11 @@ public void Xor(PrimitiveColumnContainer column, decimal scalar) { throw new NotSupportedException(); } + + public void Xor(decimal scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void LeftShift(PrimitiveColumnContainer column, int value) { throw new NotSupportedException(); @@ -1599,6 +2007,21 @@ public void Add(PrimitiveColumnContainer column, double scalar) } } } + + public void Add(double scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1628,6 +2051,21 @@ public void Subtract(PrimitiveColumnContainer column, double scalar) } } } + + public void Subtract(double scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1657,6 +2095,21 @@ public void Multiply(PrimitiveColumnContainer column, double scalar) } } } + + public void Multiply(double scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1686,6 +2139,21 @@ public void Divide(PrimitiveColumnContainer column, double scalar) } } } + + public void Divide(double scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1715,6 +2183,21 @@ public void Modulo(PrimitiveColumnContainer column, double scalar) } } } + + public void Modulo(double scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (double)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -1723,6 +2206,11 @@ public void And(PrimitiveColumnContainer column, double scalar) { throw new NotSupportedException(); } + + public void And(double scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -1731,6 +2219,11 @@ public void Or(PrimitiveColumnContainer column, double scalar) { throw new NotSupportedException(); } + + public void Or(double scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -1739,6 +2232,11 @@ public void Xor(PrimitiveColumnContainer column, double scalar) { throw new NotSupportedException(); } + + public void Xor(double scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void LeftShift(PrimitiveColumnContainer column, int value) { throw new NotSupportedException(); @@ -1953,6 +2451,21 @@ public void Add(PrimitiveColumnContainer column, float scalar) } } } + + public void Add(float scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -1982,6 +2495,21 @@ public void Subtract(PrimitiveColumnContainer column, float scalar) } } } + + public void Subtract(float scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2011,6 +2539,21 @@ public void Multiply(PrimitiveColumnContainer column, float scalar) } } } + + public void Multiply(float scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2040,6 +2583,21 @@ public void Divide(PrimitiveColumnContainer column, float scalar) } } } + + public void Divide(float scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2069,6 +2627,21 @@ public void Modulo(PrimitiveColumnContainer column, float scalar) } } } + + public void Modulo(float scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (float)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -2077,6 +2650,11 @@ public void And(PrimitiveColumnContainer column, float scalar) { throw new NotSupportedException(); } + + public void And(float scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -2085,6 +2663,11 @@ public void Or(PrimitiveColumnContainer column, float scalar) { throw new NotSupportedException(); } + + public void Or(float scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { throw new NotSupportedException(); @@ -2093,6 +2676,11 @@ public void Xor(PrimitiveColumnContainer column, float scalar) { throw new NotSupportedException(); } + + public void Xor(float scalar, PrimitiveColumnContainer column) + { + throw new NotSupportedException(); + } public void LeftShift(PrimitiveColumnContainer column, int value) { throw new NotSupportedException(); @@ -2307,6 +2895,21 @@ public void Add(PrimitiveColumnContainer column, int scalar) } } } + + public void Add(int scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2336,6 +2939,21 @@ public void Subtract(PrimitiveColumnContainer column, int scalar) } } } + + public void Subtract(int scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2365,6 +2983,21 @@ public void Multiply(PrimitiveColumnContainer column, int scalar) } } } + + public void Multiply(int scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2394,6 +3027,21 @@ public void Divide(PrimitiveColumnContainer column, int scalar) } } } + + public void Divide(int scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2423,6 +3071,21 @@ public void Modulo(PrimitiveColumnContainer column, int scalar) } } } + + public void Modulo(int scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2452,6 +3115,21 @@ public void And(PrimitiveColumnContainer column, int scalar) } } } + + public void And(int scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2481,6 +3159,21 @@ public void Or(PrimitiveColumnContainer column, int scalar) } } } + + public void Or(int scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2510,6 +3203,21 @@ public void Xor(PrimitiveColumnContainer column, int scalar) } } } + + public void Xor(int scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (int)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) @@ -2744,6 +3452,21 @@ public void Add(PrimitiveColumnContainer column, long scalar) } } } + + public void Add(long scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2773,6 +3496,21 @@ public void Subtract(PrimitiveColumnContainer column, long scalar) } } } + + public void Subtract(long scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2802,6 +3540,21 @@ public void Multiply(PrimitiveColumnContainer column, long scalar) } } } + + public void Multiply(long scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2831,6 +3584,21 @@ public void Divide(PrimitiveColumnContainer column, long scalar) } } } + + public void Divide(long scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2860,6 +3628,21 @@ public void Modulo(PrimitiveColumnContainer column, long scalar) } } } + + public void Modulo(long scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2889,6 +3672,21 @@ public void And(PrimitiveColumnContainer column, long scalar) } } } + + public void And(long scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2918,6 +3716,21 @@ public void Or(PrimitiveColumnContainer column, long scalar) } } } + + public void Or(long scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -2947,6 +3760,21 @@ public void Xor(PrimitiveColumnContainer column, long scalar) } } } + + public void Xor(long scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (long)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) @@ -3181,6 +4009,21 @@ public void Add(PrimitiveColumnContainer column, sbyte scalar) } } } + + public void Add(sbyte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3210,6 +4053,21 @@ public void Subtract(PrimitiveColumnContainer column, sbyte scalar) } } } + + public void Subtract(sbyte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3239,6 +4097,21 @@ public void Multiply(PrimitiveColumnContainer column, sbyte scalar) } } } + + public void Multiply(sbyte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3268,6 +4141,21 @@ public void Divide(PrimitiveColumnContainer column, sbyte scalar) } } } + + public void Divide(sbyte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3297,6 +4185,21 @@ public void Modulo(PrimitiveColumnContainer column, sbyte scalar) } } } + + public void Modulo(sbyte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3326,6 +4229,21 @@ public void And(PrimitiveColumnContainer column, sbyte scalar) } } } + + public void And(sbyte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3355,6 +4273,21 @@ public void Or(PrimitiveColumnContainer column, sbyte scalar) } } } + + public void Or(sbyte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3384,6 +4317,21 @@ public void Xor(PrimitiveColumnContainer column, sbyte scalar) } } } + + public void Xor(sbyte scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (sbyte)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) @@ -3618,6 +4566,21 @@ public void Add(PrimitiveColumnContainer column, short scalar) } } } + + public void Add(short scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3647,6 +4610,21 @@ public void Subtract(PrimitiveColumnContainer column, short scalar) } } } + + public void Subtract(short scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3676,6 +4654,21 @@ public void Multiply(PrimitiveColumnContainer column, short scalar) } } } + + public void Multiply(short scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3705,6 +4698,21 @@ public void Divide(PrimitiveColumnContainer column, short scalar) } } } + + public void Divide(short scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3734,6 +4742,21 @@ public void Modulo(PrimitiveColumnContainer column, short scalar) } } } + + public void Modulo(short scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3763,6 +4786,21 @@ public void And(PrimitiveColumnContainer column, short scalar) } } } + + public void And(short scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -3774,21 +4812,36 @@ public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer column, short scalar) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(span[i] | scalar); } } } - public void Or(PrimitiveColumnContainer column, short scalar) + + public void Or(short scalar, PrimitiveColumnContainer column) { for (int b = 0 ; b < column.Buffers.Count; b++) { - var buffer = column.Buffers[b]; + var buffer = column.Buffers[b]; var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); column.Buffers[b] = mutableBuffer; var span = mutableBuffer.Span; - for (int i = 0; i < span.Length; i++) + for (int i = 0; i < span.Length; i++) { - span[i] = (short)(span[i] | scalar); + span[i] = (short)(scalar | span[i]); } } } @@ -3821,6 +4874,21 @@ public void Xor(PrimitiveColumnContainer column, short scalar) } } } + + public void Xor(short scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (short)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) @@ -4055,6 +5123,21 @@ public void Add(PrimitiveColumnContainer column, uint scalar) } } } + + public void Add(uint scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4084,6 +5167,21 @@ public void Subtract(PrimitiveColumnContainer column, uint scalar) } } } + + public void Subtract(uint scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4113,6 +5211,21 @@ public void Multiply(PrimitiveColumnContainer column, uint scalar) } } } + + public void Multiply(uint scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4142,6 +5255,21 @@ public void Divide(PrimitiveColumnContainer column, uint scalar) } } } + + public void Divide(uint scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4171,6 +5299,21 @@ public void Modulo(PrimitiveColumnContainer column, uint scalar) } } } + + public void Modulo(uint scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4200,6 +5343,21 @@ public void And(PrimitiveColumnContainer column, uint scalar) } } } + + public void And(uint scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4229,6 +5387,21 @@ public void Or(PrimitiveColumnContainer column, uint scalar) } } } + + public void Or(uint scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4258,6 +5431,21 @@ public void Xor(PrimitiveColumnContainer column, uint scalar) } } } + + public void Xor(uint scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (uint)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) @@ -4492,6 +5680,21 @@ public void Add(PrimitiveColumnContainer column, ulong scalar) } } } + + public void Add(ulong scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4521,6 +5724,21 @@ public void Subtract(PrimitiveColumnContainer column, ulong scalar) } } } + + public void Subtract(ulong scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4550,6 +5768,21 @@ public void Multiply(PrimitiveColumnContainer column, ulong scalar) } } } + + public void Multiply(ulong scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4579,6 +5812,21 @@ public void Divide(PrimitiveColumnContainer column, ulong scalar) } } } + + public void Divide(ulong scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4608,6 +5856,21 @@ public void Modulo(PrimitiveColumnContainer column, ulong scalar) } } } + + public void Modulo(ulong scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4637,6 +5900,21 @@ public void And(PrimitiveColumnContainer column, ulong scalar) } } } + + public void And(ulong scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4666,6 +5944,21 @@ public void Or(PrimitiveColumnContainer column, ulong scalar) } } } + + public void Or(ulong scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4695,6 +5988,21 @@ public void Xor(PrimitiveColumnContainer column, ulong scalar) } } } + + public void Xor(ulong scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ulong)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) @@ -4929,6 +6237,21 @@ public void Add(PrimitiveColumnContainer column, ushort scalar) } } } + + public void Add(ushort scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(scalar + span[i]); + } + } + } public void Subtract(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4958,6 +6281,21 @@ public void Subtract(PrimitiveColumnContainer column, ushort scalar) } } } + + public void Subtract(ushort scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(scalar - span[i]); + } + } + } public void Multiply(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -4987,6 +6325,21 @@ public void Multiply(PrimitiveColumnContainer column, ushort scalar) } } } + + public void Multiply(ushort scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(scalar * span[i]); + } + } + } public void Divide(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -5016,6 +6369,21 @@ public void Divide(PrimitiveColumnContainer column, ushort scalar) } } } + + public void Divide(ushort scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(scalar / span[i]); + } + } + } public void Modulo(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -5045,6 +6413,21 @@ public void Modulo(PrimitiveColumnContainer column, ushort scalar) } } } + + public void Modulo(ushort scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(scalar % span[i]); + } + } + } public void And(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -5074,6 +6457,21 @@ public void And(PrimitiveColumnContainer column, ushort scalar) } } } + + public void And(ushort scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(scalar & span[i]); + } + } + } public void Or(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -5103,6 +6501,21 @@ public void Or(PrimitiveColumnContainer column, ushort scalar) } } } + + public void Or(ushort scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(scalar | span[i]); + } + } + } public void Xor(PrimitiveColumnContainer left, PrimitiveColumnContainer right) { for (int b = 0 ; b < left.Buffers.Count; b++) @@ -5132,6 +6545,21 @@ public void Xor(PrimitiveColumnContainer column, ushort scalar) } } } + + public void Xor(ushort scalar, PrimitiveColumnContainer column) + { + for (int b = 0 ; b < column.Buffers.Count; b++) + { + var buffer = column.Buffers[b]; + var mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + column.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; + for (int i = 0; i < span.Length; i++) + { + span[i] = (ushort)(scalar ^ span[i]); + } + } + } public void LeftShift(PrimitiveColumnContainer column, int value) { for (int b = 0 ; b < column.Buffers.Count; b++) diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.tt index f7ffd1677e..7af9f7b040 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.tt @@ -22,6 +22,9 @@ namespace Microsoft.Data.Analysis { <# foreach (MethodConfiguration method in methodConfiguration) { #> <#= method.GetMethodSignature("PrimitiveColumnContainer", "T")#>; +<# if (method.MethodType == MethodType.BinaryScalar) { #> + <#= method.GetInvertedMethodSignatureForBinaryScalarsOps("PrimitiveColumnContainer", "T")#>; +<# } #> <# } #> } @@ -81,6 +84,31 @@ namespace Microsoft.Data.Analysis } <# } #> } +<# if (method.MethodType == MethodType.BinaryScalar) { #> + public <#= method.GetInvertedMethodSignatureForBinaryScalarsOps("PrimitiveColumnContainer", type.TypeName) #> + { +<# if ((method.IsNumeric && !type.SupportsNumeric) || (method.IsBitwise && !type.SupportsBitwise) || (type.UnsupportedMethods.Contains(method.MethodName))) { #> + throw new NotSupportedException(); +<# } else if (method.Operator != null) { #> + for (int b = 0 ; b < <#= method.Op1Name #>.Buffers.Count; b++) + { + var buffer = <#= method.Op1Name #>.Buffers[b]; + var mutableBuffer = DataFrameBuffer<<#=type.TypeName#>>.GetMutableBuffer(buffer); + <#= method.Op1Name #>.Buffers[b] = mutableBuffer; + var span = mutableBuffer.Span; +<# if (method.MethodType == MethodType.Binary || method.MethodType == MethodType.Comparison) { #> + var otherSpan = <#=method.Op2Name#>.Buffers[b].ReadOnlySpan; +<# } #> + for (int i = 0; i < span.Length; i++) + { +<# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.BinaryInt) { #> + span[i] = (<#=type.TypeName#>)(<#= method.Op2Name #> <#= method.Operator #> span[i]); +<# } #> + } + } +<# } #> + } +<# } #> <# } #> } <# } #> diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 2b8702cff5..6f15369300 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -561,9 +561,99 @@ public void TestBinaryOperatorsWithConversions() Assert.Equal(tempDf[0, 0], (byte)df[0, 0] % 1.1m); Assert.True(typeof(decimal) == tempDf["Int"].DataType); + tempDf = 1 + df; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + (double)1); + tempDf = 1.1 + df; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + 1.1); + tempDf = 1.1m + df; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + 1.1m); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + tempDf = 1.1 - df; + Assert.Equal(tempDf[0, 0], 1.1 - (byte)df[0, 0]); + tempDf = 1.1m - df; + Assert.Equal(tempDf[0, 0], 1.1m - (byte)df[0, 0]); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + tempDf = 1.1 * df; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] * 1.1); + tempDf = 1.1m * df; + Assert.Equal(tempDf[0, 0], (byte)df[0, 0] * 1.1m); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + // To prevent a divide by zero + var plusOne = df + 1; + tempDf = 1.1 / plusOne; + Assert.Equal(tempDf[0, 0], 1.1 / (double)plusOne[0, 0]); + var plusDecimal = df + 1.1m; + tempDf = 1.1m / plusDecimal; + Assert.Equal(tempDf[0, 0], (1.1m) / (decimal)plusDecimal[0, 0]); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + + tempDf = 1.1 % plusOne; + Assert.Equal(tempDf[0, 0], 1.1 % (double)plusOne[0, 0]); + tempDf = 1.1m % plusDecimal; + Assert.Equal(tempDf[0, 0], 1.1m % (decimal)plusDecimal[0, 0]); + Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.Equal((byte)0, df[0, 0]); } + [Fact] + public void TestBinaryOperatorsOnBoolColumns() + { + var df = new DataFrame(); + var dataFrameColumn1 = new PrimitiveDataFrameColumn("Bool1", Enumerable.Range(0, 10).Select(x => x % 2 == 0 ? true : false)); + var dataFrameColumn2 = new PrimitiveDataFrameColumn("Bool2", Enumerable.Range(0, 10).Select(x => x % 2 == 0 ? true : false)); + df.Columns.Insert(0, dataFrameColumn1); + df.Columns.Insert(1, dataFrameColumn2); + + DataFrame and = df & true; + for (int i = 0; i < dataFrameColumn1.Length; i++) + { + Assert.Equal(dataFrameColumn1[i], and["Bool1"][i]); + } + + and = true & df; + for (int i = 0; i < dataFrameColumn1.Length; i++) + { + Assert.Equal(dataFrameColumn1[i], and["Bool1"][i]); + } + + DataFrame or = df | true; + Assert.True(or.Columns[0].All()); + Assert.True(or.Columns[1].All()); + or = true | df; + Assert.True(or.Columns[0].All()); + Assert.True(or.Columns[1].All()); + + DataFrame xor = df ^ true; + for (int i = 0; i < xor.RowCount; i++) + { + if (i % 2 == 0) + Assert.False((bool)xor["Bool1"][i]); + else + Assert.True((bool)xor["Bool1"][i]); + } + xor = true ^ df; + for (int i = 0; i < xor.RowCount; i++) + { + if (i % 2 == 0) + Assert.False((bool)xor["Bool1"][i]); + else + Assert.True((bool)xor["Bool1"][i]); + } + } + + [Fact] + public void TestColumnReverseOrderState() + { + var column = new PrimitiveDataFrameColumn("Int", Enumerable.Range(0, 10)); + var newColumn = 1 - column; + var checkOrderColumn = 1 - newColumn; + Assert.True(checkOrderColumn.ElementwiseEquals(column).All()); + } + [Fact] public void TestProjectionAndAppend() { From afe3e61a5a28b62abdf096f761d8de677255d2cf Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 8 Nov 2019 14:04:09 -0800 Subject: [PATCH 03/53] Throw for incompatible inPlace (#2778) * Throw if inPlace is set and types mismatch * Unit test * Better error message * Remove empty lines --- ...imitiveDataFrameColumn.BinaryOperations.cs | 80 ++++++++++++++ ...imitiveDataFrameColumn.BinaryOperations.tt | 22 ++++ ...ataFrameColumn.ReversedBinaryOperations.cs | 40 +++++++ ...ataFrameColumn.ReversedBinaryOperations.tt | 8 ++ .../strings.Designer.cs | 9 ++ src/Microsoft.Data.Analysis/strings.resx | 3 + .../DataFrameTests.cs | 104 ++++++++++-------- 7 files changed, 218 insertions(+), 48 deletions(-) diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs index d30ab798a1..03ec75aa54 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs @@ -580,6 +580,10 @@ internal DataFrameColumn AddImplementation(PrimitiveDataFrameColumn column } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Add(column.CloneAsDecimalColumn()._columnContainer); return decimalColumn; @@ -609,6 +613,10 @@ internal DataFrameColumn AddImplementation(PrimitiveDataFrameColumn column } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -648,6 +656,10 @@ internal DataFrameColumn AddImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Add(DecimalConverter.Instance.GetDecimal(value)); return decimalColumn; @@ -677,6 +689,10 @@ internal DataFrameColumn AddImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -720,6 +736,10 @@ internal DataFrameColumn SubtractImplementation(PrimitiveDataFrameColumn c } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Subtract(column.CloneAsDecimalColumn()._columnContainer); return decimalColumn; @@ -749,6 +769,10 @@ internal DataFrameColumn SubtractImplementation(PrimitiveDataFrameColumn c } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -788,6 +812,10 @@ internal DataFrameColumn SubtractImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Subtract(DecimalConverter.Instance.GetDecimal(value)); return decimalColumn; @@ -817,6 +845,10 @@ internal DataFrameColumn SubtractImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -860,6 +892,10 @@ internal DataFrameColumn MultiplyImplementation(PrimitiveDataFrameColumn c } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Multiply(column.CloneAsDecimalColumn()._columnContainer); return decimalColumn; @@ -889,6 +925,10 @@ internal DataFrameColumn MultiplyImplementation(PrimitiveDataFrameColumn c } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -928,6 +968,10 @@ internal DataFrameColumn MultiplyImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Multiply(DecimalConverter.Instance.GetDecimal(value)); return decimalColumn; @@ -957,6 +1001,10 @@ internal DataFrameColumn MultiplyImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -1000,6 +1048,10 @@ internal DataFrameColumn DivideImplementation(PrimitiveDataFrameColumn col } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Divide(column.CloneAsDecimalColumn()._columnContainer); return decimalColumn; @@ -1029,6 +1081,10 @@ internal DataFrameColumn DivideImplementation(PrimitiveDataFrameColumn col } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -1068,6 +1124,10 @@ internal DataFrameColumn DivideImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Divide(DecimalConverter.Instance.GetDecimal(value)); return decimalColumn; @@ -1097,6 +1157,10 @@ internal DataFrameColumn DivideImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -1140,6 +1204,10 @@ internal DataFrameColumn ModuloImplementation(PrimitiveDataFrameColumn col } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Modulo(column.CloneAsDecimalColumn()._columnContainer); return decimalColumn; @@ -1169,6 +1237,10 @@ internal DataFrameColumn ModuloImplementation(PrimitiveDataFrameColumn col } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -1208,6 +1280,10 @@ internal DataFrameColumn ModuloImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.Modulo(DecimalConverter.Instance.GetDecimal(value)); return decimalColumn; @@ -1237,6 +1313,10 @@ internal DataFrameColumn ModuloImplementation(U value, bool inPlace) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt index 98568b945b..29c9b8d95e 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt @@ -209,6 +209,17 @@ namespace Microsoft.Data.Analysis } else { +<# if (method.MethodType == MethodType.BinaryScalar) { #> + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } +<# } else if (method.MethodType == MethodType.Binary) { #> + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } +<# } #> <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); <# if (method.MethodType == MethodType.ComparisonScalar) { #> @@ -277,6 +288,17 @@ namespace Microsoft.Data.Analysis } else { +<# if (method.MethodType == MethodType.BinaryScalar) { #> + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } +<# } else if (method.MethodType == MethodType.Binary) { #> + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedColumnValueType, typeof(T)), nameof(column)); + } +<# } #> if (typeof(U) == typeof(decimal)) { <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs index dc6b2be5d9..73e338fd40 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs @@ -35,6 +35,10 @@ public override DataFrameColumn ReverseAdd(U value, bool inPlace = false) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); clonedDecimalColumn._columnContainer.ReverseAdd(DecimalConverter.Instance.GetDecimal(value)); return clonedDecimalColumn; @@ -64,6 +68,10 @@ public override DataFrameColumn ReverseAdd(U value, bool inPlace = false) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -102,6 +110,10 @@ public override DataFrameColumn ReverseSubtract(U value, bool inPlace = false } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); clonedDecimalColumn._columnContainer.ReverseSubtract(DecimalConverter.Instance.GetDecimal(value)); return clonedDecimalColumn; @@ -131,6 +143,10 @@ public override DataFrameColumn ReverseSubtract(U value, bool inPlace = false } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -169,6 +185,10 @@ public override DataFrameColumn ReverseMultiply(U value, bool inPlace = false } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); clonedDecimalColumn._columnContainer.ReverseMultiply(DecimalConverter.Instance.GetDecimal(value)); return clonedDecimalColumn; @@ -198,6 +218,10 @@ public override DataFrameColumn ReverseMultiply(U value, bool inPlace = false } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -236,6 +260,10 @@ public override DataFrameColumn ReverseDivide(U value, bool inPlace = false) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); clonedDecimalColumn._columnContainer.ReverseDivide(DecimalConverter.Instance.GetDecimal(value)); return clonedDecimalColumn; @@ -265,6 +293,10 @@ public override DataFrameColumn ReverseDivide(U value, bool inPlace = false) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); @@ -303,6 +335,10 @@ public override DataFrameColumn ReverseModulo(U value, bool inPlace = false) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); clonedDecimalColumn._columnContainer.ReverseModulo(DecimalConverter.Instance.GetDecimal(value)); return clonedDecimalColumn; @@ -332,6 +368,10 @@ public override DataFrameColumn ReverseModulo(U value, bool inPlace = false) } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt index 8e37dd8228..64917994cc 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt @@ -59,6 +59,10 @@ namespace Microsoft.Data.Analysis } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } PrimitiveDataFrameColumn clonedDecimalColumn = CloneAsDecimalColumn(); clonedDecimalColumn._columnContainer.Reverse<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value)); return clonedDecimalColumn; @@ -84,6 +88,10 @@ namespace Microsoft.Data.Analysis } else { + if (inPlace) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(value)); + } if (typeof(U) == typeof(decimal)) { PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); diff --git a/src/Microsoft.Data.Analysis/strings.Designer.cs b/src/Microsoft.Data.Analysis/strings.Designer.cs index fc27befb7a..1132baa79f 100644 --- a/src/Microsoft.Data.Analysis/strings.Designer.cs +++ b/src/Microsoft.Data.Analysis/strings.Designer.cs @@ -168,6 +168,15 @@ internal static string MismatchedColumnLengths { } } + /// + /// Looks up a localized string similar to Expected column to hold values of type {0}. + /// + internal static string MismatchedColumnValueType { + get { + return ResourceManager.GetString("MismatchedColumnValueType", resourceCulture); + } + } + /// /// Looks up a localized string similar to rowCount differs from Column length for Column . /// diff --git a/src/Microsoft.Data.Analysis/strings.resx b/src/Microsoft.Data.Analysis/strings.resx index a32a25a31a..2162a4bc79 100644 --- a/src/Microsoft.Data.Analysis/strings.resx +++ b/src/Microsoft.Data.Analysis/strings.resx @@ -153,6 +153,9 @@ Column lengths are mismatched + + Expected column to hold values of type {0} + rowCount differs from Column length for Column diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 6f15369300..8cf0cf6915 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -645,6 +645,14 @@ public void TestBinaryOperatorsOnBoolColumns() } } + [Fact] + public void TestBinaryOperationsOnColumns() + { + PrimitiveDataFrameColumn column = new PrimitiveDataFrameColumn("Int", Enumerable.Range(0, 10)); + Assert.ThrowsAny(() => column.Add(5.5, inPlace: true)); + Assert.ThrowsAny(() => column.ReverseAdd(5.5, inPlace: true)); + } + [Fact] public void TestColumnReverseOrderState() { @@ -1816,50 +1824,50 @@ public void TestColumns() } - [Fact] - public void TestAppendRow() - { - DataFrame df = MakeDataFrame(10); - df.Append(new List { 5, true }); - Assert.Equal(11, df.RowCount); - Assert.Equal(1, df.Columns[0].NullCount); - Assert.Equal(1, df.Columns[1].NullCount); - - df.Append(new List { 100 }); - Assert.Equal(12, df.RowCount); - Assert.Equal(1, df.Columns[0].NullCount); - Assert.Equal(2, df.Columns[1].NullCount); - - df.Append(new List { null, null }); - Assert.Equal(13, df.RowCount); - Assert.Equal(2, df.Columns[0].NullCount); - Assert.Equal(3, df.Columns[1].NullCount); - - df.Append(new List> { KeyValuePair.Create("Column1", (object)5), KeyValuePair.Create("Column2", (object)false) }); - Assert.Equal(14, df.RowCount); - Assert.Equal(2, df.Columns[0].NullCount); - Assert.Equal(3, df.Columns[1].NullCount); - - df.Append(new List> { KeyValuePair.Create("Column1", (object)5)}); - Assert.Equal(15, df.RowCount); - Assert.Equal(15, df["Column1"].Length); - Assert.Equal(15, df["Column2"].Length); - Assert.Equal(2, df.Columns[0].NullCount); - Assert.Equal(4, df.Columns[1].NullCount); - - df.Append(new List> { KeyValuePair.Create("Column2", (object)false) }); - Assert.Equal(16, df.RowCount); - Assert.Equal(16, df["Column1"].Length); - Assert.Equal(16, df["Column2"].Length); - Assert.Equal(3, df.Columns[0].NullCount); - Assert.Equal(4, df.Columns[1].NullCount); - - df.Append((IEnumerable)null); - Assert.Equal(17, df.RowCount); - Assert.Equal(17, df["Column1"].Length); - Assert.Equal(17, df["Column2"].Length); - Assert.Equal(4, df.Columns[0].NullCount); - Assert.Equal(5, df.Columns[1].NullCount); + [Fact] + public void TestAppendRow() + { + DataFrame df = MakeDataFrame(10); + df.Append(new List { 5, true }); + Assert.Equal(11, df.RowCount); + Assert.Equal(1, df.Columns[0].NullCount); + Assert.Equal(1, df.Columns[1].NullCount); + + df.Append(new List { 100 }); + Assert.Equal(12, df.RowCount); + Assert.Equal(1, df.Columns[0].NullCount); + Assert.Equal(2, df.Columns[1].NullCount); + + df.Append(new List { null, null }); + Assert.Equal(13, df.RowCount); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(3, df.Columns[1].NullCount); + + df.Append(new List> { KeyValuePair.Create("Column1", (object)5), KeyValuePair.Create("Column2", (object)false) }); + Assert.Equal(14, df.RowCount); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(3, df.Columns[1].NullCount); + + df.Append(new List> { KeyValuePair.Create("Column1", (object)5) }); + Assert.Equal(15, df.RowCount); + Assert.Equal(15, df["Column1"].Length); + Assert.Equal(15, df["Column2"].Length); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(4, df.Columns[1].NullCount); + + df.Append(new List> { KeyValuePair.Create("Column2", (object)false) }); + Assert.Equal(16, df.RowCount); + Assert.Equal(16, df["Column1"].Length); + Assert.Equal(16, df["Column2"].Length); + Assert.Equal(3, df.Columns[0].NullCount); + Assert.Equal(4, df.Columns[1].NullCount); + + df.Append((IEnumerable)null); + Assert.Equal(17, df.RowCount); + Assert.Equal(17, df["Column1"].Length); + Assert.Equal(17, df["Column2"].Length); + Assert.Equal(4, df.Columns[0].NullCount); + Assert.Equal(5, df.Columns[1].NullCount); // DataFrame must remain usable even if Append throws Assert.Throws(() => df.Append(new List { 5, "str" })); @@ -1867,10 +1875,10 @@ public void TestAppendRow() Assert.Throws(() => df.Append(new List { 5, true, true })); df.Append(); - Assert.Equal(18, df.RowCount); - Assert.Equal(18, df["Column1"].Length); - Assert.Equal(18, df["Column2"].Length); - Assert.Equal(5, df.Columns[0].NullCount); + Assert.Equal(18, df.RowCount); + Assert.Equal(18, df["Column1"].Length); + Assert.Equal(18, df["Column2"].Length); + Assert.Equal(5, df.Columns[0].NullCount); Assert.Equal(6, df.Columns[1].NullCount); } } From 5c4b1b4dcd7a870460559d547dead554153745ac Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 8 Nov 2019 15:21:52 -0800 Subject: [PATCH 04/53] Version, Tags and Description for Nuget (#2779) * Version, Tags and Description for Nuget * sq --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 20a8c9551f..0fa795cd23 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -4,6 +4,11 @@ netstandard2.0 7.3 true + 0.1.0 + false + This package contains easy-to-use and high-performance libraries for data analysis and transformation. + Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. + ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration From 5de343cea9e0f13ae367b9287f64b3433881a319 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 8 Nov 2019 17:11:48 -0800 Subject: [PATCH 05/53] Flags for release (#2781) * Publish packages to artifacts * Flags for release --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 0fa795cd23..aaded7d02d 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -4,7 +4,8 @@ netstandard2.0 7.3 true - 0.1.0 + 0.1.0 + true false This package contains easy-to-use and high-performance libraries for data analysis and transformation. Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. From 81f3d42c4e1bb382817e013b42d6b16e0f0da7b2 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 22 Nov 2019 14:57:41 -0800 Subject: [PATCH 06/53] Fix the Description method to not throw (#2786) * Fix the Description method to not crash Adds an Info method * sq * Address feddback * Last round of feedback --- src/Microsoft.Data.Analysis/DataFrame.cs | 54 ++++++++++++------- .../DataFrameColumn.cs | 15 +++++- .../PrimitiveDataFrameColumn.cs | 44 ++++++++++----- .../strings.Designer.cs | 18 +++++++ src/Microsoft.Data.Analysis/strings.resx | 6 +++ .../DataFrameTests.cs | 49 ++++++++++++++++- 6 files changed, 149 insertions(+), 37 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index 6751b4edaa..c0194b8f69 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -205,41 +205,57 @@ private DataFrame Clone(DataFrameColumn mapIndices = null, bool invertMapIndices } /// - /// Generates descriptive statistics that summarize each numeric column + /// Generates a concise summary of each column in the DataFrame /// - public DataFrame Description() + public DataFrame Info() { DataFrame ret = new DataFrame(); - if (Columns.Count == 0) - return ret; - int i = 0; - while (!Columns[i].HasDescription()) + + bool firstColumn = true; + foreach (DataFrameColumn column in Columns) { - i++; + if (firstColumn) + { + firstColumn = false; + StringDataFrameColumn strColumn = new StringDataFrameColumn("Info", 2); + strColumn[0] = Strings.DataType; + strColumn[1] = Strings.DescriptionMethodLength; + ret.Columns.Add(strColumn); + } + ret.Columns.Add(column.Info()); } - ret = Columns[i].Description(); - i++; - for (; i < Columns.Count; i++) + return ret; + } + + /// + /// Generates descriptive statistics that summarize each numeric column + /// + public DataFrame Description() + { + DataFrame ret = new DataFrame(); + + bool firstDescriptionColumn = true; + foreach (DataFrameColumn column in Columns) { - DataFrameColumn column = Columns[i]; if (!column.HasDescription()) { continue; } - DataFrame columnDescription = column.Description(); - ret = ret.Merge(columnDescription, "Description", "Description", "_left", "_right", JoinAlgorithm.Inner); - int leftMergeColumn = ret._columnCollection.IndexOf("Description" + "_left"); - int rightMergeColumn = ret._columnCollection.IndexOf("Description" + "_right"); - if (leftMergeColumn != -1 && rightMergeColumn != -1) + if (firstDescriptionColumn) { - ret.Columns.Remove("Description" + "_right"); - ret._columnCollection.SetColumnName(ret["Description_left"], "Description"); + firstDescriptionColumn = false; + StringDataFrameColumn stringColumn = new StringDataFrameColumn("Description", 0); + stringColumn.Append(Strings.DescriptionMethodLength); + stringColumn.Append("Max"); + stringColumn.Append("Min"); + stringColumn.Append("Mean"); + ret.Columns.Add(stringColumn); } + ret.Columns.Add(column.Description()); } return ret; } - public DataFrame Sort(string columnName, bool ascending = true) { DataFrameColumn column = this[columnName]; diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.cs index a5d3abe5a2..579e8b8b1e 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.cs @@ -185,9 +185,20 @@ public virtual DataFrameColumn Sort(bool ascending = true) public virtual bool HasDescription() => false; /// - /// Returns a DataFrame with statistics that describe the column + /// Returns a containing the DataType and Length of this column /// - public virtual DataFrame Description() => throw new NotImplementedException(); + public virtual StringDataFrameColumn Info() + { + StringDataFrameColumn dataColumn = new StringDataFrameColumn(Name, 2); + dataColumn[0] = DataType.ToString(); + dataColumn[1] = (Length - NullCount).ToString(); + return dataColumn; + } + + /// + /// Returns a with statistics that describe the column + /// + public virtual DataFrameColumn Description() => throw new NotImplementedException(); internal virtual PrimitiveDataFrameColumn GetAscendingSortIndices() => throw new NotImplementedException(); diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs index a613470a55..f44202ed44 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs @@ -551,25 +551,41 @@ protected override DataFrameColumn FilterImplementation(U lower, U upper) throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(U)); } - public override DataFrame Description() - { - DataFrame ret = new DataFrame(); - StringDataFrameColumn stringColumn = new StringDataFrameColumn("Description", 0); - stringColumn.Append("Length"); - stringColumn.Append("Max"); - stringColumn.Append("Min"); - stringColumn.Append("Mean"); - float max = (float)Convert.ChangeType(Max(), typeof(float)); - float min = (float)Convert.ChangeType(Min(), typeof(float)); - float mean = (float)Convert.ChangeType(Sum(), typeof(float)) / Length; + public override DataFrameColumn Description() + { + float? max; + float? min; + float? mean; + try + { + max = (float)Convert.ChangeType(Max(), typeof(float)); + } + catch (Exception) + { + max = null; + } + try + { + min = (float)Convert.ChangeType(Min(), typeof(float)); + } + catch (Exception) + { + min = null; + } + try + { + mean = (float)Convert.ChangeType(Sum(), typeof(float)) / Length; + } + catch (Exception) + { + mean = null; + } PrimitiveDataFrameColumn column = new PrimitiveDataFrameColumn(Name); column.Append(Length - NullCount); column.Append(max); column.Append(min); column.Append(mean); - ret.Columns.Insert(0, stringColumn); - ret.Columns.Insert(1, column); - return ret; + return column; } protected internal override void AddDataViewColumn(DataViewSchema.Builder builder) diff --git a/src/Microsoft.Data.Analysis/strings.Designer.cs b/src/Microsoft.Data.Analysis/strings.Designer.cs index 1132baa79f..f7bf691b47 100644 --- a/src/Microsoft.Data.Analysis/strings.Designer.cs +++ b/src/Microsoft.Data.Analysis/strings.Designer.cs @@ -78,6 +78,24 @@ internal static string ColumnIndexOutOfRange { } } + /// + /// Looks up a localized string similar to DataType. + /// + internal static string DataType { + get { + return ResourceManager.GetString("DataType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Length (excluding null values). + /// + internal static string DescriptionMethodLength { + get { + return ResourceManager.GetString("DescriptionMethodLength", resourceCulture); + } + } + /// /// Looks up a localized string similar to DataFrame already contains a column called {0}. /// diff --git a/src/Microsoft.Data.Analysis/strings.resx b/src/Microsoft.Data.Analysis/strings.resx index 2162a4bc79..7e9d040bc6 100644 --- a/src/Microsoft.Data.Analysis/strings.resx +++ b/src/Microsoft.Data.Analysis/strings.resx @@ -123,6 +123,12 @@ Index cannot be greater than the Column's Length + + DataType + + + Length (excluding null values) + DataFrame already contains a column called {0} diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 8cf0cf6915..85228b597e 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -1661,14 +1661,23 @@ public void TestMerge() public void TestDescription() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); + + // Add a column manually here until we fix https://github.com/dotnet/corefxlab/issues/2784 + PrimitiveDataFrameColumn dateTimes = new PrimitiveDataFrameColumn("DateTimes"); + for (int i = 0; i < 10; i++) + { + dateTimes.Append(DateTime.Parse("2019/01/01")); + } + df.Columns.Add(dateTimes); + DataFrame description = df.Description(); DataFrameColumn descriptionColumn = description.Columns[0]; Assert.Equal("Description", descriptionColumn.Name); - Assert.Equal("Length", descriptionColumn[0]); + Assert.Equal("Length (excluding null values)", descriptionColumn[0]); Assert.Equal("Max", descriptionColumn[1]); Assert.Equal("Min", descriptionColumn[2]); Assert.Equal("Mean", descriptionColumn[3]); - for (int i = 1; i < description.Columns.Count; i++) + for (int i = 1; i < description.Columns.Count - 1; i++) { DataFrameColumn column = description.Columns[i]; Assert.Equal(df.Columns[i - 1].Name, column.Name); @@ -1678,6 +1687,42 @@ public void TestDescription() Assert.Equal((float)0, column[2]); Assert.Equal((float)4, column[3]); } + + // Explicitly check the dateTimes column + DataFrameColumn dateTimeColumn = description.Columns[description.Columns.Count - 1]; + Assert.Equal(dateTimeColumn.Name, dateTimes.Name); + Assert.Equal(4, dateTimeColumn.Length); + Assert.Equal((float)10, dateTimeColumn[0]); + Assert.Null(dateTimeColumn[1]); + Assert.Null(dateTimeColumn[2]); + Assert.Null(dateTimeColumn[3]); + } + + [Fact] + public void TestInfo() + { + DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); + + // Add a column manually here until we fix https://github.com/dotnet/corefxlab/issues/2784 + PrimitiveDataFrameColumn dateTimes = new PrimitiveDataFrameColumn("DateTimes"); + for (int i = 0; i < 10; i++) + { + dateTimes.Append(DateTime.Parse("2019/01/01")); + } + df.Columns.Add(dateTimes); + + DataFrame Info = df.Info(); + DataFrameColumn infoColumn = Info.Columns[0]; + Assert.Equal("Info", infoColumn.Name); + Assert.Equal("Length (excluding null values)", infoColumn[1]); + Assert.Equal("DataType", infoColumn[0]); + + for (int i = 1; i < Info.Columns.Count; i++) + { + DataFrameColumn column = Info.Columns[i]; + Assert.Equal(df.Columns[i - 1].DataType.ToString(), column[0].ToString()); + Assert.Equal(2, column.Length); + } } [Fact] From c6eb2f778e6effb889d250d0dfdf3a07883f414e Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Tue, 3 Dec 2019 11:17:58 -0800 Subject: [PATCH 07/53] Use dataTypes if it passed in to LoadCsv (#2791) * Fix LoadCsv to use dataType if it passed in * sq * Don't read the full file after guessRows lines have been read * Address feedback * Last round of feedback --- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 206 +++++++++--------- src/Microsoft.Data.Analysis/DataFrame.cs | 5 + .../DataFrame.IOTests.cs | 48 +++- .../DataFrameTests.cs | 23 ++ 4 files changed, 182 insertions(+), 100 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index b228e2a92c..ed452c140e 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text; namespace Microsoft.Data.Analysis { @@ -104,6 +103,77 @@ public static DataFrame LoadCsv(string filename, } } + private static DataFrameColumn CreateColumn(Type kind, string[] columnNames, int columnIndex) + { + PrimitiveDataFrameColumn CreatePrimitiveDataFrameColumn() + where T : unmanaged + { + return new PrimitiveDataFrameColumn(columnNames == null ? "Column" + columnIndex.ToString() : columnNames[columnIndex]); + } + DataFrameColumn ret; + if (kind == typeof(bool)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(int)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(float)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(string)) + { + ret = new StringDataFrameColumn(columnNames == null ? "Column" + columnIndex.ToString() : columnNames[columnIndex], 0); + } + else if (kind == typeof(long)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(decimal)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(byte)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(char)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(double)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(sbyte)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(short)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(uint)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(ulong)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else if (kind == typeof(ushort)) + { + ret = CreatePrimitiveDataFrameColumn(); + } + else + { + throw new NotSupportedException(nameof(kind)); + } + return ret; + } + /// /// Reads a seekable stream of CSV data into a DataFrame. /// Follows pandas API. @@ -116,7 +186,7 @@ public static DataFrame LoadCsv(string filename, /// number of rows to read not including the header(if present) /// number of rows used to guess types /// add one column with the row index - /// DataFrame + /// public static DataFrame LoadCsv(Stream csvStream, char separator = ',', bool header = true, string[] columnNames = null, Type[] dataTypes = null, @@ -127,7 +197,7 @@ public static DataFrame LoadCsv(Stream csvStream, var linesForGuessType = new List(); long rowline = 0; - int numberOfColumns = 0; + int numberOfColumns = dataTypes?.Length ?? 0; if (header == true && numberOfRowsToRead != -1) numberOfRowsToRead++; @@ -137,60 +207,52 @@ public static DataFrame LoadCsv(Stream csvStream, // First pass: schema and number of rows. using (var streamReader = new StreamReader(csvStream, encoding: null, detectEncodingFromByteOrderMarks: true, bufferSize: -1, leaveOpen: true)) { - string line = streamReader.ReadLine(); - while (line != null) + string line = null; + if (dataTypes == null) { - if ((numberOfRowsToRead == -1) || rowline < numberOfRowsToRead) + line = streamReader.ReadLine(); + while (line != null) { - if (linesForGuessType.Count < guessRows) + if ((numberOfRowsToRead == -1) || rowline < numberOfRowsToRead) { - var spl = line.Split(separator); - if (header && rowline == 0) + if (linesForGuessType.Count < guessRows) { - if (columnNames == null) - columnNames = spl; - } - else - { - linesForGuessType.Add(spl); - numberOfColumns = Math.Max(numberOfColumns, spl.Length); + var spl = line.Split(separator); + if (header && rowline == 0) + { + if (columnNames == null) + columnNames = spl; + } + else + { + linesForGuessType.Add(spl); + numberOfColumns = Math.Max(numberOfColumns, spl.Length); + } } } + ++rowline; + if (rowline == guessRows) + { + break; + } + line = streamReader.ReadLine(); } - ++rowline; - if (rowline == numberOfRowsToRead) - break; - line = streamReader.ReadLine(); - } - if (linesForGuessType.Count == 0) - throw new FormatException(Strings.EmptyFile); + if (linesForGuessType.Count == 0) + { + throw new FormatException(Strings.EmptyFile); + } + } columns = new List(numberOfColumns); - - // Guesses types and adds columns. + // Guesses types or looks up dataTypes and adds columns. for (int i = 0; i < numberOfColumns; ++i) { - Type kind = GuessKind(i, linesForGuessType); - if (kind == typeof(bool)) - { - DataFrameColumn boolColumn = new PrimitiveDataFrameColumn(columnNames == null ? "Column" + i.ToString() : columnNames[i], header == true ? rowline - 1 : rowline); - columns.Add(boolColumn); - } - else if (kind == typeof(float)) - { - DataFrameColumn floatColumn = new PrimitiveDataFrameColumn(columnNames == null ? "Column" + i.ToString() : columnNames[i], header == true ? rowline - 1 : rowline); - columns.Add(floatColumn); - } - else if (kind == typeof(string)) - { - DataFrameColumn stringColumn = new StringDataFrameColumn(columnNames == null ? "Column" + i.ToString() : columnNames[i], header == true ? rowline - 1 : rowline); - columns.Add(stringColumn); - } - else - throw new NotSupportedException(nameof(kind)); + Type kind = dataTypes == null ? GuessKind(i, linesForGuessType) : dataTypes[i]; + columns.Add(CreateColumn(kind, columnNames, i)); } + DataFrame ret = new DataFrame(columns); line = null; streamReader.DiscardBufferedData(); streamReader.BaseStream.Seek(streamStart, SeekOrigin.Begin); @@ -207,7 +269,7 @@ public static DataFrame LoadCsv(Stream csvStream, } else { - AppendRow(columns, header == true ? rowline - 1 : rowline, spl); + ret.Append(spl); } ++rowline; line = streamReader.ReadLine(); @@ -222,61 +284,7 @@ public static DataFrame LoadCsv(Stream csvStream, } columns.Insert(0, indexColumn); } - } - return new DataFrame(columns); - } - - private static void AppendRow(List columns, long rowIndex, string[] values) - { - for (int i = 0; i < columns.Count; i++) - { - DataFrameColumn column = columns[i]; - string val = values[i]; - Type dType = column.DataType; - if (dType == typeof(bool)) - { - bool boolParse = bool.TryParse(val, out bool boolResult); - if (boolParse) - { - column[rowIndex] = boolResult; - continue; - } - else - { - if (string.IsNullOrEmpty(val)) - { - column[rowIndex] = null; - continue; - } - throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(bool)), nameof(val)); - } - } - else if (dType == typeof(float)) - { - bool floatParse = float.TryParse(val, out float floatResult); - if (floatParse) - { - column[rowIndex] = floatResult; - continue; - } - else - { - if (string.IsNullOrEmpty(val)) - { - column[rowIndex] = null; - continue; - } - throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(float)), nameof(val)); - } - } - else if (dType == typeof(string)) - { - column[rowIndex] = values[i]; - } - else - { - throw new NotImplementedException(); - } + return ret; } } } diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index c0194b8f69..a68e6e502c 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -445,6 +445,11 @@ public void Append(IEnumerable row = null) { DataFrameColumn column = columnEnumerator.Current; object value = rowEnumerator.Current; + // StringDataFrameColumn can accept empty strings. The other columns interpret empty values as nulls + if (value is string stringValue && string.IsNullOrEmpty(stringValue) && column.DataType != typeof(string)) + { + value = null; + } if (value != null) { value = Convert.ChangeType(value, column.DataType); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index 4d1a4f1708..1284d050d4 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -4,7 +4,6 @@ using System; using System.IO; -using System.Runtime.CompilerServices; using System.Text; using Xunit; @@ -58,5 +57,52 @@ Stream GetStream(string streamData) Assert.Equal(7, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows["Column0"][2]); } + + [Fact] + public void TestReadCsvWithTypes() + { + string data = @"vendor_id,rate_code,passenger_count,trip_time_in_secs,trip_distance,payment_type,fare_amount +CMT,1,1,1271,3.8,CRD,17.5 +CMT,1,1,474,1.5,CRD,8 +CMT,1,1,637,1.4,CRD,8.5 +,,,,,, +CMT,1,1,181,0.6,CSH,4.5"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) }); + Assert.Equal(5, df.RowCount); + Assert.Equal(7, df.Columns.Count); + + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(short) == df.Columns[1].DataType); + Assert.True(typeof(int) == df.Columns[2].DataType); + Assert.True(typeof(long) == df.Columns[3].DataType); + Assert.True(typeof(float) == df.Columns[4].DataType); + Assert.True(typeof(string) == df.Columns[5].DataType); + Assert.True(typeof(double) == df.Columns[6].DataType); + + foreach (var column in df.Columns) + { + if (column.DataType != typeof(string)) + { + Assert.Equal(1, column.NullCount); + } + else + { + Assert.Equal(0, column.NullCount); + } + } + var nullRow = df[3]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + Assert.Null(nullRow[4]); + Assert.Equal("", nullRow[5]); + Assert.Null(nullRow[6]); + } } } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 85228b597e..5c0fcd19ff 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -1926,5 +1926,28 @@ public void TestAppendRow() Assert.Equal(5, df.Columns[0].NullCount); Assert.Equal(6, df.Columns[1].NullCount); } + + [Fact] + public void TestAppendEmptyValue() + { + DataFrame df = MakeDataFrame(10); + df.Append(new List { "", true }); + Assert.Equal(11, df.RowCount); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(1, df.Columns[1].NullCount); + + StringDataFrameColumn column = new StringDataFrameColumn("Strings", Enumerable.Range(0, 11).Select(x => x.ToString())); + df.Columns.Add(column); + + df.Append(new List { 1, true, "" }); + Assert.Equal(12, df.RowCount); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(1, df.Columns[1].NullCount); + Assert.Equal(0, df.Columns[2].NullCount); + + df.Append(new List { 1, true, null }); + Assert.Equal(13, df.RowCount); + Assert.Equal(1, df.Columns[2].NullCount); + } } } From 7cee9d94b98cf0163eb1de39037f740088c9af30 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 5 Dec 2019 13:42:27 -0800 Subject: [PATCH 08/53] Creating a `Rows` property, similar to `Columns` (#2794) * Rows collection, similar to Columns * Doc * Some minor clean up * Make DataFrameRow a view into the DataFrame * sq * Address feedback * Remove DataFrame.RowCount * More row count changes * sq * Address feedback * Merge upstream --- .../DataFrame.Arrow.cs | 4 +- .../DataFrame.IDataView.cs | 4 +- src/Microsoft.Data.Analysis/DataFrame.Join.cs | 24 +-- src/Microsoft.Data.Analysis/DataFrame.cs | 36 ++-- .../DataFrameColumnCollection.cs | 10 - src/Microsoft.Data.Analysis/DataFrameRow.cs | 70 +++++++ .../DataFrameRowCollection.cs | 56 +++++ .../ArrowIntegrationTests.cs | 2 +- .../DataFrame.IOTests.cs | 12 +- .../DataFrameTests.IDataView.cs | 2 +- .../DataFrameTests.cs | 196 +++++++++++------- 11 files changed, 291 insertions(+), 125 deletions(-) create mode 100644 src/Microsoft.Data.Analysis/DataFrameRow.cs create mode 100644 src/Microsoft.Data.Analysis/DataFrameRowCollection.cs diff --git a/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs b/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs index dda54b6cea..396f778a73 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs @@ -148,7 +148,7 @@ public IEnumerable ToArrowRecordBatches() List arrays = new List(); int recordBatchLength = Int32.MaxValue; - int numberOfRowsInThisRecordBatch = (int)Math.Min(recordBatchLength, RowCount); + int numberOfRowsInThisRecordBatch = (int)Math.Min(recordBatchLength, Rows.Count); long numberOfRowsProcessed = 0; // Sometimes .NET for Spark passes in DataFrames with no rows. In those cases, we just return a RecordBatch with the right Schema and no rows @@ -166,7 +166,7 @@ public IEnumerable ToArrowRecordBatches() } numberOfRowsProcessed += numberOfRowsInThisRecordBatch; yield return new RecordBatch(schema, arrays, numberOfRowsInThisRecordBatch); - } while (numberOfRowsProcessed < RowCount); + } while (numberOfRowsProcessed < Rows.Count); } } diff --git a/src/Microsoft.Data.Analysis/DataFrame.IDataView.cs b/src/Microsoft.Data.Analysis/DataFrame.IDataView.cs index e7ee8fc572..4755f296f4 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IDataView.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IDataView.cs @@ -38,7 +38,7 @@ private DataViewSchema DataViewSchema DataViewSchema IDataView.Schema => DataViewSchema; - long? IDataView.GetRowCount() => RowCount; + long? IDataView.GetRowCount() => Rows.Count; private DataViewRowCursor GetRowCursorCore(IEnumerable columnsNeeded) { @@ -133,7 +133,7 @@ public override bool MoveNext() if (_disposed) return false; _position++; - return _position < _dataFrame.RowCount; + return _position < _dataFrame.Rows.Count; } } } diff --git a/src/Microsoft.Data.Analysis/DataFrame.Join.cs b/src/Microsoft.Data.Analysis/DataFrame.Join.cs index 609eac102c..dbb0998428 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.Join.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.Join.cs @@ -44,7 +44,7 @@ public DataFrame Join(DataFrame other, string leftSuffix = "_left", string right DataFrameColumn newColumn = Columns[i].Clone(); ret.Columns.Insert(ret.Columns.Count, newColumn); } - long minLength = Math.Min(RowCount, other.RowCount); + long minLength = Math.Min(Rows.Count, other.Rows.Count); PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("mapIndices", minLength); for (long i = 0; i < minLength; i++) { @@ -53,9 +53,9 @@ public DataFrame Join(DataFrame other, string leftSuffix = "_left", string right for (int i = 0; i < other.Columns.Count; i++) { DataFrameColumn newColumn; - if (other.RowCount < RowCount) + if (other.Rows.Count < Rows.Count) { - newColumn = other.Columns[i].Clone(numberOfNullsToAppend: RowCount - other.RowCount); + newColumn = other.Columns[i].Clone(numberOfNullsToAppend: Rows.Count - other.Rows.Count); } else { @@ -67,7 +67,7 @@ public DataFrame Join(DataFrame other, string leftSuffix = "_left", string right } else if (joinAlgorithm == JoinAlgorithm.Right) { - long minLength = Math.Min(RowCount, other.RowCount); + long minLength = Math.Min(Rows.Count, other.Rows.Count); PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("mapIndices", minLength); for (long i = 0; i < minLength; i++) { @@ -76,9 +76,9 @@ public DataFrame Join(DataFrame other, string leftSuffix = "_left", string right for (int i = 0; i < Columns.Count; i++) { DataFrameColumn newColumn; - if (RowCount < other.RowCount) + if (Rows.Count < other.Rows.Count) { - newColumn = Columns[i].Clone(numberOfNullsToAppend: other.RowCount - RowCount); + newColumn = Columns[i].Clone(numberOfNullsToAppend: other.Rows.Count - Rows.Count); } else { @@ -95,14 +95,14 @@ public DataFrame Join(DataFrame other, string leftSuffix = "_left", string right } else if (joinAlgorithm == JoinAlgorithm.FullOuter) { - long newRowCount = Math.Max(RowCount, other.RowCount); - long numberOfNulls = newRowCount - RowCount; + long newRowCount = Math.Max(Rows.Count, other.Rows.Count); + long numberOfNulls = newRowCount - Rows.Count; for (int i = 0; i < Columns.Count; i++) { DataFrameColumn newColumn = Columns[i].Clone(numberOfNullsToAppend: numberOfNulls); ret.Columns.Insert(ret.Columns.Count, newColumn); } - numberOfNulls = newRowCount - other.RowCount; + numberOfNulls = newRowCount - other.Rows.Count; for (int i = 0; i < other.Columns.Count; i++) { DataFrameColumn newColumn = other.Columns[i].Clone(numberOfNullsToAppend: numberOfNulls); @@ -112,7 +112,7 @@ public DataFrame Join(DataFrame other, string leftSuffix = "_left", string right } else if (joinAlgorithm == JoinAlgorithm.Inner) { - long newRowCount = Math.Min(RowCount, other.RowCount); + long newRowCount = Math.Min(Rows.Count, other.Rows.Count); PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("mapIndices", newRowCount); for (long i = 0; i < newRowCount; i++) { @@ -242,8 +242,8 @@ public DataFrame Merge(DataFrame other, string leftJoinColumn, string righ else if (joinAlgorithm == JoinAlgorithm.Inner) { // Hash the column with the smaller RowCount - long leftRowCount = RowCount; - long rightRowCount = other.RowCount; + long leftRowCount = Rows.Count; + long rightRowCount = other.Rows.Count; DataFrame longerDataFrame = leftRowCount <= rightRowCount ? other : this; DataFrame shorterDataFrame = ReferenceEquals(longerDataFrame, this) ? other : this; DataFrameColumn hashColumn = (leftRowCount <= rightRowCount) ? this[leftJoinColumn] : other[rightJoinColumn]; diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index a68e6e502c..6bf50f46c9 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -32,20 +32,26 @@ public enum DropNullOptions public partial class DataFrame { private readonly DataFrameColumnCollection _columnCollection; + private readonly DataFrameRowCollection _rowCollection; public DataFrame() { _columnCollection = new DataFrameColumnCollection(OnColumnsChanged); + _rowCollection = new DataFrameRowCollection(this); } public DataFrame(IList columns) { _columnCollection = new DataFrameColumnCollection(columns, OnColumnsChanged); + _rowCollection = new DataFrameRowCollection(this); } - public long RowCount => _columnCollection.RowCount; - public DataFrameColumnCollection Columns => _columnCollection; + /// + /// Returns a that contains a view of the rows in this + /// + public DataFrameRowCollection Rows => _rowCollection; + internal IReadOnlyList GetColumnNames() => _columnCollection.GetColumnNames(); #region Operators @@ -55,15 +61,6 @@ public DataFrame(IList columns) set => _columnCollection[columnIndex][rowIndex] = value; } - public IList this[long rowIndex] - { - get - { - return _columnCollection.GetRow(rowIndex); - } - //TODO?: set? - } - /// /// Returns a new DataFrame using the boolean values in /// @@ -177,9 +174,9 @@ public DataFrame Head(int numberOfRows) public DataFrame Tail(int numberOfRows) { PrimitiveDataFrameColumn filter = new PrimitiveDataFrameColumn("Filter", numberOfRows); - for (long i = RowCount - numberOfRows; i < RowCount; i++) + for (long i = Rows.Count - numberOfRows; i < Rows.Count; i++) { - filter[i - (RowCount - numberOfRows)] = i; + filter[i - (Rows.Count - numberOfRows)] = i; } return Clone(filter); } @@ -328,7 +325,7 @@ public DataFrame Sample(int numberOfRows) { Random rand = new Random(); PrimitiveDataFrameColumn indices = new PrimitiveDataFrameColumn("Indices", numberOfRows); - int randMaxValue = (int)Math.Min(Int32.MaxValue, RowCount); + int randMaxValue = (int)Math.Min(Int32.MaxValue, Rows.Count); for (long i = 0; i < numberOfRows; i++) { indices[i] = rand.Next(randMaxValue); @@ -369,7 +366,7 @@ public DataFrame DropNulls(DropNullOptions options = DropNullOptions.Any) PrimitiveDataFrameColumn filter = new PrimitiveDataFrameColumn("Filter"); if (options == DropNullOptions.Any) { - filter.AppendMany(true, RowCount); + filter.AppendMany(true, Rows.Count); for (int i = 0; i < Columns.Count; i++) { @@ -382,7 +379,7 @@ public DataFrame DropNulls(DropNullOptions options = DropNullOptions.Any) } else { - filter.AppendMany(false, RowCount); + filter.AppendMany(false, Rows.Count); for (int i = 0; i < Columns.Count; i++) { DataFrameColumn column = Columns[i]; @@ -540,7 +537,7 @@ public void Append(IEnumerable> row) foreach (DataFrameColumn column in Columns) { - if (column.Length == RowCount) + if (column.Length == Rows.Count) { ResizeByOneAndAppend(column, null); } @@ -570,11 +567,10 @@ public override string ToString() sb.Append(string.Format(Columns[i].Name.PadRight(longestColumnName))); } sb.AppendLine(); - long numberOfRows = Math.Min(RowCount, 25); + long numberOfRows = Math.Min(Rows.Count, 25); for (int i = 0; i < numberOfRows; i++) { - IList row = this[i]; - foreach (object obj in row) + foreach (object obj in Rows[i]) { sb.Append((obj ?? "null").ToString().PadRight(longestColumnName)); } diff --git a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs index 9454b675f9..68861f2f43 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs @@ -46,16 +46,6 @@ internal IReadOnlyList GetColumnNames() return ret; } - internal IList GetRow(long rowIndex) - { - var ret = new List(); - for (int i = 0; i < Count; i++) - { - ret.Add(this[i][rowIndex]); - } - return ret; - } - public void SetColumnName(DataFrameColumn column, string newName) { string currentName = column.Name; diff --git a/src/Microsoft.Data.Analysis/DataFrameRow.cs b/src/Microsoft.Data.Analysis/DataFrameRow.cs new file mode 100644 index 0000000000..812fd69721 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameRow.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + /// + /// A DataFrameRow is a collection of values that represent a row in a . + /// + public class DataFrameRow : IEnumerable + { + private readonly DataFrame _dataFrame; + private readonly long _rowIndex; + internal DataFrameRow(DataFrame df, long rowIndex) + { + Debug.Assert(rowIndex < df.Columns.RowCount); + _dataFrame = df; + _rowIndex = rowIndex; + } + + /// + /// Returns an enumerator of the values in this row. + /// + public IEnumerator GetEnumerator() + { + foreach (DataFrameColumn column in _dataFrame.Columns) + { + yield return column[_rowIndex]; + } + } + + /// + /// An indexer to return the value at . + /// + /// The index of the value to return + /// The value at this . + public object this[int index] + { + get + { + return _dataFrame.Columns[index][_rowIndex]; + } + set + { + _dataFrame.Columns[index][_rowIndex] = value; + } + } + + /// + /// A simple string representation of the values in this row + /// + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + foreach (object value in this) + { + sb.Append(value?.ToString() ?? "null").Append(" "); + } + return sb.ToString(); + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + } +} diff --git a/src/Microsoft.Data.Analysis/DataFrameRowCollection.cs b/src/Microsoft.Data.Analysis/DataFrameRowCollection.cs new file mode 100644 index 0000000000..85af70f76e --- /dev/null +++ b/src/Microsoft.Data.Analysis/DataFrameRowCollection.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + /// + /// Represents the rows of a + /// + public class DataFrameRowCollection : IEnumerable + { + private readonly DataFrame _dataFrame; + + /// + /// Initializes a . + /// + internal DataFrameRowCollection(DataFrame dataFrame) + { + _dataFrame = dataFrame ?? throw new ArgumentNullException(nameof(dataFrame)); + } + + /// + /// An indexer to return the at + /// + /// The row index + public DataFrameRow this[long index] + { + get + { + return new DataFrameRow(_dataFrame, index); + } + } + + /// + /// Returns an enumerator of objects + /// + public IEnumerator GetEnumerator() + { + for (long i = 0; i < Count; i++) + { + yield return new DataFrameRow(_dataFrame, i); + } + } + + /// + /// The number of rows in this . + /// + public long Count => _dataFrame.Columns.RowCount; + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs index 550c3a7254..d7b59accf2 100644 --- a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs @@ -134,7 +134,7 @@ public void TestEmptyArrowColumns() RecordBatch batch1 = new RecordBatch.Builder() .Append("EmptyDataAndNullColumns", false, col => col.Int32(array => array.Clear())).Build(); DataFrame emptyDataFrame = DataFrame.FromArrowRecordBatch(batch1); - Assert.Equal(0, emptyDataFrame.RowCount); + Assert.Equal(0, emptyDataFrame.Rows.Count); Assert.Equal(0, emptyDataFrame["EmptyDataAndNullColumns"].Length); Assert.Equal(0, emptyDataFrame["EmptyDataAndNullColumns"].NullCount); } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index 1284d050d4..0236f64537 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -25,12 +25,12 @@ Stream GetStream(string streamData) return new MemoryStream(Encoding.Default.GetBytes(streamData)); } DataFrame df = DataFrame.LoadCsv(GetStream(data)); - Assert.Equal(4, df.RowCount); + Assert.Equal(4, df.Rows.Count); Assert.Equal(7, df.Columns.Count); Assert.Equal("CMT", df["vendor_id"][3]); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); - Assert.Equal(3, reducedRows.RowCount); + Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows["vendor_id"][2]); } @@ -48,12 +48,12 @@ Stream GetStream(string streamData) return new MemoryStream(Encoding.Default.GetBytes(streamData)); } DataFrame df = DataFrame.LoadCsv(GetStream(data), header: false); - Assert.Equal(4, df.RowCount); + Assert.Equal(4, df.Rows.Count); Assert.Equal(7, df.Columns.Count); Assert.Equal("CMT", df["Column0"][3]); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), header: false, numberOfRowsToRead: 3); - Assert.Equal(3, reducedRows.RowCount); + Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows["Column0"][2]); } @@ -73,7 +73,7 @@ Stream GetStream(string streamData) return new MemoryStream(Encoding.Default.GetBytes(streamData)); } DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) }); - Assert.Equal(5, df.RowCount); + Assert.Equal(5, df.Rows.Count); Assert.Equal(7, df.Columns.Count); Assert.True(typeof(string) == df.Columns[0].DataType); @@ -95,7 +95,7 @@ Stream GetStream(string streamData) Assert.Equal(0, column.NullCount); } } - var nullRow = df[3]; + var nullRow = df.Rows[3]; Assert.Equal("", nullRow[0]); Assert.Null(nullRow[1]); Assert.Null(nullRow[2]); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs index 57b530607f..459c4a47ce 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs @@ -96,7 +96,7 @@ public void TestIDataViewSchemaInvalidate() schema = dataView.Schema; Assert.Equal(13, schema.Count); - DataFrameColumn boolColumn = new PrimitiveDataFrameColumn("Bool", Enumerable.Range(0, (int)df.RowCount).Select(x => x % 2 == 1)); + DataFrameColumn boolColumn = new PrimitiveDataFrameColumn("Bool", Enumerable.Range(0, (int)df.Rows.Count).Select(x => x % 2 == 1)); df.Columns.Insert(0, boolColumn); schema = dataView.Schema; Assert.Equal(14, schema.Count); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 5c0fcd19ff..f32983acdd 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -167,9 +167,9 @@ public static DataFrame MakeDataFrame(int length, bool withNulls = true) public DataFrame SplitTrainTest(DataFrame input, float testRatio, out DataFrame Test) { - IEnumerable randomIndices = Enumerable.Range(0, (int)input.RowCount); - IEnumerable trainIndices = randomIndices.Take((int)(input.RowCount * testRatio)); - IEnumerable testIndices = randomIndices.TakeLast((int)(input.RowCount * (1 - testRatio))); + IEnumerable randomIndices = Enumerable.Range(0, (int)input.Rows.Count); + IEnumerable trainIndices = randomIndices.Take((int)(input.Rows.Count * testRatio)); + IEnumerable testIndices = randomIndices.TakeLast((int)(input.Rows.Count * (1 - testRatio))); Test = input[testIndices]; return input[trainIndices]; } @@ -186,15 +186,15 @@ public void TestIndexer() Assert.Equal("Int1", dataFrame.Columns[0].Name); var headList = dataFrame.Head(5); - Assert.Equal(14, (int)headList[4][1]); + Assert.Equal(14, (int)headList.Rows[4][1]); var tailList = dataFrame.Tail(5); - Assert.Equal(19, (int)tailList[4][1]); + Assert.Equal(19, (int)tailList.Rows[4][1]); dataFrame[2, 1] = 1000; Assert.Equal(1000, dataFrame[2, 1]); - var row = dataFrame[4]; + var row = dataFrame.Rows[4]; Assert.Equal(14, (int)row[1]); var column = dataFrame["Int2"] as PrimitiveDataFrameColumn; @@ -211,7 +211,7 @@ public void ColumnAndTableCreationTest() DataFrame dataFrame = new DataFrame(); dataFrame.Columns.Insert(0, intColumn); dataFrame.Columns.Insert(1, floatColumn); - Assert.Equal(10, dataFrame.RowCount); + Assert.Equal(10, dataFrame.Rows.Count); Assert.Equal(2, dataFrame.Columns.Count); Assert.Equal(10, dataFrame.Columns[0].Length); Assert.Equal("IntColumn", dataFrame.Columns[0].Name); @@ -628,7 +628,7 @@ public void TestBinaryOperatorsOnBoolColumns() Assert.True(or.Columns[1].All()); DataFrame xor = df ^ true; - for (int i = 0; i < xor.RowCount; i++) + for (int i = 0; i < xor.Rows.Count; i++) { if (i % 2 == 0) Assert.False((bool)xor["Bool1"][i]); @@ -636,7 +636,7 @@ public void TestBinaryOperatorsOnBoolColumns() Assert.True((bool)xor["Bool1"][i]); } xor = true ^ df; - for (int i = 0; i < xor.RowCount; i++) + for (int i = 0; i < xor.Rows.Count; i++) { if (i % 2 == 0) Assert.False((bool)xor["Bool1"][i]); @@ -857,17 +857,17 @@ public void TestSplitAndSort() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(20); df["Int"][0] = 100000; - df["Int"][df.RowCount - 1] = -1; + df["Int"][df.Rows.Count - 1] = -1; df["Int"][5] = 200000; DataFrame dfTest; DataFrame dfTrain = SplitTrainTest(df, 0.8f, out dfTest); // Sort by "Int" in ascending order var sortedDf = dfTrain.Sort("Int"); - Assert.Null(sortedDf["Int"][sortedDf.RowCount - 1]); + Assert.Null(sortedDf["Int"][sortedDf.Rows.Count - 1]); Assert.Equal(1, sortedDf["Int"][0]); - Assert.Equal(100000, sortedDf["Int"][sortedDf.RowCount - 3]); - Assert.Equal(200000, sortedDf["Int"][sortedDf.RowCount - 2]); + Assert.Equal(100000, sortedDf["Int"][sortedDf.Rows.Count - 3]); + Assert.Equal(200000, sortedDf["Int"][sortedDf.Rows.Count - 2]); } [Fact] @@ -940,8 +940,8 @@ public void TestPrimitiveColumnSort(int numberOfNulls) private void VerifyJoin(DataFrame join, DataFrame left, DataFrame right, JoinAlgorithm joinAlgorithm) { - PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("map", join.RowCount); - for (long i = 0; i < join.RowCount; i++) + PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("map", join.Rows.Count); + for (long i = 0; i < join.Rows.Count; i++) { mapIndices[i] = i; } @@ -961,7 +961,7 @@ private void VerifyJoin(DataFrame join, DataFrame left, DataFrame right, JoinAlg { int columnIndex = i - left.Columns.Count; DataFrameColumn rightColumn = right.Columns[columnIndex]; - DataFrameColumn compareColumn = rightColumn.Length <= join.RowCount ? rightColumn.Clone(numberOfNullsToAppend: join.RowCount - rightColumn.Length) : rightColumn.Clone(mapIndices); + DataFrameColumn compareColumn = rightColumn.Length <= join.Rows.Count ? rightColumn.Clone(numberOfNullsToAppend: join.Rows.Count - rightColumn.Length) : rightColumn.Clone(mapIndices); isEqual = joinColumn.ElementwiseEquals(compareColumn); } } @@ -970,7 +970,7 @@ private void VerifyJoin(DataFrame join, DataFrame left, DataFrame right, JoinAlg if (i < left.Columns.Count) { DataFrameColumn leftColumn = left.Columns[i]; - DataFrameColumn compareColumn = leftColumn.Length <= join.RowCount ? leftColumn.Clone(numberOfNullsToAppend: join.RowCount - leftColumn.Length) : leftColumn.Clone(mapIndices); + DataFrameColumn compareColumn = leftColumn.Length <= join.Rows.Count ? leftColumn.Clone(numberOfNullsToAppend: join.Rows.Count - leftColumn.Length) : leftColumn.Clone(mapIndices); isEqual = joinColumn.ElementwiseEquals(compareColumn); } else @@ -999,16 +999,16 @@ private void VerifyJoin(DataFrame join, DataFrame left, DataFrame right, JoinAlg if (i < left.Columns.Count) { DataFrameColumn leftColumn = left.Columns[i]; - isEqual = joinColumn.ElementwiseEquals(leftColumn.Clone(numberOfNullsToAppend: join.RowCount - leftColumn.Length)); + isEqual = joinColumn.ElementwiseEquals(leftColumn.Clone(numberOfNullsToAppend: join.Rows.Count - leftColumn.Length)); } else { int columnIndex = i - left.Columns.Count; DataFrameColumn rightColumn = right.Columns[columnIndex]; - isEqual = joinColumn.ElementwiseEquals(rightColumn.Clone(numberOfNullsToAppend: join.RowCount - rightColumn.Length)); + isEqual = joinColumn.ElementwiseEquals(rightColumn.Clone(numberOfNullsToAppend: join.Rows.Count - rightColumn.Length)); } } - for (int j = 0; j < join.RowCount; j++) + for (int j = 0; j < join.Rows.Count; j++) { Assert.Equal(true, isEqual[j]); } @@ -1062,17 +1062,17 @@ public void TestJoin() DataFrame left = MakeDataFrameWithAllMutableColumnTypes(10); DataFrame right = MakeDataFrameWithAllMutableColumnTypes(5); - // Tests with right.RowCount < left.RowCount + // Tests with right.Rows.Count < left.Rows.Count // Left join DataFrame join = left.Join(right); - Assert.Equal(join.RowCount, left.RowCount); + Assert.Equal(join.Rows.Count, left.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Null(join["Int_right"][6]); VerifyJoin(join, left, right, JoinAlgorithm.Left); // Right join join = left.Join(right, joinAlgorithm: JoinAlgorithm.Right); - Assert.Equal(join.RowCount, right.RowCount); + Assert.Equal(join.Rows.Count, right.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(join["Int_right"][3], right["Int"][3]); Assert.Null(join["Int_right"][2]); @@ -1080,31 +1080,31 @@ public void TestJoin() // Outer join join = left.Join(right, joinAlgorithm: JoinAlgorithm.FullOuter); - Assert.Equal(join.RowCount, left.RowCount); + Assert.Equal(join.Rows.Count, left.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Null(join["Int_right"][6]); VerifyJoin(join, left, right, JoinAlgorithm.FullOuter); // Inner join join = left.Join(right, joinAlgorithm: JoinAlgorithm.Inner); - Assert.Equal(join.RowCount, right.RowCount); + Assert.Equal(join.Rows.Count, right.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(join["Int_right"][3], right["Int"][3]); Assert.Null(join["Int_right"][2]); VerifyJoin(join, left, right, JoinAlgorithm.Inner); - // Tests with right.RowCount > left.RowCount + // Tests with right.Rows.Count > left.Rows.Count // Left join right = MakeDataFrameWithAllMutableColumnTypes(15); join = left.Join(right); - Assert.Equal(join.RowCount, left.RowCount); + Assert.Equal(join.Rows.Count, left.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(join["Int_right"][6], right["Int"][6]); VerifyJoin(join, left, right, JoinAlgorithm.Left); // Right join join = left.Join(right, joinAlgorithm: JoinAlgorithm.Right); - Assert.Equal(join.RowCount, right.RowCount); + Assert.Equal(join.Rows.Count, right.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(join["Int_right"][2], right["Int"][2]); Assert.Null(join["Int_left"][12]); @@ -1112,14 +1112,14 @@ public void TestJoin() // Outer join join = left.Join(right, joinAlgorithm: JoinAlgorithm.FullOuter); - Assert.Equal(join.RowCount, right.RowCount); + Assert.Equal(join.Rows.Count, right.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Null(join["Int_left"][12]); VerifyJoin(join, left, right, JoinAlgorithm.FullOuter); // Inner join join = left.Join(right, joinAlgorithm: JoinAlgorithm.Inner); - Assert.Equal(join.RowCount, left.RowCount); + Assert.Equal(join.Rows.Count, left.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(join["Int_right"][2], right["Int"][2]); VerifyJoin(join, left, right, JoinAlgorithm.Inner); @@ -1130,10 +1130,10 @@ public void TestGroupBy() { DataFrame df = MakeDataFrameWithNumericAndBoolColumns(10); DataFrame count = df.GroupBy("Bool").Count(); - Assert.Equal(2, count.RowCount); + Assert.Equal(2, count.Rows.Count); Assert.Equal((long)5, count["Int"][0]); Assert.Equal((long)4, count["Decimal"][1]); - for (int r = 0; r < count.RowCount; r++) + for (int r = 0; r < count.Rows.Count; r++) { for (int c = 1; c < count.Columns.Count; c++) { @@ -1142,7 +1142,7 @@ public void TestGroupBy() } DataFrame first = df.GroupBy("Bool").First(); - Assert.Equal(2, first.RowCount); + Assert.Equal(2, first.Rows.Count); for (int r = 0; r < 2; r++) { for (int c = 0; c < count.Columns.Count; c++) @@ -1172,10 +1172,10 @@ public void TestGroupBy() DataFrameColumn headColumn = head[originalColumn.Name]; Assert.Equal(originalColumn[5], headColumn[verify[5]]); } - Assert.Equal(6, head.RowCount); + Assert.Equal(6, head.Rows.Count); DataFrame tail = df.GroupBy("Bool").Tail(3); - Assert.Equal(6, tail.RowCount); + Assert.Equal(6, tail.Rows.Count); List originalColumnVerify = new List() { 6, 8, 7, 9 }; List tailColumnVerity = new List() { 1, 2, 4, 5 }; for (int r = 0; r < 4; r++) @@ -1189,7 +1189,7 @@ public void TestGroupBy() } DataFrame max = df.GroupBy("Bool").Max(); - Assert.Equal(2, max.RowCount); + Assert.Equal(2, max.Rows.Count); for (int r = 0; r < 2; r++) { for (int c = 0; c < count.Columns.Count; c++) @@ -1203,16 +1203,16 @@ public void TestGroupBy() } DataFrame min = df.GroupBy("Bool").Min(); - Assert.Equal(2, min.RowCount); + Assert.Equal(2, min.Rows.Count); DataFrame product = df.GroupBy("Bool").Product(); - Assert.Equal(2, product.RowCount); + Assert.Equal(2, product.Rows.Count); DataFrame sum = df.GroupBy("Bool").Sum(); - Assert.Equal(2, sum.RowCount); + Assert.Equal(2, sum.Rows.Count); DataFrame mean = df.GroupBy("Bool").Mean(); - Assert.Equal(2, mean.RowCount); + Assert.Equal(2, mean.Rows.Count); for (int r = 0; r < 2; r++) { for (int c = 0; c < count.Columns.Count; c++) @@ -1250,13 +1250,13 @@ public void TestGroupBy() DataFrame countIntColumn = df.GroupBy("Bool").Count("Int"); Assert.Equal(2, countIntColumn.Columns.Count); - Assert.Equal(2, countIntColumn.RowCount); + Assert.Equal(2, countIntColumn.Rows.Count); Assert.Equal((long)5, countIntColumn["Int"][0]); Assert.Equal((long)4, countIntColumn["Int"][1]); DataFrame firstDecimalColumn = df.GroupBy("Bool").First("Decimal"); Assert.Equal(2, firstDecimalColumn.Columns.Count); - Assert.Equal(2, firstDecimalColumn.RowCount); + Assert.Equal(2, firstDecimalColumn.Rows.Count); Assert.Equal((decimal)0, firstDecimalColumn["Decimal"][0]); Assert.Equal((decimal)1, firstDecimalColumn["Decimal"][1]); } @@ -1267,7 +1267,7 @@ public void TestGoupByDifferentColumnTypes() void GroupCountAndAssert(DataFrame frame) { DataFrame grouped = frame.GroupBy("Column1").Count(); - Assert.Equal(2, grouped.RowCount); + Assert.Equal(2, grouped.Rows.Count); } DataFrame df = MakeDataFrame(10, false); @@ -1503,7 +1503,7 @@ public void TestDataFrameFilter() DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); DataFrame boolColumnFiltered = df[df["Bool"].ElementwiseEquals(true)]; List verify = new List { 0, 2, 4, 6, 8 }; - Assert.Equal(5, boolColumnFiltered.RowCount); + Assert.Equal(5, boolColumnFiltered.Rows.Count); for (int i = 0; i < boolColumnFiltered.Columns.Count; i++) { DataFrameColumn column = boolColumnFiltered.Columns[i]; @@ -1582,7 +1582,7 @@ public void TestSample() { DataFrame df = MakeDataFrameWithAllColumnTypes(10); DataFrame sampled = df.Sample(3); - Assert.Equal(3, sampled.RowCount); + Assert.Equal(3, sampled.Rows.Count); Assert.Equal(df.Columns.Count, sampled.Columns.Count); } @@ -1592,10 +1592,10 @@ public void TestMerge() DataFrame left = MakeDataFrameWithAllMutableColumnTypes(10); DataFrame right = MakeDataFrameWithAllMutableColumnTypes(5); - // Tests with right.RowCount < left.RowCount + // Tests with right.Rows.Count < left.Rows.Count // Left merge DataFrame merge = left.Merge(right, "Int", "Int"); - Assert.Equal(10, merge.RowCount); + Assert.Equal(10, merge.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Null(merge["Int_right"][6]); Assert.Null(merge["Int_left"][5]); @@ -1603,7 +1603,7 @@ public void TestMerge() // Right merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Right); - Assert.Equal(5, merge.RowCount); + Assert.Equal(5, merge.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(merge["Int_right"][3], right["Int"][3]); Assert.Null(merge["Int_right"][2]); @@ -1611,31 +1611,31 @@ public void TestMerge() // Outer merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.FullOuter); - Assert.Equal(merge.RowCount, left.RowCount); + Assert.Equal(merge.Rows.Count, left.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Null(merge["Int_right"][6]); VerifyMerge(merge, left, right, JoinAlgorithm.FullOuter); // Inner merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Inner); - Assert.Equal(merge.RowCount, right.RowCount); + Assert.Equal(merge.Rows.Count, right.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(merge["Int_right"][2], right["Int"][3]); Assert.Null(merge["Int_right"][4]); VerifyMerge(merge, left, right, JoinAlgorithm.Inner); - // Tests with right.RowCount > left.RowCount + // Tests with right.Rows.Count > left.Rows.Count // Left merge right = MakeDataFrameWithAllMutableColumnTypes(15); merge = left.Merge(right, "Int", "Int"); - Assert.Equal(merge.RowCount, left.RowCount); + Assert.Equal(merge.Rows.Count, left.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(merge["Int_right"][6], right["Int"][6]); VerifyMerge(merge, left, right, JoinAlgorithm.Left); // Right merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Right); - Assert.Equal(merge.RowCount, right.RowCount); + Assert.Equal(merge.Rows.Count, right.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(merge["Int_right"][2], right["Int"][2]); Assert.Null(merge["Int_left"][12]); @@ -1643,7 +1643,7 @@ public void TestMerge() // Outer merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.FullOuter); - Assert.Equal(16, merge.RowCount); + Assert.Equal(16, merge.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Null(merge["Int_left"][12]); Assert.Null(merge["Int_left"][5]); @@ -1651,7 +1651,7 @@ public void TestMerge() // Inner merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Inner); - Assert.Equal(9, merge.RowCount); + Assert.Equal(9, merge.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); Assert.Equal(merge["Int_right"][2], right["Int"][2]); VerifyMerge(merge, left, right, JoinAlgorithm.Inner); @@ -1730,10 +1730,10 @@ public void TestDropNulls() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(20); DataFrame anyNulls = df.DropNulls(); - Assert.Equal(19, anyNulls.RowCount); + Assert.Equal(19, anyNulls.Rows.Count); DataFrame allNulls = df.DropNulls(DropNullOptions.All); - Assert.Equal(19, allNulls.RowCount); + Assert.Equal(19, allNulls.Rows.Count); } [Fact] @@ -1775,7 +1775,7 @@ public void TestValueCounts() { DataFrame df = MakeDataFrameWithAllColumnTypes(10, withNulls: false); DataFrame valueCounts = df["Bool"].ValueCounts(); - Assert.Equal(2, valueCounts.RowCount); + Assert.Equal(2, valueCounts.Rows.Count); Assert.Equal((long)5, valueCounts["Counts"][0]); Assert.Equal((long)5, valueCounts["Counts"][1]); } @@ -1828,13 +1828,13 @@ public void TestClone(int dfLength, int intDfLength) DataFrame intDf = MakeDataFrameWithTwoColumns(intDfLength, false); PrimitiveDataFrameColumn intColumn = intDf["Int1"] as PrimitiveDataFrameColumn; DataFrame clone = df[intColumn]; - Assert.Equal(intDfLength, clone.RowCount); + Assert.Equal(intDfLength, clone.Rows.Count); Assert.Equal(df.Columns.Count, clone.Columns.Count); for (int i = 0; i < df.Columns.Count; i++) { DataFrameColumn dfColumn = df.Columns[i]; DataFrameColumn cloneColumn = clone.Columns[i]; - for (long r = 0; r < clone.RowCount; r++) + for (long r = 0; r < clone.Rows.Count; r++) { Assert.Equal(dfColumn[r], cloneColumn[r]); } @@ -1869,46 +1869,100 @@ public void TestColumns() } + [Fact] + public void TestRows() + { + DataFrame df = MakeDataFrameWithAllColumnTypes(10); + DataFrameRowCollection rows = df.Rows; + Assert.Equal(10, rows.Count); + DataFrameRow firstRow = rows[0]; + object firstValue = firstRow[0]; + Assert.Equal(df[0, 0], firstValue); + long rowCount = 0; + foreach (DataFrameRow row in rows) + { + int columnIndex = 0; + foreach (var value in row) + { + Assert.Equal(df.Columns[columnIndex][rowCount], value); + columnIndex++; + } + rowCount++; + } + Assert.Equal(df.Rows.Count, rowCount); + + DataFrameRow nullRow = rows[5]; + int intColumnIndex = df.Columns.IndexOf("Int"); + Assert.Equal(1, df.Columns[intColumnIndex].NullCount); + nullRow[intColumnIndex] = 5; + Assert.Equal(0, df.Columns[intColumnIndex].NullCount); + nullRow[intColumnIndex] = null; + Assert.Equal(1, df.Columns[intColumnIndex].NullCount); + } + + [Fact] + public void TestMutationOnRows() + { + DataFrame df = MakeDataFrameWithNumericColumns(10); + DataFrameRowCollection rows = df.Rows; + + foreach (DataFrameRow row in rows) + { + for (int i = 0; i < df.Columns.Count; i++) + { + DataFrameColumn column = df.Columns[i]; + row[i] = Convert.ChangeType(12, column.DataType); + } + } + + foreach (var column in df.Columns) + { + foreach (var value in column) + { + Assert.Equal("12", value.ToString()); + } + } + } [Fact] public void TestAppendRow() { DataFrame df = MakeDataFrame(10); df.Append(new List { 5, true }); - Assert.Equal(11, df.RowCount); + Assert.Equal(11, df.Rows.Count); Assert.Equal(1, df.Columns[0].NullCount); Assert.Equal(1, df.Columns[1].NullCount); df.Append(new List { 100 }); - Assert.Equal(12, df.RowCount); + Assert.Equal(12, df.Rows.Count); Assert.Equal(1, df.Columns[0].NullCount); Assert.Equal(2, df.Columns[1].NullCount); df.Append(new List { null, null }); - Assert.Equal(13, df.RowCount); + Assert.Equal(13, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(3, df.Columns[1].NullCount); df.Append(new List> { KeyValuePair.Create("Column1", (object)5), KeyValuePair.Create("Column2", (object)false) }); - Assert.Equal(14, df.RowCount); + Assert.Equal(14, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(3, df.Columns[1].NullCount); df.Append(new List> { KeyValuePair.Create("Column1", (object)5) }); - Assert.Equal(15, df.RowCount); + Assert.Equal(15, df.Rows.Count); Assert.Equal(15, df["Column1"].Length); Assert.Equal(15, df["Column2"].Length); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(4, df.Columns[1].NullCount); df.Append(new List> { KeyValuePair.Create("Column2", (object)false) }); - Assert.Equal(16, df.RowCount); + Assert.Equal(16, df.Rows.Count); Assert.Equal(16, df["Column1"].Length); Assert.Equal(16, df["Column2"].Length); Assert.Equal(3, df.Columns[0].NullCount); Assert.Equal(4, df.Columns[1].NullCount); df.Append((IEnumerable)null); - Assert.Equal(17, df.RowCount); + Assert.Equal(17, df.Rows.Count); Assert.Equal(17, df["Column1"].Length); Assert.Equal(17, df["Column2"].Length); Assert.Equal(4, df.Columns[0].NullCount); @@ -1920,7 +1974,7 @@ public void TestAppendRow() Assert.Throws(() => df.Append(new List { 5, true, true })); df.Append(); - Assert.Equal(18, df.RowCount); + Assert.Equal(18, df.Rows.Count); Assert.Equal(18, df["Column1"].Length); Assert.Equal(18, df["Column2"].Length); Assert.Equal(5, df.Columns[0].NullCount); @@ -1932,7 +1986,7 @@ public void TestAppendEmptyValue() { DataFrame df = MakeDataFrame(10); df.Append(new List { "", true }); - Assert.Equal(11, df.RowCount); + Assert.Equal(11, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(1, df.Columns[1].NullCount); @@ -1940,13 +1994,13 @@ public void TestAppendEmptyValue() df.Columns.Add(column); df.Append(new List { 1, true, "" }); - Assert.Equal(12, df.RowCount); + Assert.Equal(12, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(1, df.Columns[1].NullCount); Assert.Equal(0, df.Columns[2].NullCount); df.Append(new List { 1, true, null }); - Assert.Equal(13, df.RowCount); + Assert.Equal(13, df.Rows.Count); Assert.Equal(1, df.Columns[2].NullCount); } } From e64cbad5436112090e5f2d065687ee83c95aef86 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 5 Dec 2019 16:07:23 -0600 Subject: [PATCH 09/53] DataFrame.LoadCsv throws an exception on projects targeting < netcore3.0 (#2797) Fixing by passing in an encoding and a default buffer size. Also, get our tests running on .NET Framework. Fix #2783 --- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 6 +++-- .../BufferTests.cs | 2 ++ .../DataFrameTests.IDataView.cs | 4 ++-- .../DataFrameTests.cs | 23 ++++++++++--------- .../Microsoft.Data.Analysis.Tests.csproj | 3 ++- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index ed452c140e..b1ff654c27 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -5,12 +5,14 @@ using System; using System.Collections.Generic; using System.IO; +using System.Text; namespace Microsoft.Data.Analysis { - public partial class DataFrame { + private const int DefaultStreamReaderBufferSize = 1024; + private static Type GuessKind(int col, List read) { Type res = typeof(string); @@ -205,7 +207,7 @@ public static DataFrame LoadCsv(Stream csvStream, List columns; long streamStart = csvStream.Position; // First pass: schema and number of rows. - using (var streamReader = new StreamReader(csvStream, encoding: null, detectEncodingFromByteOrderMarks: true, bufferSize: -1, leaveOpen: true)) + using (var streamReader = new StreamReader(csvStream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, DefaultStreamReaderBufferSize, leaveOpen: true)) { string line = null; if (dataTypes == null) diff --git a/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs b/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs index 0b5a500100..67edb50d67 100644 --- a/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs @@ -188,6 +188,7 @@ public void TestArrowStringColumnClone() Assert.Null(clone[i]); } +#if !NETFRAMEWORK // https://github.com/dotnet/corefxlab/issues/2796 [Fact] public void TestPrimitiveColumnGetReadOnlyBuffers() { @@ -275,5 +276,6 @@ public void TestArrowStringColumnGetReadOnlyBuffers() } } } +#endif //!NETFRAMEWORK } } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs index 459c4a47ce..9ed4963b7f 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs @@ -66,8 +66,8 @@ public void TestIDataView() Assert.Equal((ushort)1, preview.ColumnView[10].Values[1]); Assert.Equal("String", preview.ColumnView[11].Column.Name); - Assert.Equal("0".AsMemory(), preview.ColumnView[11].Values[0]); - Assert.Equal("1".AsMemory(), preview.ColumnView[11].Values[1]); + Assert.Equal("0".ToString(), preview.ColumnView[11].Values[0].ToString()); + Assert.Equal("1".ToString(), preview.ColumnView[11].Values[1].ToString()); Assert.Equal("Char", preview.ColumnView[12].Column.Name); Assert.Equal((ushort)65, preview.ColumnView[12].Values[0]); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index f32983acdd..36bce6d754 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -169,7 +169,7 @@ public DataFrame SplitTrainTest(DataFrame input, float testRatio, out DataFrame { IEnumerable randomIndices = Enumerable.Range(0, (int)input.Rows.Count); IEnumerable trainIndices = randomIndices.Take((int)(input.Rows.Count * testRatio)); - IEnumerable testIndices = randomIndices.TakeLast((int)(input.Rows.Count * (1 - testRatio))); + IEnumerable testIndices = randomIndices.Skip((int)(input.Rows.Count * testRatio)); Test = input[testIndices]; return input[trainIndices]; } @@ -1540,11 +1540,11 @@ public void TestPrefixAndSuffix() DataFrame prefix = df.AddPrefix("Prefix_"); IEnumerable prefixNames = ((IDataView)prefix).Schema; - foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(((IDataView)df).Schema)) + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(((IDataView)df).Schema, (e1, e2) => (e1, e2))) { Assert.Equal(First.Name, Second.Name); } - foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in prefixNames.Zip(columnNames)) + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in prefixNames.Zip(columnNames, (e1, e2) => (e1, e2))) { Assert.Equal(First.Name, "Prefix_" + Second.Name); } @@ -1552,18 +1552,18 @@ public void TestPrefixAndSuffix() // Inplace df.AddPrefix("Prefix_", true); prefixNames = ((IDataView)df).Schema; - foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(prefixNames)) + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(prefixNames, (e1, e2) => (e1, e2))) { Assert.Equal("Prefix_" + First.Name, Second.Name); } DataFrame suffix = df.AddSuffix("_Suffix"); IEnumerable suffixNames = ((IDataView)suffix).Schema; - foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in ((IDataView)df).Schema.Zip(columnNames)) + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in ((IDataView)df).Schema.Zip(columnNames, (e1, e2) => (e1, e2))) { Assert.Equal(First.Name, "Prefix_" + Second.Name); } - foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(suffixNames)) + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(suffixNames, (e1, e2) => (e1, e2))) { Assert.Equal("Prefix_" + First.Name + "_Suffix", Second.Name); } @@ -1571,7 +1571,7 @@ public void TestPrefixAndSuffix() // InPlace df.AddSuffix("_Suffix", true); suffixNames = ((IDataView)df).Schema; - foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(suffixNames)) + foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(suffixNames, (e1, e2) => (e1, e2))) { Assert.Equal("Prefix_" + First.Name + "_Suffix", Second.Name); } @@ -1942,19 +1942,20 @@ public void TestAppendRow() Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(3, df.Columns[1].NullCount); - df.Append(new List> { KeyValuePair.Create("Column1", (object)5), KeyValuePair.Create("Column2", (object)false) }); + df.Append(new Dictionary { { "Column1", (object)5 } , { "Column2", false } }); Assert.Equal(14, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(3, df.Columns[1].NullCount); - df.Append(new List> { KeyValuePair.Create("Column1", (object)5) }); + df.Append(new Dictionary { { "Column1", 5 } }); Assert.Equal(15, df.Rows.Count); + Assert.Equal(15, df["Column1"].Length); Assert.Equal(15, df["Column2"].Length); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(4, df.Columns[1].NullCount); - df.Append(new List> { KeyValuePair.Create("Column2", (object)false) }); + df.Append(new Dictionary { { "Column2", false } }); Assert.Equal(16, df.Rows.Count); Assert.Equal(16, df["Column1"].Length); Assert.Equal(16, df["Column2"].Length); @@ -1970,7 +1971,7 @@ public void TestAppendRow() // DataFrame must remain usable even if Append throws Assert.Throws(() => df.Append(new List { 5, "str" })); - Assert.Throws(() => df.Append(new List> { KeyValuePair.Create("Column2", (object)"str") })); + Assert.Throws(() => df.Append(new Dictionary { { "Column2", "str" } })); Assert.Throws(() => df.Append(new List { 5, true, true })); df.Append(); diff --git a/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj index fb7ad0c725..f4bdb218b2 100644 --- a/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj +++ b/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj @@ -1,7 +1,8 @@  - netcoreapp3.0 + net461;netcoreapp3.0 + netcoreapp3.0 From 303ba62d10d25edc282ba811e2dbbc4a739f8fc4 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 5 Dec 2019 16:14:18 -0800 Subject: [PATCH 10/53] Params constructor on DataFrame (#2800) * Params constructor on DataFrame * Delete redundant constructors --- src/Microsoft.Data.Analysis/DataFrame.cs | 7 ++++--- .../DataFrameColumnCollection.cs | 11 +++-------- tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs | 6 ++++++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index 6bf50f46c9..d6e5b1bcc6 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -33,13 +33,14 @@ public partial class DataFrame { private readonly DataFrameColumnCollection _columnCollection; private readonly DataFrameRowCollection _rowCollection; - public DataFrame() + + public DataFrame(IEnumerable columns) { - _columnCollection = new DataFrameColumnCollection(OnColumnsChanged); + _columnCollection = new DataFrameColumnCollection(columns, OnColumnsChanged); _rowCollection = new DataFrameRowCollection(this); } - public DataFrame(IList columns) + public DataFrame(params DataFrameColumn[] columns) { _columnCollection = new DataFrameColumnCollection(columns, OnColumnsChanged); _rowCollection = new DataFrameRowCollection(this); diff --git a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs index 68861f2f43..e362af2b15 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs @@ -21,18 +21,13 @@ public class DataFrameColumnCollection : Collection internal long RowCount { get; set; } - internal DataFrameColumnCollection(Action columnsChanged) : base() - { - ColumnsChanged = columnsChanged; - } - - internal DataFrameColumnCollection(IList columns, Action columnsChanged) : base() + internal DataFrameColumnCollection(IEnumerable columns, Action columnsChanged) : base() { columns = columns ?? throw new ArgumentNullException(nameof(columns)); ColumnsChanged = columnsChanged; - for (int i = 0; i < columns.Count; i++) + foreach (DataFrameColumn column in columns) { - Add(columns[i]); + Add(column); } } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 36bce6d754..b5ddefddd5 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -235,6 +235,12 @@ public void ColumnAndTableCreationTest() dataFrame.Columns.RemoveAt(1); Assert.Single(dataFrame.Columns); Assert.True(ReferenceEquals(intColumn, dataFrame.Columns[0])); + + // Test the params constructor + DataFrame dataFrame1 = new DataFrame(intColumn, floatColumn); + Assert.Equal(2, dataFrame1.Columns.Count); + Assert.Equal(intColumn, dataFrame1.Columns[0]); + Assert.Equal(floatColumn, dataFrame1.Columns[1]); } [Fact] From dc4f9b0f4ad7cec194afe26328cca8a35ef6d3aa Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 11 Dec 2019 16:31:56 -0800 Subject: [PATCH 11/53] Remove `T : unmanaged` constraint from DataFrameColumn.BinaryOperations (#2801) * Remove T : unmanaged constraint from DataFrameColumn.BinaryOperations * Address feedback * Rename the value version of the APIs * sq * Fix build * Address feedback * Remove Value from the APIs * sq * Address feedback --- .../ArrowStringDataFrameColumn.cs | 8 + .../DataFrameColumn.BinaryOperations.cs | 16 -- .../DataFrameColumn.BinaryOperations.tt | 3 - .../DecimalConverter.cs | 3 - .../DoubleConverter.cs | 3 - ...imitiveDataFrameColumn.BinaryOperations.cs | 200 +++++++++++------- ...imitiveDataFrameColumn.BinaryOperations.tt | 52 +++-- ...ataFrameColumn.ReversedBinaryOperations.cs | 51 ++--- ...ataFrameColumn.ReversedBinaryOperations.tt | 11 +- .../StringDataFrameColumn.BinaryOperations.cs | 8 + .../DataFrameTests.cs | 21 +- 11 files changed, 219 insertions(+), 157 deletions(-) diff --git a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs index 17a38102a2..6cb0103a29 100644 --- a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs @@ -497,6 +497,10 @@ public PrimitiveDataFrameColumn ElementwiseEquals(string value) public override PrimitiveDataFrameColumn ElementwiseEquals(T value) { + if (value is DataFrameColumn column) + { + return ElementwiseEquals(column); + } return ElementwiseEquals(value.ToString()); } @@ -532,6 +536,10 @@ public PrimitiveDataFrameColumn ElementwiseNotEquals(string value) public override PrimitiveDataFrameColumn ElementwiseNotEquals(T value) { + if (value is DataFrameColumn column) + { + return ElementwiseNotEquals(column); + } return ElementwiseNotEquals(value.ToString()); } diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs index 5fbb83d7ab..c9132d19fb 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs @@ -21,7 +21,6 @@ public virtual DataFrameColumn Add(DataFrameColumn column, bool inPlace = false) /// Performs an element wise addition on each value in the column /// public virtual DataFrameColumn Add(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -30,7 +29,6 @@ public virtual DataFrameColumn Add(T value, bool inPlace = false) /// Performs a reversed element wise addition on each value in the column /// public virtual DataFrameColumn ReverseAdd(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -44,7 +42,6 @@ public virtual DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = f /// Performs an element wise subtraction on each value in the column /// public virtual DataFrameColumn Subtract(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -53,7 +50,6 @@ public virtual DataFrameColumn Subtract(T value, bool inPlace = false) /// Performs a reversed element wise subtraction on each value in the column /// public virtual DataFrameColumn ReverseSubtract(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -67,7 +63,6 @@ public virtual DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = f /// Performs an element wise multiplication on each value in the column /// public virtual DataFrameColumn Multiply(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -76,7 +71,6 @@ public virtual DataFrameColumn Multiply(T value, bool inPlace = false) /// Performs a reversed element wise multiplication on each value in the column /// public virtual DataFrameColumn ReverseMultiply(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -90,7 +84,6 @@ public virtual DataFrameColumn Divide(DataFrameColumn column, bool inPlace = fal /// Performs an element wise division on each value in the column /// public virtual DataFrameColumn Divide(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -99,7 +92,6 @@ public virtual DataFrameColumn Divide(T value, bool inPlace = false) /// Performs a reversed element wise division on each value in the column /// public virtual DataFrameColumn ReverseDivide(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -113,7 +105,6 @@ public virtual DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = fal /// Performs an element wise modulus operation on each value in the column /// public virtual DataFrameColumn Modulo(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -122,7 +113,6 @@ public virtual DataFrameColumn Modulo(T value, bool inPlace = false) /// Performs a reversed element wise modulus operation on each value in the column /// public virtual DataFrameColumn ReverseModulo(T value, bool inPlace = false) - where T : unmanaged { throw new NotImplementedException(); } @@ -215,7 +205,6 @@ public virtual PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn /// Performs an element wise equals on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseEquals(T value) - where T : unmanaged { throw new NotImplementedException(); } @@ -229,7 +218,6 @@ public virtual PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColu /// Performs an element wise not-equals on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseNotEquals(T value) - where T : unmanaged { throw new NotImplementedException(); } @@ -243,7 +231,6 @@ public virtual PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(Data /// Performs an element wise greater than or equal on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(T value) - where T : unmanaged { throw new NotImplementedException(); } @@ -257,7 +244,6 @@ public virtual PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFra /// Performs an element wise less than or equal on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(T value) - where T : unmanaged { throw new NotImplementedException(); } @@ -271,7 +257,6 @@ public virtual PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameCo /// Performs an element wise greater than on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseGreaterThan(T value) - where T : unmanaged { throw new NotImplementedException(); } @@ -285,7 +270,6 @@ public virtual PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColum /// Performs an element wise less than on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseLessThan(T value) - where T : unmanaged { throw new NotImplementedException(); } diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt index 6a05018736..2fcd5c04be 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt @@ -30,7 +30,6 @@ namespace Microsoft.Data.Analysis /// <#=method.GetColumnSpecificMethodComments()#> /// public virtual DataFrameColumn <#=method.MethodName#>(T value, bool inPlace = false) - where T : unmanaged <# } #> <# } #> <# if (method.MethodType == MethodType.ComparisonScalar) { #> @@ -38,7 +37,6 @@ namespace Microsoft.Data.Analysis /// <#=method.GetColumnSpecificMethodComments()#> /// public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(T value) - where T : unmanaged <# } #> <# if (method.MethodType == MethodType.Binary) {#> public virtual DataFrameColumn <#=method.MethodName#>(DataFrameColumn column, bool inPlace = false) @@ -67,7 +65,6 @@ namespace Microsoft.Data.Analysis /// <#=method.GetColumnSpecificReverseMethodComments()#> /// public virtual DataFrameColumn Reverse<#=method.MethodName#>(T value, bool inPlace = false) - where T : unmanaged <# } #> { throw new NotImplementedException(); diff --git a/src/Microsoft.Data.Analysis/DecimalConverter.cs b/src/Microsoft.Data.Analysis/DecimalConverter.cs index 741ebf634e..97240969b0 100644 --- a/src/Microsoft.Data.Analysis/DecimalConverter.cs +++ b/src/Microsoft.Data.Analysis/DecimalConverter.cs @@ -5,19 +5,16 @@ namespace Microsoft.Data.Analysis { internal interface IDecimalConverter - where T : struct { decimal GetDecimal(T value); } internal static class DecimalConverter - where T : struct { public static IDecimalConverter Instance { get; } = DecimalConverter.GetDecimalConverter(); } internal static class DecimalConverter { public static IDecimalConverter GetDecimalConverter() - where T : struct { if (typeof(T) == typeof(bool)) { diff --git a/src/Microsoft.Data.Analysis/DoubleConverter.cs b/src/Microsoft.Data.Analysis/DoubleConverter.cs index b5539013cd..399c3ffb25 100644 --- a/src/Microsoft.Data.Analysis/DoubleConverter.cs +++ b/src/Microsoft.Data.Analysis/DoubleConverter.cs @@ -5,19 +5,16 @@ namespace Microsoft.Data.Analysis { internal interface IDoubleConverter - where T : struct { double GetDouble(T value); } internal static class DoubleConverter - where T : struct { public static IDoubleConverter Instance { get; } = DoubleConverter.GetDoubleConverter(); } internal static class DoubleConverter { public static IDoubleConverter GetDoubleConverter() - where T : struct { if (typeof(T) == typeof(bool)) { diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs index 03ec75aa54..13cdeda040 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace Microsoft.Data.Analysis { @@ -49,6 +50,11 @@ public override DataFrameColumn Add(DataFrameColumn column, bool inPlace = false } public override DataFrameColumn Add(U value, bool inPlace = false) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return Add(column, inPlace); + } return AddImplementation(value, inPlace); } public override DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = false) @@ -87,6 +93,11 @@ public override DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = } public override DataFrameColumn Subtract(U value, bool inPlace = false) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return Subtract(column, inPlace); + } return SubtractImplementation(value, inPlace); } public override DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = false) @@ -125,6 +136,11 @@ public override DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = } public override DataFrameColumn Multiply(U value, bool inPlace = false) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return Multiply(column, inPlace); + } return MultiplyImplementation(value, inPlace); } public override DataFrameColumn Divide(DataFrameColumn column, bool inPlace = false) @@ -163,6 +179,11 @@ public override DataFrameColumn Divide(DataFrameColumn column, bool inPlace = fa } public override DataFrameColumn Divide(U value, bool inPlace = false) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return Divide(column, inPlace); + } return DivideImplementation(value, inPlace); } public override DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = false) @@ -201,6 +222,11 @@ public override DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = fa } public override DataFrameColumn Modulo(U value, bool inPlace = false) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return Modulo(column, inPlace); + } return ModuloImplementation(value, inPlace); } public override DataFrameColumn And(DataFrameColumn column, bool inPlace = false) @@ -361,6 +387,11 @@ public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn } public override PrimitiveDataFrameColumn ElementwiseEquals(U value) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return ElementwiseEquals(column); + } return ElementwiseEqualsImplementation(value); } public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) @@ -399,6 +430,11 @@ public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameCol } public override PrimitiveDataFrameColumn ElementwiseNotEquals(U value) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return ElementwiseNotEquals(column); + } return ElementwiseNotEqualsImplementation(value); } public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(DataFrameColumn column) @@ -437,6 +473,11 @@ public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(Dat } public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(U value) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return ElementwiseGreaterThanOrEqual(column); + } return ElementwiseGreaterThanOrEqualImplementation(value); } public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFrameColumn column) @@ -475,6 +516,11 @@ public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFr } public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(U value) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return ElementwiseLessThanOrEqual(column); + } return ElementwiseLessThanOrEqualImplementation(value); } public override PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameColumn column) @@ -513,6 +559,11 @@ public override PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameC } public override PrimitiveDataFrameColumn ElementwiseGreaterThan(U value) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return ElementwiseGreaterThan(column); + } return ElementwiseGreaterThanImplementation(value); } public override PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColumn column) @@ -551,6 +602,11 @@ public override PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColu } public override PrimitiveDataFrameColumn ElementwiseLessThan(U value) { + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return ElementwiseLessThan(column); + } return ElementwiseLessThanImplementation(value); } @@ -635,7 +691,6 @@ internal DataFrameColumn AddImplementation(PrimitiveDataFrameColumn column } } internal DataFrameColumn AddImplementation(U value, bool inPlace) - where U : unmanaged { switch (typeof(T)) { @@ -649,9 +704,9 @@ internal DataFrameColumn AddImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Add(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Add(Unsafe.As(ref value)); return newColumn; } else @@ -682,9 +737,9 @@ internal DataFrameColumn AddImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Add(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Add(Unsafe.As(ref value)); return newColumn; } else @@ -791,7 +846,6 @@ internal DataFrameColumn SubtractImplementation(PrimitiveDataFrameColumn c } } internal DataFrameColumn SubtractImplementation(U value, bool inPlace) - where U : unmanaged { switch (typeof(T)) { @@ -805,9 +859,9 @@ internal DataFrameColumn SubtractImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Subtract(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Subtract(Unsafe.As(ref value)); return newColumn; } else @@ -838,9 +892,9 @@ internal DataFrameColumn SubtractImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Subtract(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Subtract(Unsafe.As(ref value)); return newColumn; } else @@ -947,7 +1001,6 @@ internal DataFrameColumn MultiplyImplementation(PrimitiveDataFrameColumn c } } internal DataFrameColumn MultiplyImplementation(U value, bool inPlace) - where U : unmanaged { switch (typeof(T)) { @@ -961,9 +1014,9 @@ internal DataFrameColumn MultiplyImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Multiply(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Multiply(Unsafe.As(ref value)); return newColumn; } else @@ -994,9 +1047,9 @@ internal DataFrameColumn MultiplyImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Multiply(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Multiply(Unsafe.As(ref value)); return newColumn; } else @@ -1103,7 +1156,6 @@ internal DataFrameColumn DivideImplementation(PrimitiveDataFrameColumn col } } internal DataFrameColumn DivideImplementation(U value, bool inPlace) - where U : unmanaged { switch (typeof(T)) { @@ -1117,9 +1169,9 @@ internal DataFrameColumn DivideImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Divide(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Divide(Unsafe.As(ref value)); return newColumn; } else @@ -1150,9 +1202,9 @@ internal DataFrameColumn DivideImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Divide(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Divide(Unsafe.As(ref value)); return newColumn; } else @@ -1259,7 +1311,6 @@ internal DataFrameColumn ModuloImplementation(PrimitiveDataFrameColumn col } } internal DataFrameColumn ModuloImplementation(U value, bool inPlace) - where U : unmanaged { switch (typeof(T)) { @@ -1273,9 +1324,9 @@ internal DataFrameColumn ModuloImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Modulo(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Modulo(Unsafe.As(ref value)); return newColumn; } else @@ -1306,9 +1357,9 @@ internal DataFrameColumn ModuloImplementation(U value, bool inPlace) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Modulo(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); + newColumn._columnContainer.Modulo(Unsafe.As(ref value)); return newColumn; } else @@ -1369,7 +1420,6 @@ internal DataFrameColumn AndImplementation(PrimitiveDataFrameColumn column } } internal PrimitiveDataFrameColumn AndImplementation(U value, bool inPlace) - where U : unmanaged { switch (typeof(T)) { @@ -1378,9 +1428,9 @@ internal PrimitiveDataFrameColumn AndImplementation(U value, bool inPla { throw new NotSupportedException(); } - PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); - retColumn._columnContainer.And(value); + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.And(Unsafe.As(ref value)); return retColumn as PrimitiveDataFrameColumn; case Type byteType when byteType == typeof(byte): case Type charType when charType == typeof(char): @@ -1433,7 +1483,6 @@ internal DataFrameColumn OrImplementation(PrimitiveDataFrameColumn column, } } internal PrimitiveDataFrameColumn OrImplementation(U value, bool inPlace) - where U : unmanaged { switch (typeof(T)) { @@ -1442,9 +1491,9 @@ internal PrimitiveDataFrameColumn OrImplementation(U value, bool inPlac { throw new NotSupportedException(); } - PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); - retColumn._columnContainer.Or(value); + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.Or(Unsafe.As(ref value)); return retColumn as PrimitiveDataFrameColumn; case Type byteType when byteType == typeof(byte): case Type charType when charType == typeof(char): @@ -1497,7 +1546,6 @@ internal DataFrameColumn XorImplementation(PrimitiveDataFrameColumn column } } internal PrimitiveDataFrameColumn XorImplementation(U value, bool inPlace) - where U : unmanaged { switch (typeof(T)) { @@ -1506,9 +1554,9 @@ internal PrimitiveDataFrameColumn XorImplementation(U value, bool inPla { throw new NotSupportedException(); } - PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); - retColumn._columnContainer.Xor(value); + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = inPlace ? typedColumn : typedColumn.Clone(); + retColumn._columnContainer.Xor(Unsafe.As(ref value)); return retColumn as PrimitiveDataFrameColumn; case Type byteType when byteType == typeof(byte): case Type charType when charType == typeof(char): @@ -1730,7 +1778,6 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(Primi } } internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U value) - where U : unmanaged { switch (typeof(T)) { @@ -1740,7 +1787,7 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val throw new NotSupportedException(); } PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); - (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(value, retColumn._columnContainer); + (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(Unsafe.As(ref value), retColumn._columnContainer); return retColumn; case Type decimalType when decimalType == typeof(decimal): if (typeof(U) == typeof(bool)) @@ -1750,9 +1797,9 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseEquals(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseEquals(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -1780,9 +1827,9 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseEquals(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseEquals(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -1888,7 +1935,6 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(Pr } } internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U value) - where U : unmanaged { switch (typeof(T)) { @@ -1898,7 +1944,7 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U throw new NotSupportedException(); } PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); - (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(value, retColumn._columnContainer); + (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), retColumn._columnContainer); return retColumn; case Type decimalType when decimalType == typeof(decimal): if (typeof(U) == typeof(bool)) @@ -1908,9 +1954,9 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseNotEquals(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -1938,9 +1984,9 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseNotEquals(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -2040,7 +2086,6 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat } } internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(U value) - where U : unmanaged { switch (typeof(T)) { @@ -2054,9 +2099,9 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -2084,9 +2129,9 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -2186,7 +2231,6 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation } } internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation(U value) - where U : unmanaged { switch (typeof(T)) { @@ -2200,9 +2244,9 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -2230,9 +2274,9 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -2332,7 +2376,6 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( } } internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation(U value) - where U : unmanaged { switch (typeof(T)) { @@ -2346,9 +2389,9 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseGreaterThan(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseGreaterThan(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -2376,9 +2419,9 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseGreaterThan(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseGreaterThan(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -2478,7 +2521,6 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(Pri } } internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(U value) - where U : unmanaged { switch (typeof(T)) { @@ -2492,9 +2534,9 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(U v if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseLessThan(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseLessThan(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else @@ -2522,9 +2564,9 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(U v if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn primitiveColumn = this; PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); - primitiveColumn._columnContainer.ElementwiseLessThan(value, newColumn._columnContainer); + primitiveColumn._columnContainer.ElementwiseLessThan(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt index 29c9b8d95e..8dee5658d3 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt @@ -13,6 +13,7 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace Microsoft.Data.Analysis { @@ -54,8 +55,22 @@ namespace Microsoft.Data.Analysis <# } #> { <# if (method.MethodType == MethodType.BinaryScalar) {#> +<# if (method.IsBitwise == true) { #> return <#=method.MethodName#>Implementation(value, inPlace); +<# } else { #> + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return <#=method.MethodName#>(column, inPlace); + } + return <#=method.MethodName#>Implementation(value, inPlace); +<# } #> <# } else {#> + DataFrameColumn column = value as DataFrameColumn; + if (column != null) + { + return <#=method.MethodName#>(column); + } return <#=method.MethodName#>Implementation(value); <# } #> } @@ -79,7 +94,6 @@ namespace Microsoft.Data.Analysis <# } else {#> internal PrimitiveDataFrameColumn <#=method.MethodName#>Implementation(U value) <# } #> - where U : unmanaged <# } #> <# if (method.MethodType == MethodType.Binary || method.MethodType == MethodType.Comparison) {#> <# if (method.MethodType == MethodType.Binary) {#> @@ -126,9 +140,9 @@ namespace Microsoft.Data.Analysis throw new NotSupportedException(); } <# if (method.MethodType == MethodType.BinaryScalar) {#> - PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn retColumn = <#=GenerateInPlaceStatement("typedColumn", "typedColumn.Clone()")#>; - retColumn._columnContainer.<#=method.MethodName#>(value); + PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn retColumn = <#=GenerateInPlaceStatement("typedColumn", "typedColumn.Clone()")#>; + retColumn._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value)); return retColumn as PrimitiveDataFrameColumn; <# } else { #> PrimitiveDataFrameColumn typedColumn = this as PrimitiveDataFrameColumn; @@ -161,7 +175,7 @@ namespace Microsoft.Data.Analysis <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); <# if (method.MethodType == MethodType.ComparisonScalar) { #> - (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(value, retColumn._columnContainer); + (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value), retColumn._columnContainer); <# } else { #> (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(column._columnContainer, retColumn._columnContainer); <# } #> @@ -185,23 +199,27 @@ namespace Microsoft.Data.Analysis if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); <# if (method.MethodType == MethodType.ComparisonScalar) { #> - primitiveColumn._columnContainer.<#=method.MethodName#>(value, newColumn._columnContainer); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; <# } else { #> + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); primitiveColumn._columnContainer.<#=method.MethodName#>(column._columnContainer, newColumn._columnContainer); return newColumn; <# } #> <# } else if (method.IsBitwise == true ) { #> throw new NotSupportedException(); <# } else if (method.MethodType == MethodType.BinaryScalar ) { #> - PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; - newColumn._columnContainer.<#=method.MethodName#>(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; + newColumn._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value)); return newColumn; <# } else { #> + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; newColumn._columnContainer.<#=method.MethodName#>(column._columnContainer); return newColumn; @@ -264,23 +282,27 @@ namespace Microsoft.Data.Analysis if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); <# if (method.MethodType == MethodType.ComparisonScalar) { #> - primitiveColumn._columnContainer.<#=method.MethodName#>(value, newColumn._columnContainer); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + primitiveColumn._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; <# } else { #> + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); primitiveColumn._columnContainer.<#=method.MethodName#>(column._columnContainer, newColumn._columnContainer); return newColumn; <# } #> <# } else if (method.IsBitwise == true ) { #> throw new NotSupportedException(); <# } else if (method.MethodType == MethodType.BinaryScalar ) { #> - PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; - newColumn._columnContainer.<#=method.MethodName#>(value); + PrimitiveDataFrameColumn primitiveColumn = this; + PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; + newColumn._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value)); return newColumn; <# } else { #> + PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; PrimitiveDataFrameColumn newColumn = <#=GenerateInPlaceStatement("primitiveColumn", "primitiveColumn.Clone()")#>; newColumn._columnContainer.<#=method.MethodName#>(column._columnContainer); return newColumn; diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs index 73e338fd40..d5309da3d0 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace Microsoft.Data.Analysis { @@ -28,9 +29,8 @@ public override DataFrameColumn ReverseAdd(U value, bool inPlace = false) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseAdd(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseAdd(Unsafe.As(ref value)); return newColumn; } else @@ -61,9 +61,8 @@ public override DataFrameColumn ReverseAdd(U value, bool inPlace = false) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseAdd(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseAdd(Unsafe.As(ref value)); return newColumn; } else @@ -103,9 +102,8 @@ public override DataFrameColumn ReverseSubtract(U value, bool inPlace = false if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseSubtract(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseSubtract(Unsafe.As(ref value)); return newColumn; } else @@ -136,9 +134,8 @@ public override DataFrameColumn ReverseSubtract(U value, bool inPlace = false if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseSubtract(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseSubtract(Unsafe.As(ref value)); return newColumn; } else @@ -178,9 +175,8 @@ public override DataFrameColumn ReverseMultiply(U value, bool inPlace = false if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseMultiply(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseMultiply(Unsafe.As(ref value)); return newColumn; } else @@ -211,9 +207,8 @@ public override DataFrameColumn ReverseMultiply(U value, bool inPlace = false if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseMultiply(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseMultiply(Unsafe.As(ref value)); return newColumn; } else @@ -253,9 +248,8 @@ public override DataFrameColumn ReverseDivide(U value, bool inPlace = false) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseDivide(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseDivide(Unsafe.As(ref value)); return newColumn; } else @@ -286,9 +280,8 @@ public override DataFrameColumn ReverseDivide(U value, bool inPlace = false) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseDivide(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseDivide(Unsafe.As(ref value)); return newColumn; } else @@ -328,9 +321,8 @@ public override DataFrameColumn ReverseModulo(U value, bool inPlace = false) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseModulo(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseModulo(Unsafe.As(ref value)); return newColumn; } else @@ -361,9 +353,8 @@ public override DataFrameColumn ReverseModulo(U value, bool inPlace = false) if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.ReverseModulo(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.ReverseModulo(Unsafe.As(ref value)); return newColumn; } else diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt index 64917994cc..61bdd71799 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt @@ -13,6 +13,7 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; namespace Microsoft.Data.Analysis { @@ -52,9 +53,8 @@ namespace Microsoft.Data.Analysis if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Reverse<#=method.MethodName#>(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.Reverse<#=method.MethodName#>(Unsafe.As(ref value)); return newColumn; } else @@ -81,9 +81,8 @@ namespace Microsoft.Data.Analysis if (typeof(U) == typeof(T)) { // No conversions - PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = inPlace ? primitiveColumn : primitiveColumn.Clone(); - newColumn._columnContainer.Reverse<#=method.MethodName#>(value); + PrimitiveDataFrameColumn newColumn = inPlace ? this : Clone(); + newColumn._columnContainer.Reverse<#=method.MethodName#>(Unsafe.As(ref value)); return newColumn; } else diff --git a/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs index d90118b193..ffc387e211 100644 --- a/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs @@ -103,6 +103,10 @@ public PrimitiveDataFrameColumn ElementwiseEquals(string value) public override PrimitiveDataFrameColumn ElementwiseEquals(T value) { + if (value is DataFrameColumn column) + { + return ElementwiseEquals(column); + } return ElementwiseEquals(value.ToString()); } @@ -137,6 +141,10 @@ public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameCol public override PrimitiveDataFrameColumn ElementwiseNotEquals(T value) { + if (value is DataFrameColumn column) + { + return ElementwiseNotEquals(column); + } return ElementwiseNotEquals(value.ToString()); } } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index b5ddefddd5..8fc3eca52b 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -460,6 +460,10 @@ public void TestBinaryOperationsOnArrowStringColumn() newCol = stringColumn.ElementwiseEquals(stringColumnCopy); Assert.True(newCol.All()); + DataFrameColumn stringColumnCopyAsBaseColumn = stringColumnCopy; + newCol = stringColumn.ElementwiseEquals(stringColumnCopyAsBaseColumn); + Assert.True(newCol.All()); + newCol = stringColumn.ElementwiseNotEquals(5); Assert.Equal(true, newCol[0]); Assert.Equal(false, newCol[5]); @@ -475,6 +479,9 @@ public void TestBinaryOperationsOnArrowStringColumn() newCol = stringColumn.ElementwiseNotEquals(stringColumnCopy); Assert.False(newCol.All()); + + newCol = stringColumn.ElementwiseNotEquals(stringColumnCopyAsBaseColumn); + Assert.False(newCol.All()); } [Fact] @@ -497,11 +504,16 @@ public void TestBinaryOperationsOnStringColumn() Assert.Equal(true, newCol[5]); Assert.Equal(true, newCol[0]); + StringDataFrameColumn typedStringColumn = stringColumn as StringDataFrameColumn; + StringDataFrameColumn typedStringColumnCopy = stringColumnCopy as StringDataFrameColumn; + newCol = typedStringColumn.ElementwiseEquals(typedStringColumnCopy); + Assert.True(newCol.All()); + newCol = stringColumn.ElementwiseNotEquals(5); Assert.Equal(false, newCol[5]); Assert.Equal(true, newCol[0]); - newCol = (stringColumn as StringDataFrameColumn).ElementwiseNotEquals("5"); + newCol = typedStringColumn.ElementwiseNotEquals("5"); Assert.Equal(false, newCol[5]); Assert.Equal(true, newCol[0]); @@ -509,7 +521,9 @@ public void TestBinaryOperationsOnStringColumn() Assert.Equal(false, newCol[5]); Assert.Equal(false, newCol[0]); - StringDataFrameColumn typedStringColumn = stringColumn as StringDataFrameColumn; + newCol = typedStringColumn.ElementwiseNotEquals(typedStringColumnCopy); + Assert.False(newCol.All()); + newCol = typedStringColumn.Add("suffix"); for (int i = 0; i < newCol.Length; i++) { @@ -657,6 +671,9 @@ public void TestBinaryOperationsOnColumns() PrimitiveDataFrameColumn column = new PrimitiveDataFrameColumn("Int", Enumerable.Range(0, 10)); Assert.ThrowsAny(() => column.Add(5.5, inPlace: true)); Assert.ThrowsAny(() => column.ReverseAdd(5.5, inPlace: true)); + string str = "A String"; + Assert.ThrowsAny(() => column.Add(str, inPlace: true)); + Assert.ThrowsAny(() => column.ReverseAdd(str, inPlace: true)); } [Fact] From 838350b782a5e94391d20521d81ba07e62fe90c5 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 12 Dec 2019 10:28:29 -0800 Subject: [PATCH 12/53] Bump version to 0.2.0 (#2803) --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index aaded7d02d..71490c0883 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -4,7 +4,7 @@ netstandard2.0 7.3 true - 0.1.0 + 0.2.0 true false This package contains easy-to-use and high-performance libraries for data analysis and transformation. From 0fa210d707e69dbe8346809b7041fd3b058c6656 Mon Sep 17 00:00:00 2001 From: Haytam Zanid <34218324+zHaytam@users.noreply.github.com> Date: Mon, 13 Jan 2020 09:17:30 +0100 Subject: [PATCH 13/53] Add Applymethod to PrimitiveDataFrameColumn (#2807) * Add Apply method to PrimitiveDataFrameColumn and its container * Add TestApply test * Remove unused df variable in DataFrameTests * Add xml doc comments to Apply method --- .../PrimitiveColumnContainer.cs | 34 +++++++++++++++++++ .../PrimitiveDataFrameColumn.cs | 13 +++++++ .../DataFrameTests.cs | 17 ++++++++++ 3 files changed, 64 insertions(+) diff --git a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs index ad94de690e..767200a818 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs @@ -251,6 +251,40 @@ public void ApplyElementwise(Func func) } } + public void Apply(Func func, PrimitiveColumnContainer resultContainer) + where TResult : unmanaged + { + for (int b = 0; b < Buffers.Count; b++) + { + ReadOnlyDataFrameBuffer buffer = Buffers[b]; + long prevLength = checked(Buffers[0].Length * b); + DataFrameBuffer mutableBuffer = DataFrameBuffer.GetMutableBuffer(buffer); + Buffers[b] = mutableBuffer; + Span span = mutableBuffer.Span; + DataFrameBuffer mutableNullBitMapBuffer = DataFrameBuffer.GetMutableBuffer(NullBitMapBuffers[b]); + NullBitMapBuffers[b] = mutableNullBitMapBuffer; + Span nullBitMapSpan = mutableNullBitMapBuffer.Span; + + ReadOnlyDataFrameBuffer resultBuffer = resultContainer.Buffers[b]; + long resultPrevLength = checked(resultContainer.Buffers[0].Length * b); + DataFrameBuffer resultMutableBuffer = DataFrameBuffer.GetMutableBuffer(resultBuffer); + resultContainer.Buffers[b] = resultMutableBuffer; + Span resultSpan = resultMutableBuffer.Span; + DataFrameBuffer resultMutableNullBitMapBuffer = DataFrameBuffer.GetMutableBuffer(resultContainer.NullBitMapBuffers[b]); + resultContainer.NullBitMapBuffers[b] = resultMutableNullBitMapBuffer; + Span resultNullBitMapSpan = resultMutableNullBitMapBuffer.Span; + + for (int i = 0; i < span.Length; i++) + { + long curIndex = i + prevLength; + bool isValid = IsValid(nullBitMapSpan, i); + TResult? value = func(isValid ? span[i] : default(T?)); + resultSpan[i] = value.GetValueOrDefault(); + SetValidityBit(resultNullBitMapSpan, i, value != null); + } + } + } + // Faster to use when we already have a span since it avoids indexing public bool IsValid(ReadOnlySpan bitMapBufferSpan, int index) { diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs index f44202ed44..cf6e6d2b8f 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs @@ -487,6 +487,19 @@ public override Dictionary> GroupColumnValues() public void ApplyElementwise(Func func) => _columnContainer.ApplyElementwise(func); + /// + /// Applies a function to all the values + /// + /// The new column's type + /// The function to apply + /// A new PrimitiveDataFrameColumn containing the new values + public PrimitiveDataFrameColumn Apply(Func func) where TResult : unmanaged + { + var resultColumn = new PrimitiveDataFrameColumn("Result", Length); + _columnContainer.Apply(func, resultColumn._columnContainer); + return resultColumn; + } + /// /// Clips values beyond the specified thresholds /// diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 8fc3eca52b..0de7e10e46 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -1946,6 +1946,7 @@ public void TestMutationOnRows() } } } + [Fact] public void TestAppendRow() { @@ -2027,5 +2028,21 @@ public void TestAppendEmptyValue() Assert.Equal(13, df.Rows.Count); Assert.Equal(1, df.Columns[2].NullCount); } + + [Fact] + public void TestApply() + { + int[] values = { 1, 2, 3, 4, 5 }; + var col = new PrimitiveDataFrameColumn("Ints", values); + PrimitiveDataFrameColumn newCol = col.Apply(i => i + 0.5d); + + Assert.Equal(values.Length, newCol.Length); + + for (int i = 0; i < newCol.Length; i++) + { + Assert.Equal(col[i], values[i]); // Make sure values didn't change + Assert.Equal(newCol[i], values[i] + 0.5d); + } + } } } From 430ac09e8a65cf0898811f4dc91623bcca4531b9 Mon Sep 17 00:00:00 2001 From: Jon Wood Date: Thu, 16 Jan 2020 13:05:11 -0500 Subject: [PATCH 14/53] Add additional tests for ReadCsv (#2811) * Add additional tests for ReadCsv * Update asserts * Add empty row and skip test pending another fix * Remove test for another issue --- .../DataFrame.IOTests.cs | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index 0236f64537..c44909ed4f 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -104,5 +104,143 @@ Stream GetStream(string streamData) Assert.Equal("", nullRow[5]); Assert.Null(nullRow[6]); } + + [Fact] + public void TestReadCsvWithPipeSeparator() + { + string data = @"vendor_id|rate_code|passenger_count|trip_time_in_secs|trip_distance|payment_type|fare_amount +CMT|1|1|1271|3.8|CRD|17.5 +CMT|1|1|474|1.5|CRD|8 +CMT|1|1|637|1.4|CRD|8.5 +|||||| +CMT|1|1|181|0.6|CSH|4.5"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data), separator: '|'); + + Assert.Equal(5, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df["vendor_id"][4]); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: '|', numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows["vendor_id"][2]); + + var nullRow = df.Rows[3]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + Assert.Null(nullRow[4]); + Assert.Equal("", nullRow[5]); + Assert.Null(nullRow[6]); + } + + [Fact] + public void TestReadCsvWithSemicolonSeparator() + { + string data = @"vendor_id;rate_code;passenger_count;trip_time_in_secs;trip_distance;payment_type;fare_amount +CMT;1;1;1271;3.8;CRD;17.5 +CMT;1;1;474;1.5;CRD;8 +CMT;1;1;637;1.4;CRD;8.5 +;;;;;; +CMT;1;1;181;0.6;CSH;4.5"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data), separator: ';'); + + Assert.Equal(5, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df["vendor_id"][4]); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: ';', numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows["vendor_id"][2]); + + var nullRow = df.Rows[3]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + Assert.Null(nullRow[4]); + Assert.Equal("", nullRow[5]); + Assert.Null(nullRow[6]); + } + + [Fact] + public void TestReadCsvWithExtraColumnInHeader() + { + string data = @"vendor_id,rate_code,passenger_count,trip_time_in_secs,trip_distance,payment_type,fare_amount,extra +CMT,1,1,1271,3.8,CRD,17.5 +CMT,1,1,474,1.5,CRD,8 +CMT,1,1,637,1.4,CRD,8.5 +CMT,1,1,181,0.6,CSH,4.5"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + + Assert.Equal(4, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df["vendor_id"][3]); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows["vendor_id"][2]); + } + + [Fact] + public void TestReadCsvWithExtraColumnInRow() + { + string data = @"vendor_id,rate_code,passenger_count,trip_time_in_secs,trip_distance,payment_type,fare_amount +CMT,1,1,1271,3.8,CRD,17.5,0 +CMT,1,1,474,1.5,CRD,8,0 +CMT,1,1,637,1.4,CRD,8.5,0 +CMT,1,1,181,0.6,CSH,4.5,0"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + + Assert.Throws(() => DataFrame.LoadCsv(GetStream(data))); + } + + [Fact] + public void TestReadCsvWithLessColumnsInRow() + { + string data = @"vendor_id,rate_code,passenger_count,trip_time_in_secs,trip_distance,payment_type,fare_amount +CMT,1,1,1271,3.8,CRD +CMT,1,1,474,1.5,CRD +CMT,1,1,637,1.4,CRD +CMT,1,1,181,0.6,CSH"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Assert.Equal(4, df.Rows.Count); + Assert.Equal(6, df.Columns.Count); + Assert.Equal("CMT", df["vendor_id"][3]); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(6, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows["vendor_id"][2]); + + } } } From 70bb9e9a56249b096b9c83f8e0c2b802fb6d0c47 Mon Sep 17 00:00:00 2001 From: Sam <1965570+MgSam@users.noreply.github.com> Date: Tue, 21 Jan 2020 12:56:13 -0500 Subject: [PATCH 15/53] Added static factory methods to DataFrameColumn (#2808) * Added static factory methods to DataFrameColumn where they make sense (for the overloads where its possible to infer the column's type). * Remove regions * Update some parts of the unit tests to use static factory methods to create DataFrameColumns. * Remove errant {T} on StringDataFrameColumn. * PR feedback Co-authored-by: Eric Erhardt --- .../DataFrameColumn.cs | 38 +++++++++++++++++++ .../DataFrameTests.cs | 30 +++++++-------- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.cs index 579e8b8b1e..1795857070 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.cs @@ -24,6 +24,44 @@ public DataFrameColumn(string name, long length, Type type) DataType = type; } + /// + /// A static factory method to create a . + /// It allows you to take advantage of type inference based on the type of the values supplied. + /// + /// The type of the column to create. + /// The name of the column. + /// The initial values to populate in the column. + /// A populated with the provided data. + public static PrimitiveDataFrameColumn Create(string name, IEnumerable values) where T : unmanaged + { + return new PrimitiveDataFrameColumn(name, values); + } + + /// + /// A static factory method to create a . + /// It allows you to take advantage of type inference based on the type of the values supplied. + /// + /// The type of the column to create. + /// The name of the column. + /// The initial values to populate in the column. + /// A populated with the provided data. + public static PrimitiveDataFrameColumn Create(string name, IEnumerable values) where T : unmanaged + { + return new PrimitiveDataFrameColumn(name, values); + } + + /// + /// A static factory method to create a . + /// It allows you to take advantage of type inference based on the type of the values supplied. + /// + /// The name of the column. + /// The initial values to populate in the column. + /// A populated with the provided data. + public static StringDataFrameColumn Create(string name, IEnumerable values) + { + return new StringDataFrameColumn(name, values); + } + private long _length; public long Length { diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 0de7e10e46..7c448cbe6f 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -104,14 +104,14 @@ public static DataFrame MakeDataFrameWithNumericAndBoolColumns(int length) public static DataFrame MakeDataFrameWithNumericAndStringColumns(int length, bool withNulls = true) { DataFrame df = MakeDataFrameWithNumericColumns(length, withNulls); - DataFrameColumn stringColumn = new StringDataFrameColumn("String", Enumerable.Range(0, length).Select(x => x.ToString())); + DataFrameColumn stringColumn = DataFrameColumn.Create("String", Enumerable.Range(0, length).Select(x => x.ToString())); df.Columns.Insert(df.Columns.Count, stringColumn); if (withNulls) { stringColumn[length / 2] = null; } - DataFrameColumn charColumn = new PrimitiveDataFrameColumn("Char", Enumerable.Range(0, length).Select(x => (char)(x + 65))); + DataFrameColumn charColumn = DataFrameColumn.Create("Char", Enumerable.Range(0, length).Select(x => (char)(x + 65))); df.Columns.Insert(df.Columns.Count, charColumn); if (withNulls) { @@ -122,17 +122,17 @@ public static DataFrame MakeDataFrameWithNumericAndStringColumns(int length, boo public static DataFrame MakeDataFrameWithNumericColumns(int length, bool withNulls = true) { - DataFrameColumn byteColumn = new PrimitiveDataFrameColumn("Byte", Enumerable.Range(0, length).Select(x => (byte)x)); - DataFrameColumn decimalColumn = new PrimitiveDataFrameColumn("Decimal", Enumerable.Range(0, length).Select(x => (decimal)x)); - DataFrameColumn doubleColumn = new PrimitiveDataFrameColumn("Double", Enumerable.Range(0, length).Select(x => (double)x)); - DataFrameColumn floatColumn = new PrimitiveDataFrameColumn("Float", Enumerable.Range(0, length).Select(x => (float)x)); - DataFrameColumn intColumn = new PrimitiveDataFrameColumn("Int", Enumerable.Range(0, length).Select(x => x)); - DataFrameColumn longColumn = new PrimitiveDataFrameColumn("Long", Enumerable.Range(0, length).Select(x => (long)x)); - DataFrameColumn sbyteColumn = new PrimitiveDataFrameColumn("Sbyte", Enumerable.Range(0, length).Select(x => (sbyte)x)); - DataFrameColumn shortColumn = new PrimitiveDataFrameColumn("Short", Enumerable.Range(0, length).Select(x => (short)x)); - DataFrameColumn uintColumn = new PrimitiveDataFrameColumn("Uint", Enumerable.Range(0, length).Select(x => (uint)x)); - DataFrameColumn ulongColumn = new PrimitiveDataFrameColumn("Ulong", Enumerable.Range(0, length).Select(x => (ulong)x)); - DataFrameColumn ushortColumn = new PrimitiveDataFrameColumn("Ushort", Enumerable.Range(0, length).Select(x => (ushort)x)); + DataFrameColumn byteColumn = DataFrameColumn.Create("Byte", Enumerable.Range(0, length).Select(x => (byte)x)); + DataFrameColumn decimalColumn = DataFrameColumn.Create("Decimal", Enumerable.Range(0, length).Select(x => (decimal)x)); + DataFrameColumn doubleColumn = DataFrameColumn.Create("Double", Enumerable.Range(0, length).Select(x => (double)x)); + DataFrameColumn floatColumn = DataFrameColumn.Create("Float", Enumerable.Range(0, length).Select(x => (float)x)); + DataFrameColumn intColumn = DataFrameColumn.Create("Int", Enumerable.Range(0, length).Select(x => x)); + DataFrameColumn longColumn = DataFrameColumn.Create("Long", Enumerable.Range(0, length).Select(x => (long)x)); + DataFrameColumn sbyteColumn = DataFrameColumn.Create("Sbyte", Enumerable.Range(0, length).Select(x => (sbyte)x)); + DataFrameColumn shortColumn = DataFrameColumn.Create("Short", Enumerable.Range(0, length).Select(x => (short)x)); + DataFrameColumn uintColumn = DataFrameColumn.Create("Uint", Enumerable.Range(0, length).Select(x => (uint)x)); + DataFrameColumn ulongColumn = DataFrameColumn.Create("Ulong", Enumerable.Range(0, length).Select(x => (ulong)x)); + DataFrameColumn ushortColumn = DataFrameColumn.Create("Ushort", Enumerable.Range(0, length).Select(x => (ushort)x)); DataFrame dataFrame = new DataFrame(new List { byteColumn, decimalColumn, doubleColumn, floatColumn, intColumn, longColumn, sbyteColumn, shortColumn, uintColumn, ulongColumn, ushortColumn }); @@ -150,8 +150,8 @@ public static DataFrame MakeDataFrame(int length, bool withNulls = true) where T1 : unmanaged where T2 : unmanaged { - DataFrameColumn baseColumn1 = new PrimitiveDataFrameColumn("Column1", Enumerable.Range(0, length).Select(x => (T1)Convert.ChangeType(x % 2 == 0 ? 0 : 1, typeof(T1)))); - DataFrameColumn baseColumn2 = new PrimitiveDataFrameColumn("Column2", Enumerable.Range(0, length).Select(x => (T2)Convert.ChangeType(x % 2 == 0 ? 0 : 1, typeof(T2)))); + DataFrameColumn baseColumn1 = DataFrameColumn.Create("Column1", Enumerable.Range(0, length).Select(x => (T1)Convert.ChangeType(x % 2 == 0 ? 0 : 1, typeof(T1)))); + DataFrameColumn baseColumn2 = DataFrameColumn.Create("Column2", Enumerable.Range(0, length).Select(x => (T2)Convert.ChangeType(x % 2 == 0 ? 0 : 1, typeof(T2)))); DataFrame dataFrame = new DataFrame(new List { baseColumn1, baseColumn2 }); if (withNulls) From 82c315f088acfd78bee6dd89bd1df6369fa70234 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Mon, 27 Jan 2020 21:39:13 -0800 Subject: [PATCH 16/53] Append rows to a DataFrame (#2823) * Append rows to a DataFrame * Unit test * Update unit tests and doc * Need to perfrom a type check every time * sq * Update unit test * Address comments --- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 2 +- src/Microsoft.Data.Analysis/DataFrame.cs | 112 +++++++++------- .../DataFrameTests.cs | 122 +++++++++++++++--- 3 files changed, 176 insertions(+), 60 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index b1ff654c27..950b6c3700 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -271,7 +271,7 @@ public static DataFrame LoadCsv(Stream csvStream, } else { - ret.Append(spl); + ret.Append(spl, inPlace: true); } ++rowline; line = streamReader.ReadLine(); diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index d6e5b1bcc6..c4913d1fed 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -424,56 +424,76 @@ private void ResizeByOneAndAppend(DataFrameColumn column, object value) } /// - /// Appends a row inplace to the DataFrame + /// Appends rows to the DataFrame + /// + /// If an input column's value doesn't match a DataFrameColumn's data type, a conversion will be attempted + /// If a in is null, a null value is appended to each column + /// The rows to be appended to this DataFrame + /// If set, appends in place. Otherwise, a new DataFrame is returned with the appended + public DataFrame Append(IEnumerable rows, bool inPlace = false) + { + DataFrame ret = inPlace ? this : Clone(); + foreach (DataFrameRow row in rows) + { + ret.Append(row, inPlace: true); + } + return ret; + } + + /// + /// Appends a row to the DataFrame /// /// If a column's value doesn't match its column's data type, a conversion will be attempted /// If is null, a null value is appended to each column /// - public void Append(IEnumerable row = null) + /// If set, appends a in place. Otherwise, a new DataFrame is returned with an appended + public DataFrame Append(IEnumerable row = null, bool inPlace = false) { - IEnumerator columnEnumerator = Columns.GetEnumerator(); + DataFrame ret = inPlace ? this : Clone(); + IEnumerator columnEnumerator = ret.Columns.GetEnumerator(); bool columnMoveNext = columnEnumerator.MoveNext(); if (row != null) { - // Go through row first to make sure there are no data type incompatibilities - IEnumerator rowEnumerator = row.GetEnumerator(); - bool rowMoveNext = rowEnumerator.MoveNext(); - List cachedObjectConversions = new List(); - while (columnMoveNext && rowMoveNext) - { - DataFrameColumn column = columnEnumerator.Current; - object value = rowEnumerator.Current; - // StringDataFrameColumn can accept empty strings. The other columns interpret empty values as nulls - if (value is string stringValue && string.IsNullOrEmpty(stringValue) && column.DataType != typeof(string)) - { - value = null; - } - if (value != null) + // Go through row first to make sure there are no data type incompatibilities + IEnumerator rowEnumerator = row.GetEnumerator(); + bool rowMoveNext = rowEnumerator.MoveNext(); + List cachedObjectConversions = new List(); + while (columnMoveNext && rowMoveNext) { - value = Convert.ChangeType(value, column.DataType); - if (value is null) + DataFrameColumn column = columnEnumerator.Current; + object value = rowEnumerator.Current; + // StringDataFrameColumn can accept empty strings. The other columns interpret empty values as nulls + if (value is string stringValue && string.IsNullOrEmpty(stringValue) && column.DataType != typeof(string)) { - throw new ArgumentException(string.Format(Strings.MismatchedValueType, column.DataType), value.GetType().ToString()); + value = null; } + if (value != null) + { + value = Convert.ChangeType(value, column.DataType); + if (value is null) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, column.DataType), value.GetType().ToString()); + } + } + cachedObjectConversions.Add(value); + columnMoveNext = columnEnumerator.MoveNext(); + rowMoveNext = rowEnumerator.MoveNext(); } - cachedObjectConversions.Add(value); - columnMoveNext = columnEnumerator.MoveNext(); - rowMoveNext = rowEnumerator.MoveNext(); - } - if (rowMoveNext) - { - throw new ArgumentException(string.Format(Strings.ExceedsNumberOfColumns, Columns.Count), nameof(row)); - } - columnEnumerator.Reset(); + if (rowMoveNext) + { + throw new ArgumentException(string.Format(Strings.ExceedsNumberOfColumns, Columns.Count), nameof(row)); + } + // Reset the enumerators + columnEnumerator = ret.Columns.GetEnumerator(); columnMoveNext = columnEnumerator.MoveNext(); - rowEnumerator.Reset(); + rowEnumerator = row.GetEnumerator(); rowMoveNext = rowEnumerator.MoveNext(); int cacheIndex = 0; while (columnMoveNext && rowMoveNext) { DataFrameColumn column = columnEnumerator.Current; object value = cachedObjectConversions[cacheIndex]; - ResizeByOneAndAppend(column, value); + ret.ResizeByOneAndAppend(column, value); columnMoveNext = columnEnumerator.MoveNext(); rowMoveNext = rowEnumerator.MoveNext(); cacheIndex++; @@ -483,19 +503,22 @@ public void Append(IEnumerable row = null) { // Fill the remaining columns with null DataFrameColumn column = columnEnumerator.Current; - ResizeByOneAndAppend(column, null); + ret.ResizeByOneAndAppend(column, null); columnMoveNext = columnEnumerator.MoveNext(); } - Columns.RowCount++; + ret.Columns.RowCount++; + return ret; } /// - /// Appends a row inplace by enumerating column names and values from + /// Appends a row by enumerating column names and values from /// /// If a column's value doesn't match its column's data type, a conversion will be attempted - /// - public void Append(IEnumerable> row) + /// An enumeration of column name and value to be appended + /// If set, appends in place. Otherwise, a new DataFrame is returned with an appended + public DataFrame Append(IEnumerable> row, bool inPlace = false) { + DataFrame ret = inPlace ? this : Clone(); if (row == null) { throw new ArgumentNullException(nameof(row)); @@ -505,13 +528,13 @@ public void Append(IEnumerable> row) foreach (KeyValuePair columnAndValue in row) { string columnName = columnAndValue.Key; - int index = Columns.IndexOf(columnName); + int index = ret.Columns.IndexOf(columnName); if (index == -1) { throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName)); } - DataFrameColumn column = Columns[index]; + DataFrameColumn column = ret.Columns[index]; object value = columnAndValue.Value; if (value != null) { @@ -528,22 +551,23 @@ public void Append(IEnumerable> row) foreach (KeyValuePair columnAndValue in row) { string columnName = columnAndValue.Key; - int index = Columns.IndexOf(columnName); + int index = ret.Columns.IndexOf(columnName); - DataFrameColumn column = Columns[index]; + DataFrameColumn column = ret.Columns[index]; object value = cachedObjectConversions[cacheIndex]; - ResizeByOneAndAppend(column, value); + ret.ResizeByOneAndAppend(column, value); cacheIndex++; } - foreach (DataFrameColumn column in Columns) + foreach (DataFrameColumn column in ret.Columns) { if (column.Length == Rows.Count) { - ResizeByOneAndAppend(column, null); + ret.ResizeByOneAndAppend(column, null); } } - Columns.RowCount++; + ret.Columns.RowCount++; + return ret; } /// diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 7c448cbe6f..2aaf70896d 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -1947,70 +1947,162 @@ public void TestMutationOnRows() } } + [Fact] + public void TestAppendRows() + { + DataFrame df = MakeDataFrame(10); + DataFrame df2 = MakeDataFrame(5); + Assert.Equal(10, df.Rows.Count); + Assert.Equal(1, df.Columns[0].NullCount); + Assert.Equal(1, df.Columns[1].NullCount); + + DataFrame ret = df.Append(df2.Rows, inPlace: false); + Assert.Equal(10, df.Rows.Count); + Assert.Equal(1, df.Columns[0].NullCount); + Assert.Equal(1, df.Columns[1].NullCount); + + Verify(ret, df, df2); + + void Verify(DataFrame ret, DataFrame check1, DataFrame check2) + { + Assert.Equal(15, ret.Rows.Count); + Assert.Equal(2, ret.Columns[0].NullCount); + Assert.Equal(2, ret.Columns[1].NullCount); + for (long i = 0; i < ret.Rows.Count; i++) + { + DataFrameRow row = ret.Rows[i]; + for (int j = 0; j < check1.Columns.Count; j++) + { + if (i < check1.Rows.Count) + { + Assert.Equal(row[j], check1.Rows[i][j]); + } + else + { + Assert.Equal(row[j]?.ToString(), (check2.Rows[i - check1.Rows.Count][j])?.ToString()); + } + } + } + } + + DataFrame dfClone = df.Clone(); + df.Append(df2.Rows, inPlace: true); + Verify(df, dfClone, df2); + } + [Fact] public void TestAppendRow() { DataFrame df = MakeDataFrame(10); - df.Append(new List { 5, true }); + df.Append(new List { 5, true }, inPlace: true); Assert.Equal(11, df.Rows.Count); Assert.Equal(1, df.Columns[0].NullCount); Assert.Equal(1, df.Columns[1].NullCount); - df.Append(new List { 100 }); + DataFrame ret = df.Append(new List { 5, true }); + Assert.Equal(12, ret.Rows.Count); + Assert.Equal(1, ret.Columns[0].NullCount); + Assert.Equal(1, ret.Columns[1].NullCount); + + df.Append(new List { 100 }, inPlace: true); Assert.Equal(12, df.Rows.Count); Assert.Equal(1, df.Columns[0].NullCount); Assert.Equal(2, df.Columns[1].NullCount); - df.Append(new List { null, null }); + ret = df.Append(new List { 100 }, inPlace: false); + Assert.Equal(13, ret.Rows.Count); + Assert.Equal(1, ret.Columns[0].NullCount); + Assert.Equal(3, ret.Columns[1].NullCount); + + df.Append(new List { null, null }, inPlace: true); Assert.Equal(13, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(3, df.Columns[1].NullCount); + ret = df.Append(new List { null, null }, inPlace: false); + Assert.Equal(14, ret.Rows.Count); + Assert.Equal(3, ret.Columns[0].NullCount); + Assert.Equal(4, ret.Columns[1].NullCount); - df.Append(new Dictionary { { "Column1", (object)5 } , { "Column2", false } }); + df.Append(new Dictionary { { "Column1", (object)5 }, { "Column2", false } }, inPlace: true); Assert.Equal(14, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(3, df.Columns[1].NullCount); + ret = df.Append(new Dictionary { { "Column1", (object)5 }, { "Column2", false } }, inPlace: false); + Assert.Equal(15, ret.Rows.Count); + Assert.Equal(2, ret.Columns[0].NullCount); + Assert.Equal(3, ret.Columns[1].NullCount); - df.Append(new Dictionary { { "Column1", 5 } }); + df.Append(new Dictionary { { "Column1", 5 } }, inPlace: true); Assert.Equal(15, df.Rows.Count); Assert.Equal(15, df["Column1"].Length); Assert.Equal(15, df["Column2"].Length); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(4, df.Columns[1].NullCount); + ret = df.Append(new Dictionary { { "Column1", 5 } }, inPlace: false); + Assert.Equal(16, ret.Rows.Count); - df.Append(new Dictionary { { "Column2", false } }); + Assert.Equal(16, ret["Column1"].Length); + Assert.Equal(16, ret["Column2"].Length); + Assert.Equal(2, ret.Columns[0].NullCount); + Assert.Equal(5, ret.Columns[1].NullCount); + + df.Append(new Dictionary { { "Column2", false } }, inPlace: true); Assert.Equal(16, df.Rows.Count); Assert.Equal(16, df["Column1"].Length); Assert.Equal(16, df["Column2"].Length); Assert.Equal(3, df.Columns[0].NullCount); Assert.Equal(4, df.Columns[1].NullCount); - - df.Append((IEnumerable)null); + ret = df.Append(new Dictionary { { "Column2", false } }, inPlace: false); + Assert.Equal(17, ret.Rows.Count); + Assert.Equal(17, ret["Column1"].Length); + Assert.Equal(17, ret["Column2"].Length); + Assert.Equal(4, ret.Columns[0].NullCount); + Assert.Equal(4, ret.Columns[1].NullCount); + + df.Append((IEnumerable)null, inPlace: true); Assert.Equal(17, df.Rows.Count); Assert.Equal(17, df["Column1"].Length); Assert.Equal(17, df["Column2"].Length); Assert.Equal(4, df.Columns[0].NullCount); Assert.Equal(5, df.Columns[1].NullCount); + ret = df.Append((IEnumerable)null, inPlace: false); + Assert.Equal(18, ret.Rows.Count); + Assert.Equal(18, ret["Column1"].Length); + Assert.Equal(18, ret["Column2"].Length); + Assert.Equal(5, ret.Columns[0].NullCount); + Assert.Equal(6, ret.Columns[1].NullCount); // DataFrame must remain usable even if Append throws - Assert.Throws(() => df.Append(new List { 5, "str" })); - Assert.Throws(() => df.Append(new Dictionary { { "Column2", "str" } })); - Assert.Throws(() => df.Append(new List { 5, true, true })); + Assert.Throws(() => df.Append(new List { 5, "str" }, inPlace: true)); + Assert.Throws(() => df.Append(new Dictionary { { "Column2", "str" } }, inPlace: true)); + Assert.Throws(() => df.Append(new List { 5, true, true }, inPlace: true)); + + df.Append(inPlace: true); + Assert.Equal(18, df.Rows.Count); + Assert.Equal(18, df["Column1"].Length); + Assert.Equal(18, df["Column2"].Length); + Assert.Equal(5, df.Columns[0].NullCount); + Assert.Equal(6, df.Columns[1].NullCount); - df.Append(); + ret = df.Append(inPlace: false); Assert.Equal(18, df.Rows.Count); Assert.Equal(18, df["Column1"].Length); Assert.Equal(18, df["Column2"].Length); Assert.Equal(5, df.Columns[0].NullCount); Assert.Equal(6, df.Columns[1].NullCount); + Assert.Equal(19, ret.Rows.Count); + Assert.Equal(19, ret["Column1"].Length); + Assert.Equal(19, ret["Column2"].Length); + Assert.Equal(6, ret.Columns[0].NullCount); + Assert.Equal(7, ret.Columns[1].NullCount); } [Fact] public void TestAppendEmptyValue() { DataFrame df = MakeDataFrame(10); - df.Append(new List { "", true }); + df.Append(new List { "", true }, inPlace: true); Assert.Equal(11, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(1, df.Columns[1].NullCount); @@ -2018,13 +2110,13 @@ public void TestAppendEmptyValue() StringDataFrameColumn column = new StringDataFrameColumn("Strings", Enumerable.Range(0, 11).Select(x => x.ToString())); df.Columns.Add(column); - df.Append(new List { 1, true, "" }); + df.Append(new List { 1, true, "" }, inPlace: true); Assert.Equal(12, df.Rows.Count); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(1, df.Columns[1].NullCount); Assert.Equal(0, df.Columns[2].NullCount); - df.Append(new List { 1, true, null }); + df.Append(new List { 1, true, null }, inPlace: true); Assert.Equal(13, df.Rows.Count); Assert.Equal(1, df.Columns[2].NullCount); } From afdbc5b802d935d2dcbd346b10d7f21bb20af6d1 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 6 Feb 2020 16:04:04 -0800 Subject: [PATCH 17/53] Move corefxlab to arcade (#2795) * Add eng folder * First cut of moving corefxlab to arcade * Move arcade symbol validation inside official buil * Move base yml file to root * Arcade will build, publish packages and symbols * UpdateXlf. Review this * Arcade Update to version 5.0.0-beta.19575.4 to include Experimental Channel * Remove property that was causing the build to fail * Moving global properties to the main Yaml instead of step in order to unblock publishing * Committing xlfs and changing the build script to not update Xlf on build * clean up corefxlab-base.yml * sq * Delete unused files and scripts * Get rid of all the xlf stuff * Remove UpdateXlfOnBuild for non-NT builds * Minor cleanup * More cleanup * update eng\build.sh permission * Rename to Nuget.config * sq * Remove the runtime spec from global.json * Don't publish test projs * Typo * Move version prefix to versions.props Change prereleaselabel to alpha * Increment version number to list as the latest package Increment version number of Microsoft.Experimental.Collections to list as the latest package Turn off graph generation * Update the Readme * Test removing the scripts folder * Touch readme to force a change * Address Jose's comments * Typo * Move versions to eng/versions.props * Benchmark.proj needs to refer to xunit * Clean up dependencies.props * Remove dependencies.props Co-authored-by: Jose Perez Rodriguez --- .../Microsoft.Data.Analysis.Tests.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj index f4bdb218b2..af02a02c85 100644 --- a/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj +++ b/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj @@ -6,9 +6,6 @@ - - - From 355d3fb57772bee96282c176911e4a32faac32ce Mon Sep 17 00:00:00 2001 From: Jon Wood Date: Thu, 20 Feb 2020 13:17:36 -0500 Subject: [PATCH 18/53] Rename Sort to OrderBy (#2814) * Rename sort to orderby and add orderbydescending method * Add doc strings * Update bench mark test * Update tests * Update DataFrameColumn to use orderby * Update doc comment * Additions to sortby * Revert "Additions to sortby" This reverts commit 3931d4e2a72ce44a539be7c27b2592395f3efd35. * Revert "Update doc comment" This reverts commit 192f7797fe2b77625486637badf77046162fedbf. * Revert "Update DataFrameColumn to use orderby" This reverts commit 8f94664c5fd18570cd2b601535e816ca5dd5e3c4. --- src/Microsoft.Data.Analysis/DataFrame.cs | 42 +++++++++++++------ .../DataFrameTests.cs | 13 +++--- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index c4913d1fed..faa706b267 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -254,19 +254,22 @@ public DataFrame Description() return ret; } - public DataFrame Sort(string columnName, bool ascending = true) + /// + /// Orders the data frame by a specified column. + /// + /// The column name to order by + public DataFrame OrderBy(string columnName) { - DataFrameColumn column = this[columnName]; - DataFrameColumn sortIndices = column.GetAscendingSortIndices(); - List newColumns = new List(Columns.Count); - for (int i = 0; i < Columns.Count; i++) - { - DataFrameColumn oldColumn = Columns[i]; - DataFrameColumn newColumn = oldColumn.Clone(sortIndices, !ascending, oldColumn.NullCount); - Debug.Assert(newColumn.NullCount == oldColumn.NullCount); - newColumns.Add(newColumn); - } - return new DataFrame(newColumns); + return Sort(columnName, isAscending: true); + } + + /// + /// Orders the data frame by a specified column in descending order. + /// + /// The column name to order by + public DataFrame OrderByDescending(string columnName) + { + return Sort(columnName, isAscending: false); } /// @@ -578,6 +581,21 @@ private void OnColumnsChanged() _schema = null; } + private DataFrame Sort(string columnName, bool isAscending) + { + DataFrameColumn column = this[columnName]; + DataFrameColumn sortIndices = column.GetAscendingSortIndices(); + List newColumns = new List(Columns.Count); + for (int i = 0; i < Columns.Count; i++) + { + DataFrameColumn oldColumn = Columns[i]; + DataFrameColumn newColumn = oldColumn.Clone(sortIndices, !isAscending, oldColumn.NullCount); + Debug.Assert(newColumn.NullCount == oldColumn.NullCount); + newColumns.Add(newColumn); + } + return new DataFrame(newColumns); + } + public override string ToString() { StringBuilder sb = new StringBuilder(); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 2aaf70896d..bdf383425e 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -841,7 +841,7 @@ public void TestComputations() } [Fact] - public void TestSort() + public void TestOrderBy() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(20); df["Int"][0] = 100; @@ -849,27 +849,28 @@ public void TestSort() df["Int"][5] = 2000; // Sort by "Int" in ascending order - var sortedDf = df.Sort("Int"); + var sortedDf = df.OrderBy("Int"); Assert.Null(sortedDf["Int"][19]); Assert.Equal(-1, sortedDf["Int"][0]); Assert.Equal(100, sortedDf["Int"][17]); Assert.Equal(2000, sortedDf["Int"][18]); // Sort by "Int" in descending order - sortedDf = df.Sort("Int", false); + sortedDf = df.OrderByDescending("Int"); Assert.Null(sortedDf["Int"][19]); Assert.Equal(-1, sortedDf["Int"][18]); Assert.Equal(100, sortedDf["Int"][1]); Assert.Equal(2000, sortedDf["Int"][0]); // Sort by "String" in ascending order - sortedDf = df.Sort("String"); + sortedDf = df.OrderBy("String"); Assert.Null(sortedDf["Int"][19]); Assert.Equal(1, sortedDf["Int"][1]); Assert.Equal(8, sortedDf["Int"][17]); Assert.Equal(9, sortedDf["Int"][18]); - sortedDf = df.Sort("String", false); + // Sort by "String" in descending order + sortedDf = df.OrderByDescending("String"); Assert.Null(sortedDf["Int"][19]); Assert.Equal(8, sortedDf["Int"][1]); Assert.Equal(9, sortedDf["Int"][0]); @@ -886,7 +887,7 @@ public void TestSplitAndSort() DataFrame dfTrain = SplitTrainTest(df, 0.8f, out dfTest); // Sort by "Int" in ascending order - var sortedDf = dfTrain.Sort("Int"); + var sortedDf = dfTrain.OrderBy("Int"); Assert.Null(sortedDf["Int"][sortedDf.Rows.Count - 1]); Assert.Equal(1, sortedDf["Int"][0]); Assert.Equal(100000, sortedDf["Int"][sortedDf.Rows.Count - 3]); From 9e10004fc3ff3bbc56083f179dd837617041c9d3 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 4 Mar 2020 10:27:23 -0800 Subject: [PATCH 19/53] Explode column types and generate converters (#2857) * Explode column types and generate converters * Clean this * sq * sq * Cherry pick for next commit * sq * Undo unnecessary change --- .../BooleanDataFrameColumn.cs | 23 + .../ByteDataFrameColumn.cs | 23 + .../CharDataFrameColumn.cs | 23 + .../ColumnArithmeticTemplate.ttinclude | 74 ++ src/Microsoft.Data.Analysis/Converters.cs | 948 ++++++++++++++++++ src/Microsoft.Data.Analysis/Converters.tt | 84 ++ .../DecimalConverter.cs | 170 ---- .../DecimalDataFrameColumn.cs | 23 + .../DoubleConverter.cs | 162 --- .../DoubleDataFrameColumn.cs | 23 + .../Int16DataFrameColumn.cs | 23 + .../Int32DataFrameColumn.cs | 23 + .../Int64DataFrameColumn.cs | 23 + .../Microsoft.Data.Analysis.csproj | 44 + .../PrimitiveColumnContainer.cs | 180 ++++ .../PrimitiveDataFrameColumn.cs | 67 +- .../SByteDataFrameColumn.cs | 23 + .../SingleDataFrameColumn.cs | 23 + .../UInt16DataFrameColumn.cs | 23 + .../UInt32DataFrameColumn.cs | 23 + .../UInt64DataFrameColumn.cs | 23 + .../DataFrameTests.cs | 125 ++- 22 files changed, 1772 insertions(+), 381 deletions(-) create mode 100644 src/Microsoft.Data.Analysis/BooleanDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/ByteDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/CharDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/Converters.cs create mode 100644 src/Microsoft.Data.Analysis/Converters.tt delete mode 100644 src/Microsoft.Data.Analysis/DecimalConverter.cs create mode 100644 src/Microsoft.Data.Analysis/DecimalDataFrameColumn.cs delete mode 100644 src/Microsoft.Data.Analysis/DoubleConverter.cs create mode 100644 src/Microsoft.Data.Analysis/DoubleDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/Int16DataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/Int32DataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/Int64DataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/SByteDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/SingleDataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/UInt16DataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/UInt32DataFrameColumn.cs create mode 100644 src/Microsoft.Data.Analysis/UInt64DataFrameColumn.cs diff --git a/src/Microsoft.Data.Analysis/BooleanDataFrameColumn.cs b/src/Microsoft.Data.Analysis/BooleanDataFrameColumn.cs new file mode 100644 index 0000000000..982463d182 --- /dev/null +++ b/src/Microsoft.Data.Analysis/BooleanDataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class BooleanDataFrameColumn : PrimitiveDataFrameColumn + { + public BooleanDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public BooleanDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public BooleanDataFrameColumn(string name, long length = 0) : base(name, length) { } + + public BooleanDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal BooleanDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/ByteDataFrameColumn.cs b/src/Microsoft.Data.Analysis/ByteDataFrameColumn.cs new file mode 100644 index 0000000000..369e6d33ee --- /dev/null +++ b/src/Microsoft.Data.Analysis/ByteDataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class ByteDataFrameColumn : PrimitiveDataFrameColumn + { + public ByteDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public ByteDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public ByteDataFrameColumn(string name, long length = 0) : base(name, length) { } + + public ByteDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal ByteDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/CharDataFrameColumn.cs b/src/Microsoft.Data.Analysis/CharDataFrameColumn.cs new file mode 100644 index 0000000000..1dcedc4fc9 --- /dev/null +++ b/src/Microsoft.Data.Analysis/CharDataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class CharDataFrameColumn : PrimitiveDataFrameColumn + { + public CharDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public CharDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public CharDataFrameColumn(string name, long length = 0) : base(name, length) { } + + public CharDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal CharDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude index 55960ee376..f97eea5a1e 100644 --- a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude +++ b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude @@ -38,6 +38,56 @@ return $"{keyword} (typeof(T) == typeof({type.TypeName}))"; } + // A way to discern implicit conversions. For ex: short has primitivitty 2. int has primitivitty 3. primitivitty(short) + primitivitty(int) > 2 * primitivitty(short) implying that a conversion has to take place + public Dictionary primitiveTypeToPrimitivityLevelMap = new Dictionary { + {"byte", 1}, + {"sbyte", 1}, + {"short", 2}, + {"ushort", 2}, + {"int", 3}, + {"uint", 3}, + {"long", 4}, + {"ulong", 4}, + {"float", 5}, + {"double", 6}, + {"decimal", 7} + }; + + public string GetCapitalizedPrimitiveTypes(string type) + { + string typeFirstCharUpper; + if (type.First() == 'u' || type == "sbyte") + { + typeFirstCharUpper = type[0].ToString().ToUpper() + type[1].ToString().ToUpper() + type.Substring(2); + } + else + { + typeFirstCharUpper = type[0].ToString().ToUpper() + type.Substring(1); + } + return typeFirstCharUpper; + } + + public bool IsMixedSignedAndUnsignedTypePair(string t1, string t2) + { + if (t1 == "byte" && t2 == "sbyte") + { + return true; + } + if (t2 == "byte" && t1 == "sbyte") + { + return true; + } + if (("u" + t1) == t2) + { + return true; + } + if (("u" + t2) == t1) + { + return true; + } + return false; + } + public TypeConfiguration[] typeConfiguration = new [] { new TypeConfiguration("bool", oneLiteral:"true", zeroLiteral:"false", supportsNumeric: false, unsupportedMethods: new[] {"LeftShift", "RightShift"}), @@ -55,6 +105,30 @@ new TypeConfiguration("ushort", classPrefix:"UShort", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}) }; + public string GetBinaryOperationReturnType(TypeConfiguration t1, TypeConfiguration t2) + { + int t1Level; + if (!primitiveTypeToPrimitivityLevelMap.TryGetValue(t1.TypeName, out t1Level)) + { + throw new Exception("Unknown type"); + } + int t2Level; + if (!primitiveTypeToPrimitivityLevelMap.TryGetValue(t2.TypeName, out t2Level)) + { + throw new Exception("Unknown type"); + } + if (t1Level + t2Level <= 2 * t1Level) + { + return t1.TypeName; + } + if (t1Level + t2Level <= 2 * t2Level) + { + return t2.TypeName; + } + throw new Exception("Bug in GetBinaryOperationReturnType"); + return ""; + } + public enum MethodType { Unary, diff --git a/src/Microsoft.Data.Analysis/Converters.cs b/src/Microsoft.Data.Analysis/Converters.cs new file mode 100644 index 0000000000..a3d2abc67c --- /dev/null +++ b/src/Microsoft.Data.Analysis/Converters.cs @@ -0,0 +1,948 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from Converters.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + internal interface IByteConverter + { + byte GetByte(T value); + } + internal static class ByteConverter + { + public static IByteConverter Instance { get; } = ByteConverter.GetByteConverter(); + } + internal static class ByteConverter + { + public static IByteConverter GetByteConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IByteConverter)new ByteByteConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IByteConverter)new SByteByteConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteByteConverter : IByteConverter + { + public byte GetByte(byte value) + { + return (byte)value; + } + } + internal class SByteByteConverter : IByteConverter + { + public byte GetByte(sbyte value) + { + return (byte)value; + } + } + internal interface ISByteConverter + { + sbyte GetSByte(T value); + } + internal static class SByteConverter + { + public static ISByteConverter Instance { get; } = SByteConverter.GetSByteConverter(); + } + internal static class SByteConverter + { + public static ISByteConverter GetSByteConverter() + { + if (typeof(T) == typeof(byte)) + { + return (ISByteConverter)new ByteSByteConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (ISByteConverter)new SByteSByteConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteSByteConverter : ISByteConverter + { + public sbyte GetSByte(byte value) + { + return (sbyte)value; + } + } + internal class SByteSByteConverter : ISByteConverter + { + public sbyte GetSByte(sbyte value) + { + return (sbyte)value; + } + } + internal interface IShortConverter + { + short GetShort(T value); + } + internal static class ShortConverter + { + public static IShortConverter Instance { get; } = ShortConverter.GetShortConverter(); + } + internal static class ShortConverter + { + public static IShortConverter GetShortConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IShortConverter)new ByteShortConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IShortConverter)new SByteShortConverter(); + } + if (typeof(T) == typeof(short)) + { + return (IShortConverter)new ShortShortConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (IShortConverter)new UShortShortConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteShortConverter : IShortConverter + { + public short GetShort(byte value) + { + return (short)value; + } + } + internal class SByteShortConverter : IShortConverter + { + public short GetShort(sbyte value) + { + return (short)value; + } + } + internal class ShortShortConverter : IShortConverter + { + public short GetShort(short value) + { + return (short)value; + } + } + internal class UShortShortConverter : IShortConverter + { + public short GetShort(ushort value) + { + return (short)value; + } + } + internal interface IUShortConverter + { + ushort GetUShort(T value); + } + internal static class UShortConverter + { + public static IUShortConverter Instance { get; } = UShortConverter.GetUShortConverter(); + } + internal static class UShortConverter + { + public static IUShortConverter GetUShortConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IUShortConverter)new ByteUShortConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IUShortConverter)new SByteUShortConverter(); + } + if (typeof(T) == typeof(short)) + { + return (IUShortConverter)new ShortUShortConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (IUShortConverter)new UShortUShortConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteUShortConverter : IUShortConverter + { + public ushort GetUShort(byte value) + { + return (ushort)value; + } + } + internal class SByteUShortConverter : IUShortConverter + { + public ushort GetUShort(sbyte value) + { + return (ushort)value; + } + } + internal class ShortUShortConverter : IUShortConverter + { + public ushort GetUShort(short value) + { + return (ushort)value; + } + } + internal class UShortUShortConverter : IUShortConverter + { + public ushort GetUShort(ushort value) + { + return (ushort)value; + } + } + internal interface IIntConverter + { + int GetInt(T value); + } + internal static class IntConverter + { + public static IIntConverter Instance { get; } = IntConverter.GetIntConverter(); + } + internal static class IntConverter + { + public static IIntConverter GetIntConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IIntConverter)new ByteIntConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IIntConverter)new SByteIntConverter(); + } + if (typeof(T) == typeof(short)) + { + return (IIntConverter)new ShortIntConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (IIntConverter)new UShortIntConverter(); + } + if (typeof(T) == typeof(int)) + { + return (IIntConverter)new IntIntConverter(); + } + if (typeof(T) == typeof(uint)) + { + return (IIntConverter)new UIntIntConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteIntConverter : IIntConverter + { + public int GetInt(byte value) + { + return (int)value; + } + } + internal class SByteIntConverter : IIntConverter + { + public int GetInt(sbyte value) + { + return (int)value; + } + } + internal class ShortIntConverter : IIntConverter + { + public int GetInt(short value) + { + return (int)value; + } + } + internal class UShortIntConverter : IIntConverter + { + public int GetInt(ushort value) + { + return (int)value; + } + } + internal class IntIntConverter : IIntConverter + { + public int GetInt(int value) + { + return (int)value; + } + } + internal class UIntIntConverter : IIntConverter + { + public int GetInt(uint value) + { + return (int)value; + } + } + internal interface IUIntConverter + { + uint GetUInt(T value); + } + internal static class UIntConverter + { + public static IUIntConverter Instance { get; } = UIntConverter.GetUIntConverter(); + } + internal static class UIntConverter + { + public static IUIntConverter GetUIntConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IUIntConverter)new ByteUIntConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IUIntConverter)new SByteUIntConverter(); + } + if (typeof(T) == typeof(short)) + { + return (IUIntConverter)new ShortUIntConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (IUIntConverter)new UShortUIntConverter(); + } + if (typeof(T) == typeof(int)) + { + return (IUIntConverter)new IntUIntConverter(); + } + if (typeof(T) == typeof(uint)) + { + return (IUIntConverter)new UIntUIntConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteUIntConverter : IUIntConverter + { + public uint GetUInt(byte value) + { + return (uint)value; + } + } + internal class SByteUIntConverter : IUIntConverter + { + public uint GetUInt(sbyte value) + { + return (uint)value; + } + } + internal class ShortUIntConverter : IUIntConverter + { + public uint GetUInt(short value) + { + return (uint)value; + } + } + internal class UShortUIntConverter : IUIntConverter + { + public uint GetUInt(ushort value) + { + return (uint)value; + } + } + internal class IntUIntConverter : IUIntConverter + { + public uint GetUInt(int value) + { + return (uint)value; + } + } + internal class UIntUIntConverter : IUIntConverter + { + public uint GetUInt(uint value) + { + return (uint)value; + } + } + internal interface ILongConverter + { + long GetLong(T value); + } + internal static class LongConverter + { + public static ILongConverter Instance { get; } = LongConverter.GetLongConverter(); + } + internal static class LongConverter + { + public static ILongConverter GetLongConverter() + { + if (typeof(T) == typeof(byte)) + { + return (ILongConverter)new ByteLongConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (ILongConverter)new SByteLongConverter(); + } + if (typeof(T) == typeof(short)) + { + return (ILongConverter)new ShortLongConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (ILongConverter)new UShortLongConverter(); + } + if (typeof(T) == typeof(int)) + { + return (ILongConverter)new IntLongConverter(); + } + if (typeof(T) == typeof(uint)) + { + return (ILongConverter)new UIntLongConverter(); + } + if (typeof(T) == typeof(long)) + { + return (ILongConverter)new LongLongConverter(); + } + if (typeof(T) == typeof(ulong)) + { + return (ILongConverter)new ULongLongConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteLongConverter : ILongConverter + { + public long GetLong(byte value) + { + return (long)value; + } + } + internal class SByteLongConverter : ILongConverter + { + public long GetLong(sbyte value) + { + return (long)value; + } + } + internal class ShortLongConverter : ILongConverter + { + public long GetLong(short value) + { + return (long)value; + } + } + internal class UShortLongConverter : ILongConverter + { + public long GetLong(ushort value) + { + return (long)value; + } + } + internal class IntLongConverter : ILongConverter + { + public long GetLong(int value) + { + return (long)value; + } + } + internal class UIntLongConverter : ILongConverter + { + public long GetLong(uint value) + { + return (long)value; + } + } + internal class LongLongConverter : ILongConverter + { + public long GetLong(long value) + { + return (long)value; + } + } + internal class ULongLongConverter : ILongConverter + { + public long GetLong(ulong value) + { + return (long)value; + } + } + internal interface IULongConverter + { + ulong GetULong(T value); + } + internal static class ULongConverter + { + public static IULongConverter Instance { get; } = ULongConverter.GetULongConverter(); + } + internal static class ULongConverter + { + public static IULongConverter GetULongConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IULongConverter)new ByteULongConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IULongConverter)new SByteULongConverter(); + } + if (typeof(T) == typeof(short)) + { + return (IULongConverter)new ShortULongConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (IULongConverter)new UShortULongConverter(); + } + if (typeof(T) == typeof(int)) + { + return (IULongConverter)new IntULongConverter(); + } + if (typeof(T) == typeof(uint)) + { + return (IULongConverter)new UIntULongConverter(); + } + if (typeof(T) == typeof(long)) + { + return (IULongConverter)new LongULongConverter(); + } + if (typeof(T) == typeof(ulong)) + { + return (IULongConverter)new ULongULongConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteULongConverter : IULongConverter + { + public ulong GetULong(byte value) + { + return (ulong)value; + } + } + internal class SByteULongConverter : IULongConverter + { + public ulong GetULong(sbyte value) + { + return (ulong)value; + } + } + internal class ShortULongConverter : IULongConverter + { + public ulong GetULong(short value) + { + return (ulong)value; + } + } + internal class UShortULongConverter : IULongConverter + { + public ulong GetULong(ushort value) + { + return (ulong)value; + } + } + internal class IntULongConverter : IULongConverter + { + public ulong GetULong(int value) + { + return (ulong)value; + } + } + internal class UIntULongConverter : IULongConverter + { + public ulong GetULong(uint value) + { + return (ulong)value; + } + } + internal class LongULongConverter : IULongConverter + { + public ulong GetULong(long value) + { + return (ulong)value; + } + } + internal class ULongULongConverter : IULongConverter + { + public ulong GetULong(ulong value) + { + return (ulong)value; + } + } + internal interface IFloatConverter + { + float GetFloat(T value); + } + internal static class FloatConverter + { + public static IFloatConverter Instance { get; } = FloatConverter.GetFloatConverter(); + } + internal static class FloatConverter + { + public static IFloatConverter GetFloatConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IFloatConverter)new ByteFloatConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IFloatConverter)new SByteFloatConverter(); + } + if (typeof(T) == typeof(short)) + { + return (IFloatConverter)new ShortFloatConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (IFloatConverter)new UShortFloatConverter(); + } + if (typeof(T) == typeof(int)) + { + return (IFloatConverter)new IntFloatConverter(); + } + if (typeof(T) == typeof(uint)) + { + return (IFloatConverter)new UIntFloatConverter(); + } + if (typeof(T) == typeof(long)) + { + return (IFloatConverter)new LongFloatConverter(); + } + if (typeof(T) == typeof(ulong)) + { + return (IFloatConverter)new ULongFloatConverter(); + } + if (typeof(T) == typeof(float)) + { + return (IFloatConverter)new FloatFloatConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteFloatConverter : IFloatConverter + { + public float GetFloat(byte value) + { + return (float)value; + } + } + internal class SByteFloatConverter : IFloatConverter + { + public float GetFloat(sbyte value) + { + return (float)value; + } + } + internal class ShortFloatConverter : IFloatConverter + { + public float GetFloat(short value) + { + return (float)value; + } + } + internal class UShortFloatConverter : IFloatConverter + { + public float GetFloat(ushort value) + { + return (float)value; + } + } + internal class IntFloatConverter : IFloatConverter + { + public float GetFloat(int value) + { + return (float)value; + } + } + internal class UIntFloatConverter : IFloatConverter + { + public float GetFloat(uint value) + { + return (float)value; + } + } + internal class LongFloatConverter : IFloatConverter + { + public float GetFloat(long value) + { + return (float)value; + } + } + internal class ULongFloatConverter : IFloatConverter + { + public float GetFloat(ulong value) + { + return (float)value; + } + } + internal class FloatFloatConverter : IFloatConverter + { + public float GetFloat(float value) + { + return (float)value; + } + } + internal interface IDoubleConverter + { + double GetDouble(T value); + } + internal static class DoubleConverter + { + public static IDoubleConverter Instance { get; } = DoubleConverter.GetDoubleConverter(); + } + internal static class DoubleConverter + { + public static IDoubleConverter GetDoubleConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IDoubleConverter)new ByteDoubleConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IDoubleConverter)new SByteDoubleConverter(); + } + if (typeof(T) == typeof(short)) + { + return (IDoubleConverter)new ShortDoubleConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (IDoubleConverter)new UShortDoubleConverter(); + } + if (typeof(T) == typeof(int)) + { + return (IDoubleConverter)new IntDoubleConverter(); + } + if (typeof(T) == typeof(uint)) + { + return (IDoubleConverter)new UIntDoubleConverter(); + } + if (typeof(T) == typeof(long)) + { + return (IDoubleConverter)new LongDoubleConverter(); + } + if (typeof(T) == typeof(ulong)) + { + return (IDoubleConverter)new ULongDoubleConverter(); + } + if (typeof(T) == typeof(float)) + { + return (IDoubleConverter)new FloatDoubleConverter(); + } + if (typeof(T) == typeof(double)) + { + return (IDoubleConverter)new DoubleDoubleConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteDoubleConverter : IDoubleConverter + { + public double GetDouble(byte value) + { + return (double)value; + } + } + internal class SByteDoubleConverter : IDoubleConverter + { + public double GetDouble(sbyte value) + { + return (double)value; + } + } + internal class ShortDoubleConverter : IDoubleConverter + { + public double GetDouble(short value) + { + return (double)value; + } + } + internal class UShortDoubleConverter : IDoubleConverter + { + public double GetDouble(ushort value) + { + return (double)value; + } + } + internal class IntDoubleConverter : IDoubleConverter + { + public double GetDouble(int value) + { + return (double)value; + } + } + internal class UIntDoubleConverter : IDoubleConverter + { + public double GetDouble(uint value) + { + return (double)value; + } + } + internal class LongDoubleConverter : IDoubleConverter + { + public double GetDouble(long value) + { + return (double)value; + } + } + internal class ULongDoubleConverter : IDoubleConverter + { + public double GetDouble(ulong value) + { + return (double)value; + } + } + internal class FloatDoubleConverter : IDoubleConverter + { + public double GetDouble(float value) + { + return (double)value; + } + } + internal class DoubleDoubleConverter : IDoubleConverter + { + public double GetDouble(double value) + { + return (double)value; + } + } + internal interface IDecimalConverter + { + decimal GetDecimal(T value); + } + internal static class DecimalConverter + { + public static IDecimalConverter Instance { get; } = DecimalConverter.GetDecimalConverter(); + } + internal static class DecimalConverter + { + public static IDecimalConverter GetDecimalConverter() + { + if (typeof(T) == typeof(byte)) + { + return (IDecimalConverter)new ByteDecimalConverter(); + } + if (typeof(T) == typeof(sbyte)) + { + return (IDecimalConverter)new SByteDecimalConverter(); + } + if (typeof(T) == typeof(short)) + { + return (IDecimalConverter)new ShortDecimalConverter(); + } + if (typeof(T) == typeof(ushort)) + { + return (IDecimalConverter)new UShortDecimalConverter(); + } + if (typeof(T) == typeof(int)) + { + return (IDecimalConverter)new IntDecimalConverter(); + } + if (typeof(T) == typeof(uint)) + { + return (IDecimalConverter)new UIntDecimalConverter(); + } + if (typeof(T) == typeof(long)) + { + return (IDecimalConverter)new LongDecimalConverter(); + } + if (typeof(T) == typeof(ulong)) + { + return (IDecimalConverter)new ULongDecimalConverter(); + } + if (typeof(T) == typeof(float)) + { + return (IDecimalConverter)new FloatDecimalConverter(); + } + if (typeof(T) == typeof(double)) + { + return (IDecimalConverter)new DoubleDecimalConverter(); + } + if (typeof(T) == typeof(decimal)) + { + return (IDecimalConverter)new DecimalDecimalConverter(); + } + throw new NotSupportedException(); + } + } + internal class ByteDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(byte value) + { + return (decimal)value; + } + } + internal class SByteDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(sbyte value) + { + return (decimal)value; + } + } + internal class ShortDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(short value) + { + return (decimal)value; + } + } + internal class UShortDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(ushort value) + { + return (decimal)value; + } + } + internal class IntDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(int value) + { + return (decimal)value; + } + } + internal class UIntDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(uint value) + { + return (decimal)value; + } + } + internal class LongDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(long value) + { + return (decimal)value; + } + } + internal class ULongDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(ulong value) + { + return (decimal)value; + } + } + internal class FloatDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(float value) + { + return (decimal)value; + } + } + internal class DoubleDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(double value) + { + return (decimal)value; + } + } + internal class DecimalDecimalConverter : IDecimalConverter + { + public decimal GetDecimal(decimal value) + { + return (decimal)value; + } + } +} diff --git a/src/Microsoft.Data.Analysis/Converters.tt b/src/Microsoft.Data.Analysis/Converters.tt new file mode 100644 index 0000000000..c21661f75e --- /dev/null +++ b/src/Microsoft.Data.Analysis/Converters.tt @@ -0,0 +1,84 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from Converters.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ +<# + foreach (var typeToLevel in primitiveTypeToPrimitivityLevelMap) + { + string type = typeToLevel.Key; + int level = typeToLevel.Value; + string typeFirstCharUpper = GetCapitalizedPrimitiveTypes(type); +#> + internal interface I<#=typeFirstCharUpper#>Converter + { + <#=type#> Get<#=typeFirstCharUpper#>(T value); + } + internal static class <#=typeFirstCharUpper#>Converter + { + public static I<#=typeFirstCharUpper#>Converter Instance { get; } = <#=typeFirstCharUpper#>Converter.Get<#=typeFirstCharUpper#>Converter(); + } + internal static class <#=typeFirstCharUpper#>Converter + { + public static I<#=typeFirstCharUpper#>Converter Get<#=typeFirstCharUpper#>Converter() + { +<# + foreach (var typeLoop in primitiveTypeToPrimitivityLevelMap) + { + int loopLevel = typeLoop.Value; + if (loopLevel > level) + { + continue; + } +#> + if (typeof(T) == typeof(<#=typeLoop.Key#>)) + { +<# + string capitalizedLoopPrimitive = GetCapitalizedPrimitiveTypes(typeLoop.Key); +#> + return (I<#=typeFirstCharUpper#>Converter)new <#=capitalizedLoopPrimitive#><#=typeFirstCharUpper#>Converter(); + } +<# + } +#> + throw new NotSupportedException(); + } + } +<# + // Generate the individual type converter classes + foreach (var typeLoop in primitiveTypeToPrimitivityLevelMap) + { + int loopLevel = typeLoop.Value; + if (loopLevel > level) + { + continue; + } + string capitalizedLoopPrimitive = GetCapitalizedPrimitiveTypes(typeLoop.Key); +#> + internal class <#=capitalizedLoopPrimitive#><#=typeFirstCharUpper#>Converter : I<#=typeFirstCharUpper#>Converter<<#=typeLoop.Key#>> + { + public <#=type#> Get<#=typeFirstCharUpper#>(<#=typeLoop.Key#> value) + { + return (<#=type#>)value; + } + } +<# + } +#> +<# + } +#> +} diff --git a/src/Microsoft.Data.Analysis/DecimalConverter.cs b/src/Microsoft.Data.Analysis/DecimalConverter.cs deleted file mode 100644 index 97240969b0..0000000000 --- a/src/Microsoft.Data.Analysis/DecimalConverter.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Microsoft.Data.Analysis -{ - internal interface IDecimalConverter - { - decimal GetDecimal(T value); - } - internal static class DecimalConverter - { - public static IDecimalConverter Instance { get; } = DecimalConverter.GetDecimalConverter(); - } - internal static class DecimalConverter - { - public static IDecimalConverter GetDecimalConverter() - { - if (typeof(T) == typeof(bool)) - { - throw new NotImplementedException(); - } - else if (typeof(T) == typeof(byte)) - { - return (IDecimalConverter)new ByteDecimalConverter(); - } - else if (typeof(T) == typeof(char)) - { - return (IDecimalConverter)new CharDecimalConverter(); - } - else if (typeof(T) == typeof(decimal)) - { - return (IDecimalConverter)new DecimalDecimalConverter(); - } - else if (typeof(T) == typeof(double)) - { - return (IDecimalConverter)new DoubleDecimalConverter(); - } - else if (typeof(T) == typeof(float)) - { - return (IDecimalConverter)new FloatDecimalConverter(); - } - else if (typeof(T) == typeof(int)) - { - return (IDecimalConverter)new IntDecimalConverter(); - } - else if (typeof(T) == typeof(long)) - { - return (IDecimalConverter)new LongDecimalConverter(); - } - else if (typeof(T) == typeof(sbyte)) - { - return (IDecimalConverter)new SByteDecimalConverter(); - } - else if (typeof(T) == typeof(short)) - { - return (IDecimalConverter)new ShortDecimalConverter(); - } - else if (typeof(T) == typeof(uint)) - { - return (IDecimalConverter)new UIntDecimalConverter(); - } - else if (typeof(T) == typeof(ulong)) - { - return (IDecimalConverter)new ULongDecimalConverter(); - } - else if (typeof(T) == typeof(ushort)) - { - return (IDecimalConverter)new UShortDecimalConverter(); - } - throw new NotSupportedException(); - } - } - - internal class ByteDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(byte value) - { - return value; - } - } - - internal class CharDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(char value) - { - return value; - } - } - - internal class DecimalDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(decimal value) - { - return value; - } - } - - internal class DoubleDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(double value) - { - return (decimal)value; - } - } - - internal class FloatDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(float value) - { - return (decimal)value; - } - } - - internal class IntDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(int value) - { - return value; - } - } - - internal class LongDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(long value) - { - return value; - } - } - - internal class SByteDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(sbyte value) - { - return value; - } - } - - internal class ShortDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(short value) - { - return value; - } - } - - internal class UIntDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(uint value) - { - return value; - } - } - - internal class ULongDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(ulong value) - { - return value; - } - } - - internal class UShortDecimalConverter : IDecimalConverter - { - public decimal GetDecimal(ushort value) - { - return value; - } - } -} diff --git a/src/Microsoft.Data.Analysis/DecimalDataFrameColumn.cs b/src/Microsoft.Data.Analysis/DecimalDataFrameColumn.cs new file mode 100644 index 0000000000..b0b4fafd04 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DecimalDataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class DecimalDataFrameColumn : PrimitiveDataFrameColumn + { + public DecimalDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public DecimalDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public DecimalDataFrameColumn(string name, long length = 0) : base(name, length) { } + + public DecimalDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal DecimalDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/DoubleConverter.cs b/src/Microsoft.Data.Analysis/DoubleConverter.cs deleted file mode 100644 index 399c3ffb25..0000000000 --- a/src/Microsoft.Data.Analysis/DoubleConverter.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Microsoft.Data.Analysis -{ - internal interface IDoubleConverter - { - double GetDouble(T value); - } - internal static class DoubleConverter - { - public static IDoubleConverter Instance { get; } = DoubleConverter.GetDoubleConverter(); - } - internal static class DoubleConverter - { - public static IDoubleConverter GetDoubleConverter() - { - if (typeof(T) == typeof(bool)) - { - throw new NotImplementedException(); - } - else if (typeof(T) == typeof(byte)) - { - return (IDoubleConverter)new ByteDoubleConverter(); - } - else if (typeof(T) == typeof(char)) - { - return (IDoubleConverter)new CharDoubleConverter(); - } - else if (typeof(T) == typeof(decimal)) - { - throw new NotImplementedException(); - } - else if (typeof(T) == typeof(double)) - { - return (IDoubleConverter)new DoubleDoubleConverter(); - } - else if (typeof(T) == typeof(float)) - { - return (IDoubleConverter)new FloatDoubleConverter(); - } - else if (typeof(T) == typeof(int)) - { - return (IDoubleConverter)new IntDoubleConverter(); - } - else if (typeof(T) == typeof(long)) - { - return (IDoubleConverter)new LongDoubleConverter(); - } - else if (typeof(T) == typeof(sbyte)) - { - return (IDoubleConverter)new SByteDoubleConverter(); - } - else if (typeof(T) == typeof(short)) - { - return (IDoubleConverter)new ShortDoubleConverter(); - } - else if (typeof(T) == typeof(uint)) - { - return (IDoubleConverter)new UIntDoubleConverter(); - } - else if (typeof(T) == typeof(ulong)) - { - return (IDoubleConverter)new ULongDoubleConverter(); - } - else if (typeof(T) == typeof(ushort)) - { - return (IDoubleConverter)new UShortDoubleConverter(); - } - throw new NotSupportedException(); - } - } - - internal class ByteDoubleConverter : IDoubleConverter - { - public double GetDouble(byte value) - { - return value; - } - } - - internal class CharDoubleConverter : IDoubleConverter - { - public double GetDouble(char value) - { - return value; - } - } - - internal class DoubleDoubleConverter : IDoubleConverter - { - public double GetDouble(double value) - { - return value; - } - } - - internal class FloatDoubleConverter : IDoubleConverter - { - public double GetDouble(float value) - { - return value; - } - } - - internal class IntDoubleConverter : IDoubleConverter - { - public double GetDouble(int value) - { - return value; - } - } - - internal class LongDoubleConverter : IDoubleConverter - { - public double GetDouble(long value) - { - return value; - } - } - - internal class SByteDoubleConverter : IDoubleConverter - { - public double GetDouble(sbyte value) - { - return value; - } - } - - internal class ShortDoubleConverter : IDoubleConverter - { - public double GetDouble(short value) - { - return value; - } - } - - internal class UIntDoubleConverter : IDoubleConverter - { - public double GetDouble(uint value) - { - return value; - } - } - - internal class ULongDoubleConverter : IDoubleConverter - { - public double GetDouble(ulong value) - { - return value; - } - } - - internal class UShortDoubleConverter : IDoubleConverter - { - public double GetDouble(ushort value) - { - return value; - } - } -} diff --git a/src/Microsoft.Data.Analysis/DoubleDataFrameColumn.cs b/src/Microsoft.Data.Analysis/DoubleDataFrameColumn.cs new file mode 100644 index 0000000000..6a97300376 --- /dev/null +++ b/src/Microsoft.Data.Analysis/DoubleDataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class DoubleDataFrameColumn : PrimitiveDataFrameColumn + { + public DoubleDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public DoubleDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public DoubleDataFrameColumn(string name, long length = 0) : base(name, length) { } + + public DoubleDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal DoubleDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/Int16DataFrameColumn.cs b/src/Microsoft.Data.Analysis/Int16DataFrameColumn.cs new file mode 100644 index 0000000000..79893b1899 --- /dev/null +++ b/src/Microsoft.Data.Analysis/Int16DataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class Int16DataFrameColumn : PrimitiveDataFrameColumn + { + public Int16DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public Int16DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public Int16DataFrameColumn(string name, long length = 0) : base(name, length) { } + + public Int16DataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal Int16DataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/Int32DataFrameColumn.cs b/src/Microsoft.Data.Analysis/Int32DataFrameColumn.cs new file mode 100644 index 0000000000..91b15764cd --- /dev/null +++ b/src/Microsoft.Data.Analysis/Int32DataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class Int32DataFrameColumn : PrimitiveDataFrameColumn + { + public Int32DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public Int32DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public Int32DataFrameColumn(string name, long length = 0) : base(name, length) { } + + public Int32DataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal Int32DataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/Int64DataFrameColumn.cs b/src/Microsoft.Data.Analysis/Int64DataFrameColumn.cs new file mode 100644 index 0000000000..f955404152 --- /dev/null +++ b/src/Microsoft.Data.Analysis/Int64DataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class Int64DataFrameColumn : PrimitiveDataFrameColumn + { + public Int64DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public Int64DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public Int64DataFrameColumn(string name, long length = 0) : base(name, length) { } + + public Int64DataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal Int64DataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 71490c0883..7071a50700 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -11,6 +11,14 @@ Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration + + + + True + True + Converters.tt + + @@ -22,6 +30,14 @@ + + TextTemplatingFileGenerator + Converters.cs + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperations.ExplodedColumns.cs + TextTemplatingFileGenerator DataFrameColumn.BinaryOperations.cs @@ -50,10 +66,23 @@ TextTemplatingFileGenerator ColumnArithmeticTemplate.cs + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude + + + True + True + PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt + TextTemplatingFileGenerator PrimitiveDataFrameColumn.BinaryOperations.cs + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperators.cs + TextTemplatingFileGenerator PrimitiveDataFrameColumn.Computations.cs @@ -89,6 +118,16 @@ + + True + True + ColumnArithmeticTemplate.ttinclude + + + True + True + Converters.tt + True True @@ -124,6 +163,11 @@ True PrimitiveDataFrameColumn.BinaryOperations.tt + + True + True + PrimitiveDataFrameColumn.BinaryOperators.tt + True True diff --git a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs index 767200a818..45521c137e 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs @@ -617,6 +617,46 @@ internal PrimitiveColumnContainer CloneAsBoolContainer() return ret; } + internal PrimitiveColumnContainer CloneAsByteContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(ByteConverter.Instance.GetByte(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsSByteContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(SByteConverter.Instance.GetSByte(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + internal PrimitiveColumnContainer CloneAsDoubleContainer() { var ret = new PrimitiveColumnContainer(); @@ -656,5 +696,145 @@ internal PrimitiveColumnContainer CloneAsDecimalContainer() ret.NullCount = NullCount; return ret; } + + internal PrimitiveColumnContainer CloneAsShortContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(ShortConverter.Instance.GetShort(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsUShortContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(UShortConverter.Instance.GetUShort(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsIntContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(IntConverter.Instance.GetInt(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsUIntContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(UIntConverter.Instance.GetUInt(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsLongContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(LongConverter.Instance.GetLong(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsULongContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(ULongConverter.Instance.GetULong(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } + + internal PrimitiveColumnContainer CloneAsFloatContainer() + { + var ret = new PrimitiveColumnContainer(); + foreach (ReadOnlyDataFrameBuffer buffer in Buffers) + { + ret.Length += buffer.Length; + DataFrameBuffer newBuffer = new DataFrameBuffer(); + ret.Buffers.Add(newBuffer); + newBuffer.EnsureCapacity(buffer.Length); + ReadOnlySpan span = buffer.ReadOnlySpan; + for (int i = 0; i < span.Length; i++) + { + newBuffer.Append(FloatConverter.Instance.GetFloat(span[i])); + } + } + ret.NullBitMapBuffers = CloneNullBitMapBuffers(); + ret.NullCount = NullCount; + return ret; + } } } diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs index cf6e6d2b8f..18a9903342 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs @@ -429,22 +429,77 @@ public PrimitiveDataFrameColumn Clone(IEnumerable mapIndices) return ret; } - internal PrimitiveDataFrameColumn CloneAsBoolColumn() + internal BooleanDataFrameColumn CloneAsBoolColumn() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsBoolContainer(); - return new PrimitiveDataFrameColumn(Name, newColumnContainer); + return new BooleanDataFrameColumn(Name, newColumnContainer); } - internal PrimitiveDataFrameColumn CloneAsDoubleColumn() + internal ByteDataFrameColumn CloneAsByteColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsByteContainer(); + return new ByteDataFrameColumn(Name, newColumnContainer); + } + + internal SByteDataFrameColumn CloneAsSByteColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsSByteContainer(); + return new SByteDataFrameColumn(Name, newColumnContainer); + } + + internal DoubleDataFrameColumn CloneAsDoubleColumn() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsDoubleContainer(); - return new PrimitiveDataFrameColumn(Name, newColumnContainer); + return new DoubleDataFrameColumn(Name, newColumnContainer); } - internal PrimitiveDataFrameColumn CloneAsDecimalColumn() + internal DecimalDataFrameColumn CloneAsDecimalColumn() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsDecimalContainer(); - return new PrimitiveDataFrameColumn(Name, newColumnContainer); + return new DecimalDataFrameColumn(Name, newColumnContainer); + } + + internal Int16DataFrameColumn CloneAsShortColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsShortContainer(); + return new Int16DataFrameColumn(Name, newColumnContainer); + } + + + internal UInt16DataFrameColumn CloneAsUShortColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsUShortContainer(); + return new UInt16DataFrameColumn(Name, newColumnContainer); + } + + internal Int32DataFrameColumn CloneAsIntColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsIntContainer(); + return new Int32DataFrameColumn(Name, newColumnContainer); + } + + internal UInt32DataFrameColumn CloneAsUIntColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsUIntContainer(); + return new UInt32DataFrameColumn(Name, newColumnContainer); + } + + internal Int64DataFrameColumn CloneAsLongColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsLongContainer(); + return new Int64DataFrameColumn(Name, newColumnContainer); + } + + internal UInt64DataFrameColumn CloneAsULongColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsULongContainer(); + return new UInt64DataFrameColumn(Name, newColumnContainer); + } + + internal SingleDataFrameColumn CloneAsFloatColumn() + { + PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsFloatContainer(); + return new SingleDataFrameColumn(Name, newColumnContainer); } public override GroupBy GroupBy(int columnIndex, DataFrame parent) diff --git a/src/Microsoft.Data.Analysis/SByteDataFrameColumn.cs b/src/Microsoft.Data.Analysis/SByteDataFrameColumn.cs new file mode 100644 index 0000000000..731614da72 --- /dev/null +++ b/src/Microsoft.Data.Analysis/SByteDataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class SByteDataFrameColumn : PrimitiveDataFrameColumn + { + public SByteDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public SByteDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public SByteDataFrameColumn(string name, long length = 0) : base(name, length) { } + + public SByteDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal SByteDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/SingleDataFrameColumn.cs b/src/Microsoft.Data.Analysis/SingleDataFrameColumn.cs new file mode 100644 index 0000000000..e6be6255d0 --- /dev/null +++ b/src/Microsoft.Data.Analysis/SingleDataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class SingleDataFrameColumn : PrimitiveDataFrameColumn + { + public SingleDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public SingleDataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public SingleDataFrameColumn(string name, long length = 0) : base(name, length) { } + + public SingleDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal SingleDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/UInt16DataFrameColumn.cs b/src/Microsoft.Data.Analysis/UInt16DataFrameColumn.cs new file mode 100644 index 0000000000..e56cdca7f3 --- /dev/null +++ b/src/Microsoft.Data.Analysis/UInt16DataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class UInt16DataFrameColumn : PrimitiveDataFrameColumn + { + public UInt16DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public UInt16DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public UInt16DataFrameColumn(string name, long length = 0) : base(name, length) { } + + public UInt16DataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal UInt16DataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/UInt32DataFrameColumn.cs b/src/Microsoft.Data.Analysis/UInt32DataFrameColumn.cs new file mode 100644 index 0000000000..af114ff41e --- /dev/null +++ b/src/Microsoft.Data.Analysis/UInt32DataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class UInt32DataFrameColumn : PrimitiveDataFrameColumn + { + public UInt32DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public UInt32DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public UInt32DataFrameColumn(string name, long length = 0) : base(name, length) { } + + public UInt32DataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal UInt32DataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/src/Microsoft.Data.Analysis/UInt64DataFrameColumn.cs b/src/Microsoft.Data.Analysis/UInt64DataFrameColumn.cs new file mode 100644 index 0000000000..cb74704319 --- /dev/null +++ b/src/Microsoft.Data.Analysis/UInt64DataFrameColumn.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class UInt64DataFrameColumn : PrimitiveDataFrameColumn + { + public UInt64DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public UInt64DataFrameColumn(string name, IEnumerable values) : base(name, values) { } + + public UInt64DataFrameColumn(string name, long length = 0) : base(name, length) { } + + public UInt64DataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { } + + internal UInt64DataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { } + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index bdf383425e..f715dfa17d 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -16,8 +16,8 @@ public partial class DataFrameTests { public static DataFrame MakeDataFrameWithTwoColumns(int length, bool withNulls = true) { - DataFrameColumn dataFrameColumn1 = new PrimitiveDataFrameColumn("Int1", Enumerable.Range(0, length).Select(x => x)); - DataFrameColumn dataFrameColumn2 = new PrimitiveDataFrameColumn("Int2", Enumerable.Range(10, length).Select(x => x)); + DataFrameColumn dataFrameColumn1 = new Int32DataFrameColumn("Int1", Enumerable.Range(0, length).Select(x => x)); + DataFrameColumn dataFrameColumn2 = new Int32DataFrameColumn("Int2", Enumerable.Range(10, length).Select(x => x)); if (withNulls) { dataFrameColumn1[length / 2] = null; @@ -83,7 +83,7 @@ public static DataFrame MakeDataFrameWithAllColumnTypes(int length, bool withNul public static DataFrame MakeDataFrameWithAllMutableColumnTypes(int length, bool withNulls = true) { DataFrame df = MakeDataFrameWithNumericAndStringColumns(length, withNulls); - DataFrameColumn boolColumn = new PrimitiveDataFrameColumn("Bool", Enumerable.Range(0, length).Select(x => x % 2 == 0)); + DataFrameColumn boolColumn = new BooleanDataFrameColumn("Bool", Enumerable.Range(0, length).Select(x => x % 2 == 0)); df.Columns.Insert(df.Columns.Count, boolColumn); if (withNulls) { @@ -95,7 +95,7 @@ public static DataFrame MakeDataFrameWithAllMutableColumnTypes(int length, bool public static DataFrame MakeDataFrameWithNumericAndBoolColumns(int length) { DataFrame df = MakeDataFrameWithNumericColumns(length); - DataFrameColumn boolColumn = new PrimitiveDataFrameColumn("Bool", Enumerable.Range(0, length).Select(x => x % 2 == 0)); + DataFrameColumn boolColumn = new BooleanDataFrameColumn("Bool", Enumerable.Range(0, length).Select(x => x % 2 == 0)); df.Columns.Insert(df.Columns.Count, boolColumn); boolColumn[length / 2] = null; return df; @@ -104,14 +104,14 @@ public static DataFrame MakeDataFrameWithNumericAndBoolColumns(int length) public static DataFrame MakeDataFrameWithNumericAndStringColumns(int length, bool withNulls = true) { DataFrame df = MakeDataFrameWithNumericColumns(length, withNulls); - DataFrameColumn stringColumn = DataFrameColumn.Create("String", Enumerable.Range(0, length).Select(x => x.ToString())); + DataFrameColumn stringColumn = new StringDataFrameColumn("String", Enumerable.Range(0, length).Select(x => x.ToString())); df.Columns.Insert(df.Columns.Count, stringColumn); if (withNulls) { stringColumn[length / 2] = null; } - DataFrameColumn charColumn = DataFrameColumn.Create("Char", Enumerable.Range(0, length).Select(x => (char)(x + 65))); + DataFrameColumn charColumn = new CharDataFrameColumn("Char", Enumerable.Range(0, length).Select(x => (char)(x + 65))); df.Columns.Insert(df.Columns.Count, charColumn); if (withNulls) { @@ -122,17 +122,17 @@ public static DataFrame MakeDataFrameWithNumericAndStringColumns(int length, boo public static DataFrame MakeDataFrameWithNumericColumns(int length, bool withNulls = true) { - DataFrameColumn byteColumn = DataFrameColumn.Create("Byte", Enumerable.Range(0, length).Select(x => (byte)x)); - DataFrameColumn decimalColumn = DataFrameColumn.Create("Decimal", Enumerable.Range(0, length).Select(x => (decimal)x)); - DataFrameColumn doubleColumn = DataFrameColumn.Create("Double", Enumerable.Range(0, length).Select(x => (double)x)); - DataFrameColumn floatColumn = DataFrameColumn.Create("Float", Enumerable.Range(0, length).Select(x => (float)x)); - DataFrameColumn intColumn = DataFrameColumn.Create("Int", Enumerable.Range(0, length).Select(x => x)); - DataFrameColumn longColumn = DataFrameColumn.Create("Long", Enumerable.Range(0, length).Select(x => (long)x)); - DataFrameColumn sbyteColumn = DataFrameColumn.Create("Sbyte", Enumerable.Range(0, length).Select(x => (sbyte)x)); - DataFrameColumn shortColumn = DataFrameColumn.Create("Short", Enumerable.Range(0, length).Select(x => (short)x)); - DataFrameColumn uintColumn = DataFrameColumn.Create("Uint", Enumerable.Range(0, length).Select(x => (uint)x)); - DataFrameColumn ulongColumn = DataFrameColumn.Create("Ulong", Enumerable.Range(0, length).Select(x => (ulong)x)); - DataFrameColumn ushortColumn = DataFrameColumn.Create("Ushort", Enumerable.Range(0, length).Select(x => (ushort)x)); + DataFrameColumn byteColumn = new ByteDataFrameColumn("Byte", Enumerable.Range(0, length).Select(x => (byte)x)); + DataFrameColumn decimalColumn = new DecimalDataFrameColumn("Decimal", Enumerable.Range(0, length).Select(x => (decimal)x)); + DataFrameColumn doubleColumn = new DoubleDataFrameColumn("Double", Enumerable.Range(0, length).Select(x => (double)x)); + DataFrameColumn floatColumn = new SingleDataFrameColumn("Float", Enumerable.Range(0, length).Select(x => (float)x)); + DataFrameColumn intColumn = new Int32DataFrameColumn("Int", Enumerable.Range(0, length).Select(x => x)); + DataFrameColumn longColumn = new Int64DataFrameColumn("Long", Enumerable.Range(0, length).Select(x => (long)x)); + DataFrameColumn sbyteColumn = new SByteDataFrameColumn("Sbyte", Enumerable.Range(0, length).Select(x => (sbyte)x)); + DataFrameColumn shortColumn = new Int16DataFrameColumn("Short", Enumerable.Range(0, length).Select(x => (short)x)); + DataFrameColumn uintColumn = new UInt32DataFrameColumn("Uint", Enumerable.Range(0, length).Select(x => (uint)x)); + DataFrameColumn ulongColumn = new UInt64DataFrameColumn("Ulong", Enumerable.Range(0, length).Select(x => (ulong)x)); + DataFrameColumn ushortColumn = new UInt16DataFrameColumn("Ushort", Enumerable.Range(0, length).Select(x => (ushort)x)); DataFrame dataFrame = new DataFrame(new List { byteColumn, decimalColumn, doubleColumn, floatColumn, intColumn, longColumn, sbyteColumn, shortColumn, uintColumn, ulongColumn, ushortColumn }); @@ -197,7 +197,7 @@ public void TestIndexer() var row = dataFrame.Rows[4]; Assert.Equal(14, (int)row[1]); - var column = dataFrame["Int2"] as PrimitiveDataFrameColumn; + var column = dataFrame["Int2"] as Int32DataFrameColumn; Assert.Equal(1000, (int)column[2]); Assert.Throws(() => dataFrame["Int5"]); @@ -206,8 +206,8 @@ public void TestIndexer() [Fact] public void ColumnAndTableCreationTest() { - DataFrameColumn intColumn = new PrimitiveDataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); - DataFrameColumn floatColumn = new PrimitiveDataFrameColumn("FloatColumn", Enumerable.Range(0, 10).Select(x => (float)x)); + DataFrameColumn intColumn = new Int32DataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); + DataFrameColumn floatColumn = new SingleDataFrameColumn("FloatColumn", Enumerable.Range(0, 10).Select(x => (float)x)); DataFrame dataFrame = new DataFrame(); dataFrame.Columns.Insert(0, intColumn); dataFrame.Columns.Insert(1, floatColumn); @@ -218,17 +218,17 @@ public void ColumnAndTableCreationTest() Assert.Equal(10, dataFrame.Columns[1].Length); Assert.Equal("FloatColumn", dataFrame.Columns[1].Name); - DataFrameColumn bigColumn = new PrimitiveDataFrameColumn("BigColumn", Enumerable.Range(0, 11).Select(x => (float)x)); - DataFrameColumn repeatedName = new PrimitiveDataFrameColumn("FloatColumn", Enumerable.Range(0, 10).Select(x => (float)x)); + DataFrameColumn bigColumn = new SingleDataFrameColumn("BigColumn", Enumerable.Range(0, 11).Select(x => (float)x)); + DataFrameColumn repeatedName = new SingleDataFrameColumn("FloatColumn", Enumerable.Range(0, 10).Select(x => (float)x)); Assert.Throws(() => dataFrame.Columns.Insert(2, bigColumn)); Assert.Throws(() => dataFrame.Columns.Insert(2, repeatedName)); Assert.Throws(() => dataFrame.Columns.Insert(10, repeatedName)); Assert.Equal(2, dataFrame.Columns.Count); - DataFrameColumn intColumnCopy = new PrimitiveDataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); + DataFrameColumn intColumnCopy = new Int32DataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); Assert.Throws(() => dataFrame.Columns[1] = intColumnCopy); - DataFrameColumn differentIntColumn = new PrimitiveDataFrameColumn("IntColumn1", Enumerable.Range(0, 10).Select(x => x)); + DataFrameColumn differentIntColumn = new Int32DataFrameColumn("IntColumn1", Enumerable.Range(0, 10).Select(x => x)); dataFrame.Columns[1] = differentIntColumn; Assert.True(object.ReferenceEquals(differentIntColumn, dataFrame.Columns[1])); @@ -247,7 +247,7 @@ public void ColumnAndTableCreationTest() public void InsertAndRemoveColumnTests() { DataFrame dataFrame = MakeDataFrameWithAllMutableColumnTypes(10); - DataFrameColumn intColumn = new PrimitiveDataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); + DataFrameColumn intColumn = new Int32DataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); DataFrameColumn charColumn = dataFrame["Char"]; int insertedIndex = dataFrame.Columns.Count; dataFrame.Columns.Insert(dataFrame.Columns.Count, intColumn); @@ -390,7 +390,7 @@ public void TestBinaryOperationsWithConversions() // int + bool should throw Assert.Throws(() => df.Add(true)); - var dataFrameColumn1 = new PrimitiveDataFrameColumn("Double1", Enumerable.Range(0, 10).Select(x => (double)x)); + var dataFrameColumn1 = new DoubleDataFrameColumn("Double1", Enumerable.Range(0, 10).Select(x => (double)x)); df.Columns[0] = dataFrameColumn1; // Double + comparison ops should throw Assert.Throws(() => df.And(true)); @@ -400,8 +400,8 @@ public void TestBinaryOperationsWithConversions() public void TestBinaryOperationsOnBoolColumn() { var df = new DataFrame(); - var dataFrameColumn1 = new PrimitiveDataFrameColumn("Bool1", Enumerable.Range(0, 10).Select(x => true)); - var dataFrameColumn2 = new PrimitiveDataFrameColumn("Bool2", Enumerable.Range(0, 10).Select(x => true)); + var dataFrameColumn1 = new BooleanDataFrameColumn("Bool1", Enumerable.Range(0, 10).Select(x => true)); + var dataFrameColumn2 = new BooleanDataFrameColumn("Bool2", Enumerable.Range(0, 10).Select(x => true)); df.Columns.Insert(0, dataFrameColumn1); df.Columns.Insert(1, dataFrameColumn2); @@ -623,8 +623,8 @@ public void TestBinaryOperatorsWithConversions() public void TestBinaryOperatorsOnBoolColumns() { var df = new DataFrame(); - var dataFrameColumn1 = new PrimitiveDataFrameColumn("Bool1", Enumerable.Range(0, 10).Select(x => x % 2 == 0 ? true : false)); - var dataFrameColumn2 = new PrimitiveDataFrameColumn("Bool2", Enumerable.Range(0, 10).Select(x => x % 2 == 0 ? true : false)); + var dataFrameColumn1 = new BooleanDataFrameColumn("Bool1", Enumerable.Range(0, 10).Select(x => x % 2 == 0 ? true : false)); + var dataFrameColumn2 = new BooleanDataFrameColumn("Bool2", Enumerable.Range(0, 10).Select(x => x % 2 == 0 ? true : false)); df.Columns.Insert(0, dataFrameColumn1); df.Columns.Insert(1, dataFrameColumn2); @@ -668,7 +668,7 @@ public void TestBinaryOperatorsOnBoolColumns() [Fact] public void TestBinaryOperationsOnColumns() { - PrimitiveDataFrameColumn column = new PrimitiveDataFrameColumn("Int", Enumerable.Range(0, 10)); + Int32DataFrameColumn column = new Int32DataFrameColumn("Int", Enumerable.Range(0, 10)); Assert.ThrowsAny(() => column.Add(5.5, inPlace: true)); Assert.ThrowsAny(() => column.ReverseAdd(5.5, inPlace: true)); string str = "A String"; @@ -679,7 +679,7 @@ public void TestBinaryOperationsOnColumns() [Fact] public void TestColumnReverseOrderState() { - var column = new PrimitiveDataFrameColumn("Int", Enumerable.Range(0, 10)); + var column = new Int32DataFrameColumn("Int", Enumerable.Range(0, 10)); var newColumn = 1 - column; var checkOrderColumn = 1 - newColumn; Assert.True(checkOrderColumn.ElementwiseEquals(column).All()); @@ -935,13 +935,13 @@ public void TestStringColumnSort() public void TestPrimitiveColumnSort(int numberOfNulls) { // Primitive Column Sort - PrimitiveDataFrameColumn intColumn = new PrimitiveDataFrameColumn("Int", 0); + Int32DataFrameColumn intColumn = new Int32DataFrameColumn("Int", 0); Assert.Equal(0, intColumn.NullCount); intColumn.AppendMany(null, numberOfNulls); Assert.Equal(numberOfNulls, intColumn.NullCount); // Should handle all nulls - PrimitiveDataFrameColumn sortedIntColumn = intColumn.Sort() as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn sortedIntColumn = intColumn.Sort(); Assert.Equal(numberOfNulls, sortedIntColumn.NullCount); Assert.Null(sortedIntColumn[0]); @@ -952,19 +952,19 @@ public void TestPrimitiveColumnSort(int numberOfNulls) Assert.Equal(numberOfNulls, intColumn.NullCount); // Ascending sort - sortedIntColumn = intColumn.Sort() as PrimitiveDataFrameColumn; + sortedIntColumn = intColumn.Sort(); Assert.Equal(0, sortedIntColumn[0]); Assert.Null(sortedIntColumn[9]); // Descending sort - sortedIntColumn = intColumn.Sort(false) as PrimitiveDataFrameColumn; + sortedIntColumn = intColumn.Sort(ascending: false); Assert.Equal(4, sortedIntColumn[0]); Assert.Null(sortedIntColumn[9]); } private void VerifyJoin(DataFrame join, DataFrame left, DataFrame right, JoinAlgorithm joinAlgorithm) { - PrimitiveDataFrameColumn mapIndices = new PrimitiveDataFrameColumn("map", join.Rows.Count); + Int64DataFrameColumn mapIndices = new Int64DataFrameColumn("map", join.Rows.Count); for (long i = 0; i < join.Rows.Count; i++) { mapIndices[i] = i; @@ -1379,7 +1379,7 @@ public void TestIEnumerable() } Assert.Equal("foofoofoofoofoofoofoofoofoo", actualStrings.ToString()); - PrimitiveDataFrameColumn floatColumn = (PrimitiveDataFrameColumn)df["Float"]; + SingleDataFrameColumn floatColumn = (SingleDataFrameColumn)df["Float"]; actualStrings.Clear(); foreach (float? value in floatColumn) { @@ -1394,7 +1394,7 @@ public void TestIEnumerable() } Assert.Equal("012346789", actualStrings.ToString()); - PrimitiveDataFrameColumn intColumn = (PrimitiveDataFrameColumn)df["Int"]; + Int32DataFrameColumn intColumn = (Int32DataFrameColumn)df["Int"]; actualStrings.Clear(); foreach (int? value in intColumn) { @@ -1808,7 +1808,7 @@ public void TestValueCounts() public void TestApplyElementwiseNullCount() { DataFrame df = MakeDataFrameWithTwoColumns(10); - PrimitiveDataFrameColumn column = df["Int1"] as PrimitiveDataFrameColumn; + Int32DataFrameColumn column = df["Int1"] as Int32DataFrameColumn; Assert.Equal(1, column.NullCount); // Change all existing values to null @@ -1850,7 +1850,7 @@ public void TestClone(int dfLength, int intDfLength) { DataFrame df = MakeDataFrameWithAllColumnTypes(dfLength, withNulls: true); DataFrame intDf = MakeDataFrameWithTwoColumns(intDfLength, false); - PrimitiveDataFrameColumn intColumn = intDf["Int1"] as PrimitiveDataFrameColumn; + Int32DataFrameColumn intColumn = intDf["Int1"] as Int32DataFrameColumn; DataFrame clone = df[intColumn]; Assert.Equal(intDfLength, clone.Rows.Count); Assert.Equal(df.Columns.Count, clone.Columns.Count); @@ -1869,7 +1869,7 @@ public void TestClone(int dfLength, int intDfLength) public void TestColumnCreationFromExisitingColumn() { DataFrame df = MakeDataFrameWithAllColumnTypes(10); - PrimitiveDataFrameColumn bigInts = new PrimitiveDataFrameColumn("BigInts", df["Int"].ElementwiseGreaterThan(5)); + BooleanDataFrameColumn bigInts = new BooleanDataFrameColumn("BigInts", df["Int"].ElementwiseGreaterThan(5)); for (int i = 0; i < 10; i++) { if (i <= 5) @@ -2126,7 +2126,7 @@ public void TestAppendEmptyValue() public void TestApply() { int[] values = { 1, 2, 3, 4, 5 }; - var col = new PrimitiveDataFrameColumn("Ints", values); + var col = new Int32DataFrameColumn("Ints", values); PrimitiveDataFrameColumn newCol = col.Apply(i => i + 0.5d); Assert.Equal(values.Length, newCol.Length); @@ -2137,5 +2137,44 @@ public void TestApply() Assert.Equal(newCol[i], values[i] + 0.5d); } } + + [Fact] + public void TestDataFrameCreate() + { + int length = 10; + void AssertLengthTypeAndValues(DataFrameColumn column, Type type) + { + Assert.Equal(column.DataType, type); + Assert.Equal(length, column.Length); + for (long i = 0; i < column.Length; i++) + { + Assert.Equal(i.ToString(), column[i].ToString()); + } + } + DataFrameColumn stringColumn = DataFrameColumn.Create("String", Enumerable.Range(0, length).Select(x => x.ToString())); + AssertLengthTypeAndValues(stringColumn, typeof(string)); + DataFrameColumn byteColumn = DataFrameColumn.Create("Byte", Enumerable.Range(0, length).Select(x => (byte)x)); + AssertLengthTypeAndValues(byteColumn, typeof(byte)); + DataFrameColumn decimalColumn = DataFrameColumn.Create("Decimal", Enumerable.Range(0, length).Select(x => (decimal)x)); + AssertLengthTypeAndValues(decimalColumn, typeof(decimal)); + DataFrameColumn doubleColumn = DataFrameColumn.Create("Double", Enumerable.Range(0, length).Select(x => (double)x)); + AssertLengthTypeAndValues(doubleColumn, typeof(double)); + DataFrameColumn floatColumn = DataFrameColumn.Create("Float", Enumerable.Range(0, length).Select(x => (float)x)); + AssertLengthTypeAndValues(floatColumn, typeof(float)); + DataFrameColumn intColumn = DataFrameColumn.Create("Int", Enumerable.Range(0, length).Select(x => x)); + AssertLengthTypeAndValues(intColumn, typeof(int)); + DataFrameColumn longColumn = DataFrameColumn.Create("Long", Enumerable.Range(0, length).Select(x => (long)x)); + AssertLengthTypeAndValues(longColumn, typeof(long)); + DataFrameColumn sbyteColumn = DataFrameColumn.Create("Sbyte", Enumerable.Range(0, length).Select(x => (sbyte)x)); + AssertLengthTypeAndValues(sbyteColumn, typeof(sbyte)); + DataFrameColumn shortColumn = DataFrameColumn.Create("Short", Enumerable.Range(0, length).Select(x => (short)x)); + AssertLengthTypeAndValues(shortColumn, typeof(short)); + DataFrameColumn uintColumn = DataFrameColumn.Create("Uint", Enumerable.Range(0, length).Select(x => (uint)x)); + AssertLengthTypeAndValues(uintColumn, typeof(uint)); + DataFrameColumn ulongColumn = DataFrameColumn.Create("Ulong", Enumerable.Range(0, length).Select(x => (ulong)x)); + AssertLengthTypeAndValues(ulongColumn, typeof(ulong)); + DataFrameColumn ushortColumn = DataFrameColumn.Create("Ushort", Enumerable.Range(0, length).Select(x => (ushort)x)); + AssertLengthTypeAndValues(ushortColumn, typeof(ushort)); + } } } From 1544c234189198435ef00148a03e3415034b7213 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Mon, 9 Mar 2020 10:16:12 -0700 Subject: [PATCH 20/53] Address remaining concerns from the 2nd DataFrame API Review (#2861) * Move string indexer to Columns * API changes from the 2nd API review * Unit tests * Address comments --- .../ArrowStringDataFrameColumn.cs | 4 +- .../DataFrame.BinaryOperators.cs | 130 ----- .../DataFrame.BinaryOperators.tt | 14 +- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 11 +- src/Microsoft.Data.Analysis/DataFrame.Join.cs | 16 +- src/Microsoft.Data.Analysis/DataFrame.cs | 47 +- .../DataFrameColumn.BinaryOperators.cs | 100 ---- .../DataFrameColumn.BinaryOperators.tt | 2 + .../DataFrameColumn.cs | 18 +- .../DataFrameColumnCollection.cs | 34 ++ src/Microsoft.Data.Analysis/GroupBy.cs | 10 +- .../PrimitiveDataFrameColumn.cs | 36 +- .../StringDataFrameColumn.cs | 4 +- .../ArrowIntegrationTests.cs | 34 +- .../BufferTests.cs | 2 +- .../DataFrame.IOTests.cs | 24 +- .../DataFrameTests.cs | 552 ++++++++---------- 17 files changed, 384 insertions(+), 654 deletions(-) diff --git a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs index 6cb0103a29..c5d825e36d 100644 --- a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs @@ -453,9 +453,9 @@ public override Dictionary> GroupColumnValues() public override DataFrameColumn FillNulls(object value, bool inPlace = false) => throw new NotSupportedException(); - public override DataFrameColumn Clip(U lower, U upper, bool inPlace = false) => throw new NotSupportedException(); + public override DataFrameColumn Clamp(U min, U max, bool inPlace = false) => throw new NotSupportedException(); - public override DataFrameColumn Filter(U lower, U upper) => throw new NotSupportedException(); + public override DataFrameColumn Filter(U min, U max) => throw new NotSupportedException(); protected internal override void AddDataViewColumn(DataViewSchema.Builder builder) { diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs index e55e847409..6b357bba3a 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs @@ -12,16 +12,6 @@ namespace Microsoft.Data.Analysis { public partial class DataFrame { - public static DataFrame operator +(DataFrame df, bool value) - { - return df.Add(value); - } - - public static DataFrame operator +(bool value, DataFrame df) - { - return df.ReverseAdd(value); - } - public static DataFrame operator +(DataFrame df, byte value) { return df.Add(value); @@ -32,16 +22,6 @@ public partial class DataFrame return df.ReverseAdd(value); } - public static DataFrame operator +(DataFrame df, char value) - { - return df.Add(value); - } - - public static DataFrame operator +(char value, DataFrame df) - { - return df.ReverseAdd(value); - } - public static DataFrame operator +(DataFrame df, decimal value) { return df.Add(value); @@ -142,16 +122,6 @@ public partial class DataFrame return df.ReverseAdd(value); } - public static DataFrame operator -(DataFrame df, bool value) - { - return df.Subtract(value); - } - - public static DataFrame operator -(bool value, DataFrame df) - { - return df.ReverseSubtract(value); - } - public static DataFrame operator -(DataFrame df, byte value) { return df.Subtract(value); @@ -162,16 +132,6 @@ public partial class DataFrame return df.ReverseSubtract(value); } - public static DataFrame operator -(DataFrame df, char value) - { - return df.Subtract(value); - } - - public static DataFrame operator -(char value, DataFrame df) - { - return df.ReverseSubtract(value); - } - public static DataFrame operator -(DataFrame df, decimal value) { return df.Subtract(value); @@ -272,16 +232,6 @@ public partial class DataFrame return df.ReverseSubtract(value); } - public static DataFrame operator *(DataFrame df, bool value) - { - return df.Multiply(value); - } - - public static DataFrame operator *(bool value, DataFrame df) - { - return df.ReverseMultiply(value); - } - public static DataFrame operator *(DataFrame df, byte value) { return df.Multiply(value); @@ -292,16 +242,6 @@ public partial class DataFrame return df.ReverseMultiply(value); } - public static DataFrame operator *(DataFrame df, char value) - { - return df.Multiply(value); - } - - public static DataFrame operator *(char value, DataFrame df) - { - return df.ReverseMultiply(value); - } - public static DataFrame operator *(DataFrame df, decimal value) { return df.Multiply(value); @@ -402,16 +342,6 @@ public partial class DataFrame return df.ReverseMultiply(value); } - public static DataFrame operator /(DataFrame df, bool value) - { - return df.Divide(value); - } - - public static DataFrame operator /(bool value, DataFrame df) - { - return df.ReverseDivide(value); - } - public static DataFrame operator /(DataFrame df, byte value) { return df.Divide(value); @@ -422,16 +352,6 @@ public partial class DataFrame return df.ReverseDivide(value); } - public static DataFrame operator /(DataFrame df, char value) - { - return df.Divide(value); - } - - public static DataFrame operator /(char value, DataFrame df) - { - return df.ReverseDivide(value); - } - public static DataFrame operator /(DataFrame df, decimal value) { return df.Divide(value); @@ -532,16 +452,6 @@ public partial class DataFrame return df.ReverseDivide(value); } - public static DataFrame operator %(DataFrame df, bool value) - { - return df.Modulo(value); - } - - public static DataFrame operator %(bool value, DataFrame df) - { - return df.ReverseModulo(value); - } - public static DataFrame operator %(DataFrame df, byte value) { return df.Modulo(value); @@ -552,16 +462,6 @@ public partial class DataFrame return df.ReverseModulo(value); } - public static DataFrame operator %(DataFrame df, char value) - { - return df.Modulo(value); - } - - public static DataFrame operator %(char value, DataFrame df) - { - return df.ReverseModulo(value); - } - public static DataFrame operator %(DataFrame df, decimal value) { return df.Modulo(value); @@ -662,36 +562,6 @@ public partial class DataFrame return df.ReverseModulo(value); } - public static DataFrame operator &(DataFrame df, bool value) - { - return df.And(value); - } - - public static DataFrame operator &(bool value, DataFrame df) - { - return df.ReverseAnd(value, inPlace: false); - } - - public static DataFrame operator |(DataFrame df, bool value) - { - return df.Or(value); - } - - public static DataFrame operator |(bool value, DataFrame df) - { - return df.ReverseOr(value, inPlace: false); - } - - public static DataFrame operator ^(DataFrame df, bool value) - { - return df.Xor(value); - } - - public static DataFrame operator ^(bool value, DataFrame df) - { - return df.ReverseXor(value, inPlace: false); - } - public static DataFrame operator <<(DataFrame df, int value) { return df.LeftShift(value); diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt index 056e1f4b80..27eb67e6ed 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt @@ -21,18 +21,12 @@ namespace Microsoft.Data.Analysis <# foreach (MethodConfiguration method in methodConfiguration) { #> <# if (method.MethodType == MethodType.BinaryScalar) { #> <# if (method.IsBitwise == true) { #> - public static DataFrame operator <#=method.Operator#>(DataFrame df, bool value) - { - return df.<#=method.MethodName#>(value); - } - - public static DataFrame operator <#=method.Operator#>(bool value, DataFrame df) - { - return df.Reverse<#=method.MethodName#>(value, inPlace: false); - } - +<# // There seem to be very few use cases for an API such as df.And/Or/Xor(true). #> +<# continue; #> <# } else { #> <# foreach (TypeConfiguration type in typeConfiguration) { #> +<# if (method.IsNumeric != type.SupportsNumeric) continue; #> +<# if (method.IsNumeric && type.TypeName == "char") continue; #> public static DataFrame operator <#=method.Operator#>(DataFrame df, <#=type.TypeName#> value) { return df.<#=method.MethodName#>(value); diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index 950b6c3700..e3c6dd8e4c 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -90,18 +90,19 @@ private static Type MaxKind(Type a, Type b) /// number of rows to read /// number of rows used to guess types /// add one column with the row index + /// The character encoding. Defaults to UTF8 if not specified /// DataFrame public static DataFrame LoadCsv(string filename, char separator = ',', bool header = true, string[] columnNames = null, Type[] dataTypes = null, int numRows = -1, int guessRows = 10, - bool addIndexColumn = false) + bool addIndexColumn = false, Encoding encoding = null) { using (Stream fileStream = new FileStream(filename, FileMode.Open)) { return LoadCsv(fileStream, separator: separator, header: header, columnNames: columnNames, dataTypes: dataTypes, numberOfRowsToRead: numRows, - guessRows: guessRows, addIndexColumn: addIndexColumn); + guessRows: guessRows, addIndexColumn: addIndexColumn, encoding: encoding); } } @@ -188,11 +189,13 @@ PrimitiveDataFrameColumn CreatePrimitiveDataFrameColumn() /// number of rows to read not including the header(if present) /// number of rows used to guess types /// add one column with the row index + /// The character encoding. Defaults to UTF8 if not specified /// public static DataFrame LoadCsv(Stream csvStream, char separator = ',', bool header = true, string[] columnNames = null, Type[] dataTypes = null, - long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false) + long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false, + Encoding encoding = null) { if (!csvStream.CanSeek) throw new ArgumentException(Strings.NonSeekableStream, nameof(csvStream)); @@ -207,7 +210,7 @@ public static DataFrame LoadCsv(Stream csvStream, List columns; long streamStart = csvStream.Position; // First pass: schema and number of rows. - using (var streamReader = new StreamReader(csvStream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, DefaultStreamReaderBufferSize, leaveOpen: true)) + using (var streamReader = new StreamReader(csvStream, encoding ?? Encoding.UTF8, detectEncodingFromByteOrderMarks: true, DefaultStreamReaderBufferSize, leaveOpen: true)) { string line = null; if (dataTypes == null) diff --git a/src/Microsoft.Data.Analysis/DataFrame.Join.cs b/src/Microsoft.Data.Analysis/DataFrame.Join.cs index dbb0998428..7d51f2293b 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.Join.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.Join.cs @@ -159,11 +159,11 @@ public DataFrame Merge(DataFrame other, string leftJoinColumn, string righ if (joinAlgorithm == JoinAlgorithm.Left) { // First hash other dataframe on the rightJoinColumn - DataFrameColumn otherColumn = other[rightJoinColumn]; + DataFrameColumn otherColumn = other.Columns[rightJoinColumn]; Dictionary> multimap = otherColumn.GroupColumnValues(); // Go over the records in this dataframe and match with the dictionary - DataFrameColumn thisColumn = this[leftJoinColumn]; + DataFrameColumn thisColumn = Columns[leftJoinColumn]; for (long i = 0; i < thisColumn.Length; i++) { @@ -202,10 +202,10 @@ public DataFrame Merge(DataFrame other, string leftJoinColumn, string righ } else if (joinAlgorithm == JoinAlgorithm.Right) { - DataFrameColumn thisColumn = this[leftJoinColumn]; + DataFrameColumn thisColumn = Columns[leftJoinColumn]; Dictionary> multimap = thisColumn.GroupColumnValues(); - DataFrameColumn otherColumn = other[rightJoinColumn]; + DataFrameColumn otherColumn = other.Columns[rightJoinColumn]; for (long i = 0; i < otherColumn.Length; i++) { var otherColumnValue = otherColumn[i]; @@ -246,8 +246,8 @@ public DataFrame Merge(DataFrame other, string leftJoinColumn, string righ long rightRowCount = other.Rows.Count; DataFrame longerDataFrame = leftRowCount <= rightRowCount ? other : this; DataFrame shorterDataFrame = ReferenceEquals(longerDataFrame, this) ? other : this; - DataFrameColumn hashColumn = (leftRowCount <= rightRowCount) ? this[leftJoinColumn] : other[rightJoinColumn]; - DataFrameColumn otherColumn = ReferenceEquals(hashColumn, this[leftJoinColumn]) ? other[rightJoinColumn] : this[leftJoinColumn]; + DataFrameColumn hashColumn = (leftRowCount <= rightRowCount) ? Columns[leftJoinColumn] : other.Columns[rightJoinColumn]; + DataFrameColumn otherColumn = ReferenceEquals(hashColumn, Columns[leftJoinColumn]) ? other.Columns[rightJoinColumn] : Columns[leftJoinColumn]; Dictionary> multimap = hashColumn.GroupColumnValues(); for (long i = 0; i < otherColumn.Length; i++) @@ -282,12 +282,12 @@ public DataFrame Merge(DataFrame other, string leftJoinColumn, string righ } else if (joinAlgorithm == JoinAlgorithm.FullOuter) { - DataFrameColumn otherColumn = other[rightJoinColumn]; + DataFrameColumn otherColumn = other.Columns[rightJoinColumn]; Dictionary> multimap = otherColumn.GroupColumnValues(); Dictionary intersection = new Dictionary(EqualityComparer.Default); // Go over the records in this dataframe and match with the dictionary - DataFrameColumn thisColumn = this[leftJoinColumn]; + DataFrameColumn thisColumn = Columns[leftJoinColumn]; for (long i = 0; i < thisColumn.Length; i++) { diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index faa706b267..178e3286ee 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -83,8 +83,8 @@ public DataFrame(params DataFrameColumn[] columns) /// /// Returns a new DataFrame using the boolean values in filter /// - /// A column of booleans - public DataFrame this[PrimitiveDataFrameColumn filter] => Filter(filter); + /// A column of booleans + public DataFrame this[PrimitiveDataFrameColumn rowFilter] => Filter(rowFilter); /// /// Returns a new DataFrame using the row indices in @@ -123,42 +123,17 @@ public DataFrame this[IEnumerable rowIndices] } /// - /// Returns a new DataFrame using the boolean values in + /// Returns a new DataFrame using the boolean values in /// - public DataFrame this[IEnumerable boolFilter] + public DataFrame this[IEnumerable rowFilter] { get { - PrimitiveDataFrameColumn filterColumn = new PrimitiveDataFrameColumn("Filter", boolFilter); + PrimitiveDataFrameColumn filterColumn = new PrimitiveDataFrameColumn("Filter", rowFilter); return Clone(filterColumn); } } - public DataFrameColumn this[string columnName] - { - get - { - int columnIndex = _columnCollection.IndexOf(columnName); - if (columnIndex == -1) - throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName)); - return _columnCollection[columnIndex]; - } - set - { - int columnIndex = _columnCollection.IndexOf(columnName); - DataFrameColumn newColumn = value; - newColumn.SetName(columnName); - if (columnIndex == -1) - { - _columnCollection.Insert(Columns.Count, newColumn); - } - else - { - _columnCollection[columnIndex] = newColumn; - } - } - } - /// /// Returns the first rows /// @@ -273,12 +248,12 @@ public DataFrame OrderByDescending(string columnName) } /// - /// Clips values beyond the specified thresholds on numeric columns + /// Clamps values beyond the specified thresholds on numeric columns /// /// - /// Minimum value. All values below this threshold will be set to it - /// Maximum value. All values above this threshold will be set to it - public DataFrame Clip(U lower, U upper, bool inPlace = false) + /// Minimum value. All values below this threshold will be set to it + /// Maximum value. All values above this threshold will be set to it + public DataFrame Clamp(U min, U max, bool inPlace = false) { DataFrame ret = inPlace ? this : Clone(); @@ -286,7 +261,7 @@ public DataFrame Clip(U lower, U upper, bool inPlace = false) { DataFrameColumn column = ret.Columns[i]; if (column.IsNumericColumn()) - column.Clip(lower, upper, inPlace: true); + column.Clamp(min, max, inPlace: true); } return ret; } @@ -583,7 +558,7 @@ private void OnColumnsChanged() private DataFrame Sort(string columnName, bool isAscending) { - DataFrameColumn column = this[columnName]; + DataFrameColumn column = Columns[columnName]; DataFrameColumn sortIndices = column.GetAscendingSortIndices(); List newColumns = new List(Columns.Count); for (int i = 0; i < Columns.Count; i++) diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs index e6635398d5..178d7a0bf4 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs @@ -17,16 +17,6 @@ public abstract partial class DataFrameColumn return left.Add(right); } - public static DataFrameColumn operator +(DataFrameColumn column, bool value) - { - return column.Add(value); - } - - public static DataFrameColumn operator +(bool value, DataFrameColumn column) - { - return column.ReverseAdd(value); - } - public static DataFrameColumn operator +(DataFrameColumn column, byte value) { return column.Add(value); @@ -37,16 +27,6 @@ public abstract partial class DataFrameColumn return column.ReverseAdd(value); } - public static DataFrameColumn operator +(DataFrameColumn column, char value) - { - return column.Add(value); - } - - public static DataFrameColumn operator +(char value, DataFrameColumn column) - { - return column.ReverseAdd(value); - } - public static DataFrameColumn operator +(DataFrameColumn column, decimal value) { return column.Add(value); @@ -153,16 +133,6 @@ public abstract partial class DataFrameColumn return left.Subtract(right); } - public static DataFrameColumn operator -(DataFrameColumn column, bool value) - { - return column.Subtract(value); - } - - public static DataFrameColumn operator -(bool value, DataFrameColumn column) - { - return column.ReverseSubtract(value); - } - public static DataFrameColumn operator -(DataFrameColumn column, byte value) { return column.Subtract(value); @@ -173,16 +143,6 @@ public abstract partial class DataFrameColumn return column.ReverseSubtract(value); } - public static DataFrameColumn operator -(DataFrameColumn column, char value) - { - return column.Subtract(value); - } - - public static DataFrameColumn operator -(char value, DataFrameColumn column) - { - return column.ReverseSubtract(value); - } - public static DataFrameColumn operator -(DataFrameColumn column, decimal value) { return column.Subtract(value); @@ -289,16 +249,6 @@ public abstract partial class DataFrameColumn return left.Multiply(right); } - public static DataFrameColumn operator *(DataFrameColumn column, bool value) - { - return column.Multiply(value); - } - - public static DataFrameColumn operator *(bool value, DataFrameColumn column) - { - return column.ReverseMultiply(value); - } - public static DataFrameColumn operator *(DataFrameColumn column, byte value) { return column.Multiply(value); @@ -309,16 +259,6 @@ public abstract partial class DataFrameColumn return column.ReverseMultiply(value); } - public static DataFrameColumn operator *(DataFrameColumn column, char value) - { - return column.Multiply(value); - } - - public static DataFrameColumn operator *(char value, DataFrameColumn column) - { - return column.ReverseMultiply(value); - } - public static DataFrameColumn operator *(DataFrameColumn column, decimal value) { return column.Multiply(value); @@ -425,16 +365,6 @@ public abstract partial class DataFrameColumn return left.Divide(right); } - public static DataFrameColumn operator /(DataFrameColumn column, bool value) - { - return column.Divide(value); - } - - public static DataFrameColumn operator /(bool value, DataFrameColumn column) - { - return column.ReverseDivide(value); - } - public static DataFrameColumn operator /(DataFrameColumn column, byte value) { return column.Divide(value); @@ -445,16 +375,6 @@ public abstract partial class DataFrameColumn return column.ReverseDivide(value); } - public static DataFrameColumn operator /(DataFrameColumn column, char value) - { - return column.Divide(value); - } - - public static DataFrameColumn operator /(char value, DataFrameColumn column) - { - return column.ReverseDivide(value); - } - public static DataFrameColumn operator /(DataFrameColumn column, decimal value) { return column.Divide(value); @@ -561,16 +481,6 @@ public abstract partial class DataFrameColumn return left.Modulo(right); } - public static DataFrameColumn operator %(DataFrameColumn column, bool value) - { - return column.Modulo(value); - } - - public static DataFrameColumn operator %(bool value, DataFrameColumn column) - { - return column.ReverseModulo(value); - } - public static DataFrameColumn operator %(DataFrameColumn column, byte value) { return column.Modulo(value); @@ -581,16 +491,6 @@ public abstract partial class DataFrameColumn return column.ReverseModulo(value); } - public static DataFrameColumn operator %(DataFrameColumn column, char value) - { - return column.Modulo(value); - } - - public static DataFrameColumn operator %(char value, DataFrameColumn column) - { - return column.ReverseModulo(value); - } - public static DataFrameColumn operator %(DataFrameColumn column, decimal value) { return column.Modulo(value); diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt index 001dd39a11..3524c77221 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt @@ -33,6 +33,8 @@ namespace Microsoft.Data.Analysis <# } else { #> <# foreach (TypeConfiguration type in typeConfiguration) { #> +<# if (method.IsNumeric != type.SupportsNumeric) continue; #> +<# if (method.IsNumeric && type.TypeName == "char") continue; #> public static DataFrameColumn operator <#=method.Operator#>(DataFrameColumn column, <#=type.TypeName#> value) { return column.<#=method.MethodName#>(value); diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.cs index 1795857070..2be32ba6f3 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.cs @@ -183,24 +183,24 @@ public virtual DataFrameColumn Sort(bool ascending = true) protected internal virtual void AddDataViewColumn(DataViewSchema.Builder builder) => throw new NotImplementedException(); /// - /// Clips values beyond the specified thresholds + /// Clamps values beyond the specified thresholds /// /// - /// Minimum value. All values below this threshold will be set to it - /// Maximum value. All values above this threshold will be set to it - public virtual DataFrameColumn Clip(U lower, U upper, bool inPlace = false) => ClipImplementation(lower, upper, inPlace); + /// Minimum value. All values below this threshold will be set to it + /// Maximum value. All values above this threshold will be set to it + public virtual DataFrameColumn Clamp(U min, U max, bool inPlace = false) => ClampImplementation(min, max, inPlace); - protected virtual DataFrameColumn ClipImplementation(U lower, U upper, bool inPlace) => throw new NotImplementedException(); + protected virtual DataFrameColumn ClampImplementation(U min, U max, bool inPlace) => throw new NotImplementedException(); /// /// Returns a new column filtered by the lower and upper bounds /// /// - /// - /// - public virtual DataFrameColumn Filter(U lower, U upper) => FilterImplementation(lower, upper); + /// The minimum value in the resulting column + /// The maximum value in the resulting column + public virtual DataFrameColumn Filter(U min, U max) => FilterImplementation(min, max); - protected virtual DataFrameColumn FilterImplementation(U lower, U upper) => throw new NotImplementedException(); + protected virtual DataFrameColumn FilterImplementation(U min, U max) => throw new NotImplementedException(); /// /// Determines if the column is of a numeric type diff --git a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs index e362af2b15..5488d8ca93 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs @@ -141,5 +141,39 @@ protected override void ClearItems() _columnNames.Clear(); _columnNameToIndexDictionary.Clear(); } + + /// + /// An indexer based on + /// + /// The name of a + /// A if it exists. + /// Throws if is not present in this + public DataFrameColumn this[string columnName] + { + get + { + int columnIndex = IndexOf(columnName); + if (columnIndex == -1) + { + throw new ArgumentException(Strings.InvalidColumnName, nameof(columnName)); + } + return this[columnIndex]; + } + set + { + int columnIndex = IndexOf(columnName); + DataFrameColumn newColumn = value; + newColumn.SetName(columnName); + if (columnIndex == -1) + { + Insert(Count, newColumn); + } + else + { + this[columnIndex] = newColumn; + } + } + } + } } diff --git a/src/Microsoft.Data.Analysis/GroupBy.cs b/src/Microsoft.Data.Analysis/GroupBy.cs index f6e1d0ecd3..10c02c3470 100644 --- a/src/Microsoft.Data.Analysis/GroupBy.cs +++ b/src/Microsoft.Data.Analysis/GroupBy.cs @@ -141,7 +141,7 @@ public override DataFrame Count(params string[] columnNames) else { // Assuming non duplicate column names - retColumn = ret[column.Name]; + retColumn = ret.Columns[column.Name]; } retColumn.Resize(rowIndex + 1); retColumn[rowIndex] = count; @@ -182,7 +182,7 @@ public override DataFrame First(params string[] columnNames) else { // Assuming non duplicate column names - retColumn = ret[column.Name]; + retColumn = ret.Columns[column.Name]; } retColumn.Resize(rowIndex + 1); retColumn[rowIndex] = column[row]; @@ -227,7 +227,7 @@ public override DataFrame Head(int numberOfRows) else { // Assuming non duplicate column names - retColumn = ret[column.Name]; + retColumn = ret.Columns[column.Name]; } long retColumnLength = retColumn.Length; retColumn.Resize(retColumnLength + 1); @@ -283,7 +283,7 @@ public override DataFrame Tail(int numberOfRows) else { // Assuming non duplicate column names - retColumn = ret[column.Name]; + retColumn = ret.Columns[column.Name]; } long retColumnLength = retColumn.Length; if (firstColumn.Length <= retColumnLength) @@ -317,7 +317,7 @@ private DataFrameColumn ResizeAndInsertColumn(int columnIndex, long rowIndex, bo else { // Assuming unique column names - retColumn = ret[column.Name]; + retColumn = ret.Columns[column.Name]; } retColumn.Resize(rowIndex + 1); return retColumn; diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs index 18a9903342..a7bc108681 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs @@ -556,11 +556,11 @@ public PrimitiveDataFrameColumn Apply(Func func) } /// - /// Clips values beyond the specified thresholds + /// Clamps values beyond the specified thresholds /// - /// Minimum value. All values below this threshold will be set to it - /// Maximum value. All values above this threshold will be set to it - public PrimitiveDataFrameColumn Clip(T lower, T upper, bool inPlace = false) + /// Minimum value. All values below this threshold will be set to it + /// Maximum value. All values above this threshold will be set to it + public PrimitiveDataFrameColumn Clamp(T min, T max, bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); @@ -571,20 +571,20 @@ public PrimitiveDataFrameColumn Clip(T lower, T upper, bool inPlace = false) if (value == null) continue; - if (comparer.Compare(value.Value, lower) < 0) - ret[i] = lower; + if (comparer.Compare(value.Value, min) < 0) + ret[i] = min; - if (comparer.Compare(value.Value, upper) > 0) - ret[i] = upper; + if (comparer.Compare(value.Value, max) > 0) + ret[i] = max; } return ret; } - protected override DataFrameColumn ClipImplementation(U lower, U upper, bool inPlace) + protected override DataFrameColumn ClampImplementation(U min, U max, bool inPlace) { - object convertedLower = Convert.ChangeType(lower, typeof(T)); + object convertedLower = Convert.ChangeType(min, typeof(T)); if (typeof(T) == typeof(U) || convertedLower != null) - return Clip((T)convertedLower, (T)Convert.ChangeType(upper, typeof(T)), inPlace); + return Clamp((T)convertedLower, (T)Convert.ChangeType(max, typeof(T)), inPlace); else throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(U)); } @@ -592,9 +592,9 @@ protected override DataFrameColumn ClipImplementation(U lower, U upper, bool /// /// Returns a new column filtered by the lower and upper bounds /// - /// - /// - public PrimitiveDataFrameColumn Filter(T lower, T upper) + /// The minimum value in the resulting column + /// The maximum value in the resulting column + public PrimitiveDataFrameColumn Filter(T min, T max) { PrimitiveDataFrameColumn ret = new PrimitiveDataFrameColumn(Name); Comparer comparer = Comparer.Default; @@ -604,17 +604,17 @@ public PrimitiveDataFrameColumn Filter(T lower, T upper) if (value == null) continue; - if (comparer.Compare(value.Value, lower) >= 0 && comparer.Compare(value.Value, upper) <= 0) + if (comparer.Compare(value.Value, min) >= 0 && comparer.Compare(value.Value, max) <= 0) ret.Append(value); } return ret; } - protected override DataFrameColumn FilterImplementation(U lower, U upper) + protected override DataFrameColumn FilterImplementation(U min, U max) { - object convertedLower = Convert.ChangeType(lower, typeof(T)); + object convertedLower = Convert.ChangeType(min, typeof(T)); if (typeof(T) == typeof(U) || convertedLower != null) - return Filter((T)convertedLower, (T)Convert.ChangeType(upper, typeof(T))); + return Filter((T)convertedLower, (T)Convert.ChangeType(max, typeof(T))); else throw new ArgumentException(string.Format(Strings.MismatchedValueType, typeof(T)), nameof(U)); } diff --git a/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs index d89be69079..180555eb08 100644 --- a/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs @@ -165,9 +165,9 @@ public IEnumerator GetEnumerator() protected override IEnumerator GetEnumeratorCore() => GetEnumerator(); - public override DataFrameColumn Clip(U lower, U upper, bool inPlace = false) => throw new NotSupportedException(); + public override DataFrameColumn Clamp(U min, U max, bool inPlace = false) => throw new NotSupportedException(); - public override DataFrameColumn Filter(U lower, U upper) => throw new NotSupportedException(); + public override DataFrameColumn Filter(U min, U max) => throw new NotSupportedException(); public new StringDataFrameColumn Sort(bool ascending = true) { diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs index d7b59accf2..513c1dade2 100644 --- a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs @@ -94,10 +94,10 @@ public void TestMutationOnArrowColumn() RecordBatch originalBatch = new RecordBatch.Builder() .Append("Column1", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))).Build(); DataFrame df = DataFrame.FromArrowRecordBatch(originalBatch); - Assert.Equal(1, df["Column1"][1]); - df["Column1"][1] = 100; - Assert.Equal(100, df["Column1"][1]); - Assert.Equal(0, df["Column1"].NullCount); + Assert.Equal(1, df.Columns["Column1"][1]); + df.Columns["Column1"][1] = 100; + Assert.Equal(100, df.Columns["Column1"][1]); + Assert.Equal(0, df.Columns["Column1"].NullCount); } [Fact] @@ -116,27 +116,27 @@ public void TestEmptyArrowColumns() nullCount: 10, offset: 0)).Build(); DataFrame df = DataFrame.FromArrowRecordBatch(originalBatch); - Assert.Equal(0, df["EmptyNullBitMapColumn"].NullCount); - Assert.Equal(10, df["EmptyNullBitMapColumn"].Length); - df["EmptyNullBitMapColumn"][9] = null; - Assert.Equal(1, df["EmptyNullBitMapColumn"].NullCount); - Assert.Equal(10, df["EmptyDataColumn"].NullCount); - Assert.Equal(10, df["EmptyDataColumn"].Length); - df["EmptyDataColumn"][9] = 9; - Assert.Equal(9, df["EmptyDataColumn"].NullCount); - Assert.Equal(10, df["EmptyDataColumn"].Length); + Assert.Equal(0, df.Columns["EmptyNullBitMapColumn"].NullCount); + Assert.Equal(10, df.Columns["EmptyNullBitMapColumn"].Length); + df.Columns["EmptyNullBitMapColumn"][9] = null; + Assert.Equal(1, df.Columns["EmptyNullBitMapColumn"].NullCount); + Assert.Equal(10, df.Columns["EmptyDataColumn"].NullCount); + Assert.Equal(10, df.Columns["EmptyDataColumn"].Length); + df.Columns["EmptyDataColumn"][9] = 9; + Assert.Equal(9, df.Columns["EmptyDataColumn"].NullCount); + Assert.Equal(10, df.Columns["EmptyDataColumn"].Length); for (int i = 0; i < 9; i++) { - Assert.Equal(i, (int)df["EmptyNullBitMapColumn"][i]); - Assert.Null(df["EmptyDataColumn"][i]); + Assert.Equal(i, (int)df.Columns["EmptyNullBitMapColumn"][i]); + Assert.Null(df.Columns["EmptyDataColumn"][i]); } RecordBatch batch1 = new RecordBatch.Builder() .Append("EmptyDataAndNullColumns", false, col => col.Int32(array => array.Clear())).Build(); DataFrame emptyDataFrame = DataFrame.FromArrowRecordBatch(batch1); Assert.Equal(0, emptyDataFrame.Rows.Count); - Assert.Equal(0, emptyDataFrame["EmptyDataAndNullColumns"].Length); - Assert.Equal(0, emptyDataFrame["EmptyDataAndNullColumns"].NullCount); + Assert.Equal(0, emptyDataFrame.Columns["EmptyDataAndNullColumns"].Length); + Assert.Equal(0, emptyDataFrame.Columns["EmptyDataAndNullColumns"].NullCount); } [Fact] diff --git a/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs b/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs index 67edb50d67..8150988608 100644 --- a/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs @@ -196,7 +196,7 @@ public void TestPrimitiveColumnGetReadOnlyBuffers() .Append("Column1", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))).Build(); DataFrame df = DataFrame.FromArrowRecordBatch(recordBatch); - PrimitiveDataFrameColumn column = df["Column1"] as PrimitiveDataFrameColumn; + PrimitiveDataFrameColumn column = df.Columns["Column1"] as PrimitiveDataFrameColumn; IEnumerable> buffers = column.GetReadOnlyDataBuffers(); IEnumerable> nullBitMaps = column.GetReadOnlyNullBitMapBuffers(); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index c44909ed4f..6b2634159f 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -27,12 +27,12 @@ Stream GetStream(string streamData) DataFrame df = DataFrame.LoadCsv(GetStream(data)); Assert.Equal(4, df.Rows.Count); Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df["vendor_id"][3]); + Assert.Equal("CMT", df.Columns["vendor_id"][3]); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows["vendor_id"][2]); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); } [Fact] @@ -50,12 +50,12 @@ Stream GetStream(string streamData) DataFrame df = DataFrame.LoadCsv(GetStream(data), header: false); Assert.Equal(4, df.Rows.Count); Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df["Column0"][3]); + Assert.Equal("CMT", df.Columns["Column0"][3]); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), header: false, numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows["Column0"][2]); + Assert.Equal("CMT", reducedRows.Columns["Column0"][2]); } [Fact] @@ -123,12 +123,12 @@ Stream GetStream(string streamData) Assert.Equal(5, df.Rows.Count); Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df["vendor_id"][4]); + Assert.Equal("CMT", df.Columns["vendor_id"][4]); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: '|', numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows["vendor_id"][2]); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); var nullRow = df.Rows[3]; Assert.Equal("", nullRow[0]); @@ -158,12 +158,12 @@ Stream GetStream(string streamData) Assert.Equal(5, df.Rows.Count); Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df["vendor_id"][4]); + Assert.Equal("CMT", df.Columns["vendor_id"][4]); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: ';', numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows["vendor_id"][2]); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); var nullRow = df.Rows[3]; Assert.Equal("", nullRow[0]); @@ -192,12 +192,12 @@ Stream GetStream(string streamData) Assert.Equal(4, df.Rows.Count); Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df["vendor_id"][3]); + Assert.Equal("CMT", df.Columns["vendor_id"][3]); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows["vendor_id"][2]); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); } [Fact] @@ -234,12 +234,12 @@ Stream GetStream(string streamData) DataFrame df = DataFrame.LoadCsv(GetStream(data)); Assert.Equal(4, df.Rows.Count); Assert.Equal(6, df.Columns.Count); - Assert.Equal("CMT", df["vendor_id"][3]); + Assert.Equal("CMT", df.Columns["vendor_id"][3]); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(6, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows["vendor_id"][2]); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); } } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index f715dfa17d..29caa69b5c 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -197,10 +197,10 @@ public void TestIndexer() var row = dataFrame.Rows[4]; Assert.Equal(14, (int)row[1]); - var column = dataFrame["Int2"] as Int32DataFrameColumn; + var column = dataFrame.Columns["Int2"] as Int32DataFrameColumn; Assert.Equal(1000, (int)column[2]); - Assert.Throws(() => dataFrame["Int5"]); + Assert.Throws(() => dataFrame.Columns["Int5"]); } [Fact] @@ -248,12 +248,12 @@ public void InsertAndRemoveColumnTests() { DataFrame dataFrame = MakeDataFrameWithAllMutableColumnTypes(10); DataFrameColumn intColumn = new Int32DataFrameColumn("IntColumn", Enumerable.Range(0, 10).Select(x => x)); - DataFrameColumn charColumn = dataFrame["Char"]; + DataFrameColumn charColumn = dataFrame.Columns["Char"]; int insertedIndex = dataFrame.Columns.Count; dataFrame.Columns.Insert(dataFrame.Columns.Count, intColumn); dataFrame.Columns.RemoveAt(0); - DataFrameColumn intColumn_1 = dataFrame["IntColumn"]; - DataFrameColumn charColumn_1 = dataFrame["Char"]; + DataFrameColumn intColumn_1 = dataFrame.Columns["IntColumn"]; + DataFrameColumn charColumn_1 = dataFrame.Columns["Char"]; Assert.True(ReferenceEquals(intColumn, intColumn_1)); Assert.True(ReferenceEquals(charColumn, charColumn_1)); } @@ -330,15 +330,15 @@ public void TestBinaryOperationsWithColumns() DataFrameColumn verify; for (int i = 0; i < df1.Columns.Count; i++) { - newColumn = df1[df1.Columns[i].Name] + df2[df2.Columns[i].Name]; + newColumn = df1.Columns[df1.Columns[i].Name] + df2.Columns[df2.Columns[i].Name]; verify = newColumn.ElementwiseEquals(df1.Columns[i] * 2); Assert.Equal(true, verify[0]); - newColumn = df1[df1.Columns[i].Name] - df2[df2.Columns[i].Name]; + newColumn = df1.Columns[df1.Columns[i].Name] - df2.Columns[df2.Columns[i].Name]; verify = newColumn.ElementwiseEquals(0); Assert.Equal(true, verify[0]); - newColumn = df1[df1.Columns[i].Name] * df2[df2.Columns[i].Name]; + newColumn = df1.Columns[df1.Columns[i].Name] * df2.Columns[df2.Columns[i].Name]; verify = newColumn.ElementwiseEquals(df1.Columns[i] * df1.Columns[i]); Assert.Equal(true, verify[0]); @@ -352,22 +352,22 @@ public void TestBinaryOperationsWithColumns() verify = newColumn.ElementwiseEquals(0); Assert.Equal(true, verify[0]); - verify = df1[df1.Columns[i].Name].ElementwiseEquals(df2[df2.Columns[i].Name]); + verify = df1.Columns[df1.Columns[i].Name].ElementwiseEquals(df2.Columns[df2.Columns[i].Name]); Assert.True(verify.All()); - verify = df1[df1.Columns[i].Name].ElementwiseNotEquals(df2[df2.Columns[i].Name]); + verify = df1.Columns[df1.Columns[i].Name].ElementwiseNotEquals(df2.Columns[df2.Columns[i].Name]); Assert.False(verify.Any()); - verify = df1[df1.Columns[i].Name].ElementwiseGreaterThanOrEqual(df2[df2.Columns[i].Name]); + verify = df1.Columns[df1.Columns[i].Name].ElementwiseGreaterThanOrEqual(df2.Columns[df2.Columns[i].Name]); Assert.True(verify.All()); - verify = df1[df1.Columns[i].Name].ElementwiseLessThanOrEqual(df2[df2.Columns[i].Name]); + verify = df1.Columns[df1.Columns[i].Name].ElementwiseLessThanOrEqual(df2.Columns[df2.Columns[i].Name]); Assert.True(verify.All()); - verify = df1[df1.Columns[i].Name].ElementwiseGreaterThan(df2[df2.Columns[i].Name]); + verify = df1.Columns[df1.Columns[i].Name].ElementwiseGreaterThan(df2.Columns[df2.Columns[i].Name]); Assert.False(verify.Any()); - verify = df1[df1.Columns[i].Name].ElementwiseLessThan(df2[df2.Columns[i].Name]); + verify = df1.Columns[df1.Columns[i].Name].ElementwiseLessThan(df2.Columns[df2.Columns[i].Name]); Assert.False(verify.Any()); } } @@ -553,33 +553,31 @@ public void TestBinaryOperatorsWithConversions() Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + 1.1); tempDf = df + 1.1m; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + 1.1m); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); - - Assert.Throws(() => df + true); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); tempDf = df - 1.1; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] - 1.1); tempDf = df - 1.1m; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] - 1.1m); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); tempDf = df * 1.1; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] * 1.1); tempDf = df * 1.1m; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] * 1.1m); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); tempDf = df / 1.1; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] / 1.1); tempDf = df / 1.1m; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] / 1.1m); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); tempDf = df % 1.1; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] % 1.1); tempDf = df % 1.1m; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] % 1.1m); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); tempDf = 1 + df; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + (double)1); @@ -587,19 +585,19 @@ public void TestBinaryOperatorsWithConversions() Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + 1.1); tempDf = 1.1m + df; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] + 1.1m); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); tempDf = 1.1 - df; Assert.Equal(tempDf[0, 0], 1.1 - (byte)df[0, 0]); tempDf = 1.1m - df; Assert.Equal(tempDf[0, 0], 1.1m - (byte)df[0, 0]); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); tempDf = 1.1 * df; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] * 1.1); tempDf = 1.1m * df; Assert.Equal(tempDf[0, 0], (byte)df[0, 0] * 1.1m); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); // To prevent a divide by zero var plusOne = df + 1; @@ -608,63 +606,17 @@ public void TestBinaryOperatorsWithConversions() var plusDecimal = df + 1.1m; tempDf = 1.1m / plusDecimal; Assert.Equal(tempDf[0, 0], (1.1m) / (decimal)plusDecimal[0, 0]); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); tempDf = 1.1 % plusOne; Assert.Equal(tempDf[0, 0], 1.1 % (double)plusOne[0, 0]); tempDf = 1.1m % plusDecimal; Assert.Equal(tempDf[0, 0], 1.1m % (decimal)plusDecimal[0, 0]); - Assert.True(typeof(decimal) == tempDf["Int"].DataType); + Assert.True(typeof(decimal) == tempDf.Columns["Int"].DataType); Assert.Equal((byte)0, df[0, 0]); } - [Fact] - public void TestBinaryOperatorsOnBoolColumns() - { - var df = new DataFrame(); - var dataFrameColumn1 = new BooleanDataFrameColumn("Bool1", Enumerable.Range(0, 10).Select(x => x % 2 == 0 ? true : false)); - var dataFrameColumn2 = new BooleanDataFrameColumn("Bool2", Enumerable.Range(0, 10).Select(x => x % 2 == 0 ? true : false)); - df.Columns.Insert(0, dataFrameColumn1); - df.Columns.Insert(1, dataFrameColumn2); - - DataFrame and = df & true; - for (int i = 0; i < dataFrameColumn1.Length; i++) - { - Assert.Equal(dataFrameColumn1[i], and["Bool1"][i]); - } - - and = true & df; - for (int i = 0; i < dataFrameColumn1.Length; i++) - { - Assert.Equal(dataFrameColumn1[i], and["Bool1"][i]); - } - - DataFrame or = df | true; - Assert.True(or.Columns[0].All()); - Assert.True(or.Columns[1].All()); - or = true | df; - Assert.True(or.Columns[0].All()); - Assert.True(or.Columns[1].All()); - - DataFrame xor = df ^ true; - for (int i = 0; i < xor.Rows.Count; i++) - { - if (i % 2 == 0) - Assert.False((bool)xor["Bool1"][i]); - else - Assert.True((bool)xor["Bool1"][i]); - } - xor = true ^ df; - for (int i = 0; i < xor.Rows.Count; i++) - { - if (i % 2 == 0) - Assert.False((bool)xor["Bool1"][i]); - else - Assert.True((bool)xor["Bool1"][i]); - } - } - [Fact] public void TestBinaryOperationsOnColumns() { @@ -690,56 +642,56 @@ public void TestProjectionAndAppend() { DataFrame df = MakeDataFrameWithTwoColumns(10); - df["Int3"] = df["Int1"] * 2 + df["Int2"]; - Assert.Equal(16, df["Int3"][2]); + df.Columns["Int3"] = df.Columns["Int1"] * 2 + df.Columns["Int2"]; + Assert.Equal(16, df.Columns["Int3"][2]); } [Fact] public void TestComputations() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); - df["Int"][0] = -10; - Assert.Equal(-10, df["Int"][0]); + df.Columns["Int"][0] = -10; + Assert.Equal(-10, df.Columns["Int"][0]); - DataFrameColumn absColumn = df["Int"].Abs(); + DataFrameColumn absColumn = df.Columns["Int"].Abs(); Assert.Equal(10, absColumn[0]); - Assert.Equal(-10, df["Int"][0]); - df["Int"].Abs(true); - Assert.Equal(10, df["Int"][0]); - - Assert.Throws(() => df["Byte"].All()); - Assert.Throws(() => df["Byte"].Any()); - Assert.Throws(() => df["Char"].All()); - Assert.Throws(() => df["Char"].Any()); - Assert.Throws(() => df["Decimal"].All()); - Assert.Throws(() => df["Decimal"].Any()); - Assert.Throws(() => df["Double"].All()); - Assert.Throws(() => df["Double"].Any()); - Assert.Throws(() => df["Float"].All()); - Assert.Throws(() => df["Float"].Any()); - Assert.Throws(() => df["Int"].All()); - Assert.Throws(() => df["Int"].Any()); - Assert.Throws(() => df["Long"].All()); - Assert.Throws(() => df["Long"].Any()); - Assert.Throws(() => df["Sbyte"].All()); - Assert.Throws(() => df["Sbyte"].Any()); - Assert.Throws(() => df["Short"].All()); - Assert.Throws(() => df["Short"].Any()); - Assert.Throws(() => df["Uint"].All()); - Assert.Throws(() => df["Uint"].Any()); - Assert.Throws(() => df["Ulong"].All()); - Assert.Throws(() => df["Ulong"].Any()); - Assert.Throws(() => df["Ushort"].All()); - Assert.Throws(() => df["Ushort"].Any()); - - bool any = df["Bool"].Any(); - bool all = df["Bool"].All(); + Assert.Equal(-10, df.Columns["Int"][0]); + df.Columns["Int"].Abs(true); + Assert.Equal(10, df.Columns["Int"][0]); + + Assert.Throws(() => df.Columns["Byte"].All()); + Assert.Throws(() => df.Columns["Byte"].Any()); + Assert.Throws(() => df.Columns["Char"].All()); + Assert.Throws(() => df.Columns["Char"].Any()); + Assert.Throws(() => df.Columns["Decimal"].All()); + Assert.Throws(() => df.Columns["Decimal"].Any()); + Assert.Throws(() => df.Columns["Double"].All()); + Assert.Throws(() => df.Columns["Double"].Any()); + Assert.Throws(() => df.Columns["Float"].All()); + Assert.Throws(() => df.Columns["Float"].Any()); + Assert.Throws(() => df.Columns["Int"].All()); + Assert.Throws(() => df.Columns["Int"].Any()); + Assert.Throws(() => df.Columns["Long"].All()); + Assert.Throws(() => df.Columns["Long"].Any()); + Assert.Throws(() => df.Columns["Sbyte"].All()); + Assert.Throws(() => df.Columns["Sbyte"].Any()); + Assert.Throws(() => df.Columns["Short"].All()); + Assert.Throws(() => df.Columns["Short"].Any()); + Assert.Throws(() => df.Columns["Uint"].All()); + Assert.Throws(() => df.Columns["Uint"].Any()); + Assert.Throws(() => df.Columns["Ulong"].All()); + Assert.Throws(() => df.Columns["Ulong"].Any()); + Assert.Throws(() => df.Columns["Ushort"].All()); + Assert.Throws(() => df.Columns["Ushort"].Any()); + + bool any = df.Columns["Bool"].Any(); + bool all = df.Columns["Bool"].All(); Assert.True(any); Assert.False(all); // Test the computation results - df["Double"][0] = 100.0; - DataFrameColumn doubleColumn = df["Double"].CumulativeMax(); + df.Columns["Double"][0] = 100.0; + DataFrameColumn doubleColumn = df.Columns["Double"].CumulativeMax(); for (int i = 0; i < doubleColumn.Length; i++) { if (i == 5) @@ -747,18 +699,18 @@ public void TestComputations() else Assert.Equal(100.0, (double)doubleColumn[i]); } - Assert.Equal(1.0, df["Double"][1]); - df["Double"].CumulativeMax(true); - for (int i = 0; i < df["Double"].Length; i++) + Assert.Equal(1.0, df.Columns["Double"][1]); + df.Columns["Double"].CumulativeMax(true); + for (int i = 0; i < df.Columns["Double"].Length; i++) { if (i == 5) - Assert.Null(df["Double"][i]); + Assert.Null(df.Columns["Double"][i]); else - Assert.Equal(100.0, (double)df["Double"][i]); + Assert.Equal(100.0, (double)df.Columns["Double"][i]); } - df["Float"][0] = -10.0f; - DataFrameColumn floatColumn = df["Float"].CumulativeMin(); + df.Columns["Float"][0] = -10.0f; + DataFrameColumn floatColumn = df.Columns["Float"].CumulativeMin(); for (int i = 0; i < floatColumn.Length; i++) { if (i == 5) @@ -766,40 +718,40 @@ public void TestComputations() else Assert.Equal(-10.0f, (float)floatColumn[i]); } - Assert.Equal(9.0f, df["Float"][9]); - df["Float"].CumulativeMin(true); - for (int i = 0; i < df["Float"].Length; i++) + Assert.Equal(9.0f, df.Columns["Float"][9]); + df.Columns["Float"].CumulativeMin(true); + for (int i = 0; i < df.Columns["Float"].Length; i++) { if (i == 5) - Assert.Null(df["Float"][i]); + Assert.Null(df.Columns["Float"][i]); else - Assert.Equal(-10.0f, (float)df["Float"][i]); + Assert.Equal(-10.0f, (float)df.Columns["Float"][i]); } - DataFrameColumn uintColumn = df["Uint"].CumulativeProduct(); + DataFrameColumn uintColumn = df.Columns["Uint"].CumulativeProduct(); Assert.Equal((uint)0, uintColumn[8]); - Assert.Equal((uint)8, df["Uint"][8]); - df["Uint"].CumulativeProduct(true); - Assert.Equal((uint)0, df["Uint"][9]); + Assert.Equal((uint)8, df.Columns["Uint"][8]); + df.Columns["Uint"].CumulativeProduct(true); + Assert.Equal((uint)0, df.Columns["Uint"][9]); - DataFrameColumn ushortColumn = df["Ushort"].CumulativeSum(); + DataFrameColumn ushortColumn = df.Columns["Ushort"].CumulativeSum(); Assert.Equal((ushort)40, ushortColumn[9]); - Assert.Equal((ushort)9, df["Ushort"][9]); - df["Ushort"].CumulativeSum(true); - Assert.Equal((ushort)40, df["Ushort"][9]); - - Assert.Equal(100.0, df["Double"].Max()); - Assert.Equal(-10.0f, df["Float"].Min()); - Assert.Equal((uint)0, df["Uint"].Product()); - Assert.Equal((ushort)140, df["Ushort"].Sum()); - - df["Double"][0] = 100.1; - Assert.Equal(100.1, df["Double"][0]); - DataFrameColumn roundColumn = df["Double"].Round(); + Assert.Equal((ushort)9, df.Columns["Ushort"][9]); + df.Columns["Ushort"].CumulativeSum(true); + Assert.Equal((ushort)40, df.Columns["Ushort"][9]); + + Assert.Equal(100.0, df.Columns["Double"].Max()); + Assert.Equal(-10.0f, df.Columns["Float"].Min()); + Assert.Equal((uint)0, df.Columns["Uint"].Product()); + Assert.Equal((ushort)140, df.Columns["Ushort"].Sum()); + + df.Columns["Double"][0] = 100.1; + Assert.Equal(100.1, df.Columns["Double"][0]); + DataFrameColumn roundColumn = df.Columns["Double"].Round(); Assert.Equal(100.0, roundColumn[0]); - Assert.Equal(100.1, df["Double"][0]); - df["Double"].Round(true); - Assert.Equal(100.0, df["Double"][0]); + Assert.Equal(100.1, df.Columns["Double"][0]); + df.Columns["Double"].Round(true); + Assert.Equal(100.0, df.Columns["Double"][0]); // Test that none of the numeric column types throw for (int i = 0; i < df.Columns.Count; i++) @@ -844,54 +796,54 @@ public void TestComputations() public void TestOrderBy() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(20); - df["Int"][0] = 100; - df["Int"][19] = -1; - df["Int"][5] = 2000; + df.Columns["Int"][0] = 100; + df.Columns["Int"][19] = -1; + df.Columns["Int"][5] = 2000; // Sort by "Int" in ascending order var sortedDf = df.OrderBy("Int"); - Assert.Null(sortedDf["Int"][19]); - Assert.Equal(-1, sortedDf["Int"][0]); - Assert.Equal(100, sortedDf["Int"][17]); - Assert.Equal(2000, sortedDf["Int"][18]); + Assert.Null(sortedDf.Columns["Int"][19]); + Assert.Equal(-1, sortedDf.Columns["Int"][0]); + Assert.Equal(100, sortedDf.Columns["Int"][17]); + Assert.Equal(2000, sortedDf.Columns["Int"][18]); // Sort by "Int" in descending order sortedDf = df.OrderByDescending("Int"); - Assert.Null(sortedDf["Int"][19]); - Assert.Equal(-1, sortedDf["Int"][18]); - Assert.Equal(100, sortedDf["Int"][1]); - Assert.Equal(2000, sortedDf["Int"][0]); + Assert.Null(sortedDf.Columns["Int"][19]); + Assert.Equal(-1, sortedDf.Columns["Int"][18]); + Assert.Equal(100, sortedDf.Columns["Int"][1]); + Assert.Equal(2000, sortedDf.Columns["Int"][0]); // Sort by "String" in ascending order sortedDf = df.OrderBy("String"); - Assert.Null(sortedDf["Int"][19]); - Assert.Equal(1, sortedDf["Int"][1]); - Assert.Equal(8, sortedDf["Int"][17]); - Assert.Equal(9, sortedDf["Int"][18]); + Assert.Null(sortedDf.Columns["Int"][19]); + Assert.Equal(1, sortedDf.Columns["Int"][1]); + Assert.Equal(8, sortedDf.Columns["Int"][17]); + Assert.Equal(9, sortedDf.Columns["Int"][18]); // Sort by "String" in descending order sortedDf = df.OrderByDescending("String"); - Assert.Null(sortedDf["Int"][19]); - Assert.Equal(8, sortedDf["Int"][1]); - Assert.Equal(9, sortedDf["Int"][0]); + Assert.Null(sortedDf.Columns["Int"][19]); + Assert.Equal(8, sortedDf.Columns["Int"][1]); + Assert.Equal(9, sortedDf.Columns["Int"][0]); } [Fact] public void TestSplitAndSort() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(20); - df["Int"][0] = 100000; - df["Int"][df.Rows.Count - 1] = -1; - df["Int"][5] = 200000; + df.Columns["Int"][0] = 100000; + df.Columns["Int"][df.Rows.Count - 1] = -1; + df.Columns["Int"][5] = 200000; DataFrame dfTest; DataFrame dfTrain = SplitTrainTest(df, 0.8f, out dfTest); // Sort by "Int" in ascending order var sortedDf = dfTrain.OrderBy("Int"); - Assert.Null(sortedDf["Int"][sortedDf.Rows.Count - 1]); - Assert.Equal(1, sortedDf["Int"][0]); - Assert.Equal(100000, sortedDf["Int"][sortedDf.Rows.Count - 3]); - Assert.Equal(200000, sortedDf["Int"][sortedDf.Rows.Count - 2]); + Assert.Null(sortedDf.Columns["Int"][sortedDf.Rows.Count - 1]); + Assert.Equal(1, sortedDf.Columns["Int"][0]); + Assert.Equal(100000, sortedDf.Columns["Int"][sortedDf.Rows.Count - 3]); + Assert.Equal(200000, sortedDf.Columns["Int"][sortedDf.Rows.Count - 2]); } [Fact] @@ -1044,32 +996,32 @@ private void VerifyMerge(DataFrame merge, DataFrame left, DataFrame right, JoinA if (joinAlgorithm == JoinAlgorithm.Left || joinAlgorithm == JoinAlgorithm.Inner) { HashSet intersection = new HashSet(); - for (int i = 0; i < merge["Int_left"].Length; i++) + for (int i = 0; i < merge.Columns["Int_left"].Length; i++) { - if (merge["Int_left"][i] == null) + if (merge.Columns["Int_left"][i] == null) continue; - intersection.Add((int)merge["Int_left"][i]); + intersection.Add((int)merge.Columns["Int_left"][i]); } - for (int i = 0; i < left["Int"].Length; i++) + for (int i = 0; i < left.Columns["Int"].Length; i++) { - if (left["Int"][i] != null && intersection.Contains((int)left["Int"][i])) - intersection.Remove((int)left["Int"][i]); + if (left.Columns["Int"][i] != null && intersection.Contains((int)left.Columns["Int"][i])) + intersection.Remove((int)left.Columns["Int"][i]); } Assert.Empty(intersection); } else if (joinAlgorithm == JoinAlgorithm.Right) { HashSet intersection = new HashSet(); - for (int i = 0; i < merge["Int_right"].Length; i++) + for (int i = 0; i < merge.Columns["Int_right"].Length; i++) { - if (merge["Int_right"][i] == null) + if (merge.Columns["Int_right"][i] == null) continue; - intersection.Add((int)merge["Int_right"][i]); + intersection.Add((int)merge.Columns["Int_right"][i]); } - for (int i = 0; i < right["Int"].Length; i++) + for (int i = 0; i < right.Columns["Int"].Length; i++) { - if (right["Int"][i] != null && intersection.Contains((int)right["Int"][i])) - intersection.Remove((int)right["Int"][i]); + if (right.Columns["Int"][i] != null && intersection.Contains((int)right.Columns["Int"][i])) + intersection.Remove((int)right.Columns["Int"][i]); } Assert.Empty(intersection); } @@ -1091,30 +1043,30 @@ public void TestJoin() DataFrame join = left.Join(right); Assert.Equal(join.Rows.Count, left.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Null(join["Int_right"][6]); + Assert.Null(join.Columns["Int_right"][6]); VerifyJoin(join, left, right, JoinAlgorithm.Left); // Right join join = left.Join(right, joinAlgorithm: JoinAlgorithm.Right); Assert.Equal(join.Rows.Count, right.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(join["Int_right"][3], right["Int"][3]); - Assert.Null(join["Int_right"][2]); + Assert.Equal(join.Columns["Int_right"][3], right.Columns["Int"][3]); + Assert.Null(join.Columns["Int_right"][2]); VerifyJoin(join, left, right, JoinAlgorithm.Right); // Outer join join = left.Join(right, joinAlgorithm: JoinAlgorithm.FullOuter); Assert.Equal(join.Rows.Count, left.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Null(join["Int_right"][6]); + Assert.Null(join.Columns["Int_right"][6]); VerifyJoin(join, left, right, JoinAlgorithm.FullOuter); // Inner join join = left.Join(right, joinAlgorithm: JoinAlgorithm.Inner); Assert.Equal(join.Rows.Count, right.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(join["Int_right"][3], right["Int"][3]); - Assert.Null(join["Int_right"][2]); + Assert.Equal(join.Columns["Int_right"][3], right.Columns["Int"][3]); + Assert.Null(join.Columns["Int_right"][2]); VerifyJoin(join, left, right, JoinAlgorithm.Inner); // Tests with right.Rows.Count > left.Rows.Count @@ -1123,29 +1075,29 @@ public void TestJoin() join = left.Join(right); Assert.Equal(join.Rows.Count, left.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(join["Int_right"][6], right["Int"][6]); + Assert.Equal(join.Columns["Int_right"][6], right.Columns["Int"][6]); VerifyJoin(join, left, right, JoinAlgorithm.Left); // Right join join = left.Join(right, joinAlgorithm: JoinAlgorithm.Right); Assert.Equal(join.Rows.Count, right.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(join["Int_right"][2], right["Int"][2]); - Assert.Null(join["Int_left"][12]); + Assert.Equal(join.Columns["Int_right"][2], right.Columns["Int"][2]); + Assert.Null(join.Columns["Int_left"][12]); VerifyJoin(join, left, right, JoinAlgorithm.Right); // Outer join join = left.Join(right, joinAlgorithm: JoinAlgorithm.FullOuter); Assert.Equal(join.Rows.Count, right.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Null(join["Int_left"][12]); + Assert.Null(join.Columns["Int_left"][12]); VerifyJoin(join, left, right, JoinAlgorithm.FullOuter); // Inner join join = left.Join(right, joinAlgorithm: JoinAlgorithm.Inner); Assert.Equal(join.Rows.Count, left.Rows.Count); Assert.Equal(join.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(join["Int_right"][2], right["Int"][2]); + Assert.Equal(join.Columns["Int_right"][2], right.Columns["Int"][2]); VerifyJoin(join, left, right, JoinAlgorithm.Inner); } @@ -1155,8 +1107,8 @@ public void TestGroupBy() DataFrame df = MakeDataFrameWithNumericAndBoolColumns(10); DataFrame count = df.GroupBy("Bool").Count(); Assert.Equal(2, count.Rows.Count); - Assert.Equal((long)5, count["Int"][0]); - Assert.Equal((long)4, count["Decimal"][1]); + Assert.Equal((long)5, count.Columns["Int"][0]); + Assert.Equal((long)4, count.Columns["Decimal"][1]); for (int r = 0; r < count.Rows.Count; r++) { for (int c = 1; c < count.Columns.Count; c++) @@ -1172,7 +1124,7 @@ public void TestGroupBy() for (int c = 0; c < count.Columns.Count; c++) { DataFrameColumn originalColumn = df.Columns[c]; - DataFrameColumn firstColumn = first[originalColumn.Name]; + DataFrameColumn firstColumn = first.Columns[originalColumn.Name]; Assert.Equal(originalColumn[r], firstColumn[r]); } } @@ -1184,7 +1136,7 @@ public void TestGroupBy() for (int c = 0; c < count.Columns.Count; c++) { DataFrameColumn originalColumn = df.Columns[c]; - DataFrameColumn headColumn = head[originalColumn.Name]; + DataFrameColumn headColumn = head.Columns[originalColumn.Name]; Assert.Equal(originalColumn[r].ToString(), headColumn[verify[r]].ToString()); } } @@ -1193,7 +1145,7 @@ public void TestGroupBy() DataFrameColumn originalColumn = df.Columns[c]; if (originalColumn.Name == "Bool") continue; - DataFrameColumn headColumn = head[originalColumn.Name]; + DataFrameColumn headColumn = head.Columns[originalColumn.Name]; Assert.Equal(originalColumn[5], headColumn[verify[5]]); } Assert.Equal(6, head.Rows.Count); @@ -1207,7 +1159,7 @@ public void TestGroupBy() for (int c = 0; c < count.Columns.Count; c++) { DataFrameColumn originalColumn = df.Columns[c]; - DataFrameColumn tailColumn = tail[originalColumn.Name]; + DataFrameColumn tailColumn = tail.Columns[originalColumn.Name]; Assert.Equal(originalColumn[originalColumnVerify[r]].ToString(), tailColumn[tailColumnVerity[r]].ToString()); } } @@ -1221,7 +1173,7 @@ public void TestGroupBy() DataFrameColumn originalColumn = df.Columns[c]; if (originalColumn.Name == "Bool" || originalColumn.Name == "Char") continue; - DataFrameColumn maxColumn = max[originalColumn.Name]; + DataFrameColumn maxColumn = max.Columns[originalColumn.Name]; Assert.Equal(((long)(r == 0 ? 8 : 9)).ToString(), maxColumn[r].ToString()); } } @@ -1244,45 +1196,45 @@ public void TestGroupBy() DataFrameColumn originalColumn = df.Columns[c]; if (originalColumn.Name == "Bool" || originalColumn.Name == "Char") continue; - DataFrameColumn minColumn = min[originalColumn.Name]; + DataFrameColumn minColumn = min.Columns[originalColumn.Name]; Assert.Equal("0", minColumn[r].ToString()); - DataFrameColumn productColumn = product[originalColumn.Name]; + DataFrameColumn productColumn = product.Columns[originalColumn.Name]; Assert.Equal("0", productColumn[r].ToString()); - DataFrameColumn sumColumn = sum[originalColumn.Name]; + DataFrameColumn sumColumn = sum.Columns[originalColumn.Name]; Assert.Equal("20", sumColumn[r].ToString()); } } DataFrame columnSum = df.GroupBy("Bool").Sum("Int"); Assert.Equal(2, columnSum.Columns.Count); - Assert.Equal(20, columnSum["Int"][0]); - Assert.Equal(20, columnSum["Int"][1]); + Assert.Equal(20, columnSum.Columns["Int"][0]); + Assert.Equal(20, columnSum.Columns["Int"][1]); DataFrame columnMax = df.GroupBy("Bool").Max("Int"); Assert.Equal(2, columnMax.Columns.Count); - Assert.Equal(8, columnMax["Int"][0]); - Assert.Equal(9, columnMax["Int"][1]); + Assert.Equal(8, columnMax.Columns["Int"][0]); + Assert.Equal(9, columnMax.Columns["Int"][1]); DataFrame columnProduct = df.GroupBy("Bool").Product("Int"); Assert.Equal(2, columnProduct.Columns.Count); - Assert.Equal(0, columnProduct["Int"][0]); - Assert.Equal(0, columnProduct["Int"][1]); + Assert.Equal(0, columnProduct.Columns["Int"][0]); + Assert.Equal(0, columnProduct.Columns["Int"][1]); DataFrame columnMin = df.GroupBy("Bool").Min("Int"); Assert.Equal(2, columnMin.Columns.Count); - Assert.Equal(0, columnMin["Int"][0]); - Assert.Equal(0, columnMin["Int"][1]); + Assert.Equal(0, columnMin.Columns["Int"][0]); + Assert.Equal(0, columnMin.Columns["Int"][1]); DataFrame countIntColumn = df.GroupBy("Bool").Count("Int"); Assert.Equal(2, countIntColumn.Columns.Count); Assert.Equal(2, countIntColumn.Rows.Count); - Assert.Equal((long)5, countIntColumn["Int"][0]); - Assert.Equal((long)4, countIntColumn["Int"][1]); + Assert.Equal((long)5, countIntColumn.Columns["Int"][0]); + Assert.Equal((long)4, countIntColumn.Columns["Int"][1]); DataFrame firstDecimalColumn = df.GroupBy("Bool").First("Decimal"); Assert.Equal(2, firstDecimalColumn.Columns.Count); Assert.Equal(2, firstDecimalColumn.Rows.Count); - Assert.Equal((decimal)0, firstDecimalColumn["Decimal"][0]); - Assert.Equal((decimal)1, firstDecimalColumn["Decimal"][1]); + Assert.Equal((decimal)0, firstDecimalColumn.Columns["Decimal"][0]); + Assert.Equal((decimal)1, firstDecimalColumn.Columns["Decimal"][1]); } [Fact] @@ -1349,7 +1301,7 @@ public void TestIEnumerable() // spot check a few column types: - StringDataFrameColumn stringColumn = (StringDataFrameColumn)df["String"]; + StringDataFrameColumn stringColumn = (StringDataFrameColumn)df.Columns["String"]; StringBuilder actualStrings = new StringBuilder(); foreach (string value in stringColumn) { @@ -1364,7 +1316,7 @@ public void TestIEnumerable() } Assert.Equal("012346789", actualStrings.ToString()); - ArrowStringDataFrameColumn arrowStringColumn = (ArrowStringDataFrameColumn)df["ArrowString"]; + ArrowStringDataFrameColumn arrowStringColumn = (ArrowStringDataFrameColumn)df.Columns["ArrowString"]; actualStrings.Clear(); foreach (string value in arrowStringColumn) { @@ -1379,7 +1331,7 @@ public void TestIEnumerable() } Assert.Equal("foofoofoofoofoofoofoofoofoo", actualStrings.ToString()); - SingleDataFrameColumn floatColumn = (SingleDataFrameColumn)df["Float"]; + SingleDataFrameColumn floatColumn = (SingleDataFrameColumn)df.Columns["Float"]; actualStrings.Clear(); foreach (float? value in floatColumn) { @@ -1394,7 +1346,7 @@ public void TestIEnumerable() } Assert.Equal("012346789", actualStrings.ToString()); - Int32DataFrameColumn intColumn = (Int32DataFrameColumn)df["Int"]; + Int32DataFrameColumn intColumn = (Int32DataFrameColumn)df.Columns["Int"]; actualStrings.Clear(); foreach (int? value in intColumn) { @@ -1411,51 +1363,51 @@ public void TestIEnumerable() } [Fact] - public void TestColumnClip() + public void TestColumnClamp() { DataFrame df = MakeDataFrameWithNumericColumns(10); // Out of place - DataFrameColumn clipped = df["Int"].Clip(3, 7); - Assert.Equal(3, clipped[0]); - Assert.Equal(0, df["Int"][0]); - Assert.Equal(3, clipped[1]); - Assert.Equal(1, df["Int"][1]); - Assert.Equal(3, clipped[2]); - Assert.Equal(2, df["Int"][2]); - Assert.Equal(3, clipped[3]); - Assert.Equal(3, df["Int"][3]); - Assert.Equal(4, clipped[4]); - Assert.Equal(4, df["Int"][4]); - Assert.Null(clipped[5]); - Assert.Null(df["Int"][5]); - Assert.Equal(6, clipped[6]); - Assert.Equal(6, df["Int"][6]); - Assert.Equal(7, clipped[7]); - Assert.Equal(7, df["Int"][7]); - Assert.Equal(7, clipped[8]); - Assert.Equal(8, df["Int"][8]); - Assert.Equal(7, clipped[9]); - Assert.Equal(9, df["Int"][9]); + DataFrameColumn clamped = df.Columns["Int"].Clamp(3, 7); + Assert.Equal(3, clamped[0]); + Assert.Equal(0, df.Columns["Int"][0]); + Assert.Equal(3, clamped[1]); + Assert.Equal(1, df.Columns["Int"][1]); + Assert.Equal(3, clamped[2]); + Assert.Equal(2, df.Columns["Int"][2]); + Assert.Equal(3, clamped[3]); + Assert.Equal(3, df.Columns["Int"][3]); + Assert.Equal(4, clamped[4]); + Assert.Equal(4, df.Columns["Int"][4]); + Assert.Null(clamped[5]); + Assert.Null(df.Columns["Int"][5]); + Assert.Equal(6, clamped[6]); + Assert.Equal(6, df.Columns["Int"][6]); + Assert.Equal(7, clamped[7]); + Assert.Equal(7, df.Columns["Int"][7]); + Assert.Equal(7, clamped[8]); + Assert.Equal(8, df.Columns["Int"][8]); + Assert.Equal(7, clamped[9]); + Assert.Equal(9, df.Columns["Int"][9]); // In place - df["Int"].Clip(3, 7, true); - Assert.Equal(3, df["Int"][0]); - Assert.Equal(3, df["Int"][1]); - Assert.Equal(3, df["Int"][2]); - Assert.Equal(3, df["Int"][3]); - Assert.Equal(4, df["Int"][4]); - Assert.Null(df["Int"][5]); - Assert.Equal(6, df["Int"][6]); - Assert.Equal(7, df["Int"][7]); - Assert.Equal(7, df["Int"][8]); - Assert.Equal(7, df["Int"][9]); + df.Columns["Int"].Clamp(3, 7, true); + Assert.Equal(3, df.Columns["Int"][0]); + Assert.Equal(3, df.Columns["Int"][1]); + Assert.Equal(3, df.Columns["Int"][2]); + Assert.Equal(3, df.Columns["Int"][3]); + Assert.Equal(4, df.Columns["Int"][4]); + Assert.Null(df.Columns["Int"][5]); + Assert.Equal(6, df.Columns["Int"][6]); + Assert.Equal(7, df.Columns["Int"][7]); + Assert.Equal(7, df.Columns["Int"][8]); + Assert.Equal(7, df.Columns["Int"][9]); } [Fact] public void TestColumnFilter() { DataFrame df = MakeDataFrameWithNumericColumns(10); - DataFrameColumn filtered = df["Int"].Filter(3, 7); + DataFrameColumn filtered = df.Columns["Int"].Filter(3, 7); Assert.Equal(4, filtered.Length); Assert.Equal(3, filtered[0]); Assert.Equal(4, filtered[1]); @@ -1464,20 +1416,20 @@ public void TestColumnFilter() } [Fact] - public void TestDataFrameClip() + public void TestDataFrameClamp() { DataFrame df = MakeDataFrameWithAllColumnTypes(10); IEnumerable dfColumns = ((IDataView)df).Schema; - void VerifyDataFrameClip(DataFrame clippedColumn) + void VerifyDataFrameClamp(DataFrame clampedColumn) { - IEnumerable clippedColumns = ((IDataView)clippedColumn).Schema; - Assert.Equal(df.Columns.Count, clippedColumn.Columns.Count); - Assert.Equal(dfColumns, clippedColumns); + IEnumerable clampedColumns = ((IDataView)clampedColumn).Schema; + Assert.Equal(df.Columns.Count, clampedColumn.Columns.Count); + Assert.Equal(dfColumns, clampedColumns); for (int c = 0; c < df.Columns.Count; c++) { - DataFrameColumn column = clippedColumn.Columns[c]; + DataFrameColumn column = clampedColumn.Columns[c]; if (column.IsNumericColumn()) { for (int i = 0; i < 4; i++) @@ -1505,19 +1457,19 @@ void VerifyDataFrameClip(DataFrame clippedColumn) } // Out of place - DataFrame clipped = df.Clip(3, 7); - VerifyDataFrameClip(clipped); + DataFrame clamped = df.Clamp(3, 7); + VerifyDataFrameClamp(clamped); for (int i = 0; i < 10; i++) { if (i != 5) - Assert.Equal(i, df["Int"][i]); + Assert.Equal(i, df.Columns["Int"][i]); else - Assert.Null(df["Int"][5]); + Assert.Null(df.Columns["Int"][5]); } // Inplace - df.Clip(3, 7, true); - VerifyDataFrameClip(df); + df.Clamp(3, 7, true); + VerifyDataFrameClamp(df); } @@ -1525,7 +1477,7 @@ void VerifyDataFrameClip(DataFrame clippedColumn) public void TestDataFrameFilter() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); - DataFrame boolColumnFiltered = df[df["Bool"].ElementwiseEquals(true)]; + DataFrame boolColumnFiltered = df[df.Columns["Bool"].ElementwiseEquals(true)]; List verify = new List { 0, 2, 4, 6, 8 }; Assert.Equal(5, boolColumnFiltered.Rows.Count); for (int i = 0; i < boolColumnFiltered.Columns.Count; i++) @@ -1621,31 +1573,31 @@ public void TestMerge() DataFrame merge = left.Merge(right, "Int", "Int"); Assert.Equal(10, merge.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Null(merge["Int_right"][6]); - Assert.Null(merge["Int_left"][5]); + Assert.Null(merge.Columns["Int_right"][6]); + Assert.Null(merge.Columns["Int_left"][5]); VerifyMerge(merge, left, right, JoinAlgorithm.Left); // Right merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Right); Assert.Equal(5, merge.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(merge["Int_right"][3], right["Int"][3]); - Assert.Null(merge["Int_right"][2]); + Assert.Equal(merge.Columns["Int_right"][3], right.Columns["Int"][3]); + Assert.Null(merge.Columns["Int_right"][2]); VerifyMerge(merge, left, right, JoinAlgorithm.Right); // Outer merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.FullOuter); Assert.Equal(merge.Rows.Count, left.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Null(merge["Int_right"][6]); + Assert.Null(merge.Columns["Int_right"][6]); VerifyMerge(merge, left, right, JoinAlgorithm.FullOuter); // Inner merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Inner); Assert.Equal(merge.Rows.Count, right.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(merge["Int_right"][2], right["Int"][3]); - Assert.Null(merge["Int_right"][4]); + Assert.Equal(merge.Columns["Int_right"][2], right.Columns["Int"][3]); + Assert.Null(merge.Columns["Int_right"][4]); VerifyMerge(merge, left, right, JoinAlgorithm.Inner); // Tests with right.Rows.Count > left.Rows.Count @@ -1654,30 +1606,30 @@ public void TestMerge() merge = left.Merge(right, "Int", "Int"); Assert.Equal(merge.Rows.Count, left.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(merge["Int_right"][6], right["Int"][6]); + Assert.Equal(merge.Columns["Int_right"][6], right.Columns["Int"][6]); VerifyMerge(merge, left, right, JoinAlgorithm.Left); // Right merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Right); Assert.Equal(merge.Rows.Count, right.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(merge["Int_right"][2], right["Int"][2]); - Assert.Null(merge["Int_left"][12]); + Assert.Equal(merge.Columns["Int_right"][2], right.Columns["Int"][2]); + Assert.Null(merge.Columns["Int_left"][12]); VerifyMerge(merge, left, right, JoinAlgorithm.Right); // Outer merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.FullOuter); Assert.Equal(16, merge.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Null(merge["Int_left"][12]); - Assert.Null(merge["Int_left"][5]); + Assert.Null(merge.Columns["Int_left"][12]); + Assert.Null(merge.Columns["Int_left"][5]); VerifyMerge(merge, left, right, JoinAlgorithm.FullOuter); // Inner merge merge = left.Merge(right, "Int", "Int", joinAlgorithm: JoinAlgorithm.Inner); Assert.Equal(9, merge.Rows.Count); Assert.Equal(merge.Columns.Count, left.Columns.Count + right.Columns.Count); - Assert.Equal(merge["Int_right"][2], right["Int"][2]); + Assert.Equal(merge.Columns["Int_right"][2], right.Columns["Int"][2]); VerifyMerge(merge, left, right, JoinAlgorithm.Inner); } @@ -1798,17 +1750,17 @@ public void TestFillNulls() public void TestValueCounts() { DataFrame df = MakeDataFrameWithAllColumnTypes(10, withNulls: false); - DataFrame valueCounts = df["Bool"].ValueCounts(); + DataFrame valueCounts = df.Columns["Bool"].ValueCounts(); Assert.Equal(2, valueCounts.Rows.Count); - Assert.Equal((long)5, valueCounts["Counts"][0]); - Assert.Equal((long)5, valueCounts["Counts"][1]); + Assert.Equal((long)5, valueCounts.Columns["Counts"][0]); + Assert.Equal((long)5, valueCounts.Columns["Counts"][1]); } [Fact] public void TestApplyElementwiseNullCount() { DataFrame df = MakeDataFrameWithTwoColumns(10); - Int32DataFrameColumn column = df["Int1"] as Int32DataFrameColumn; + Int32DataFrameColumn column = df.Columns["Int1"] as Int32DataFrameColumn; Assert.Equal(1, column.NullCount); // Change all existing values to null @@ -1850,7 +1802,7 @@ public void TestClone(int dfLength, int intDfLength) { DataFrame df = MakeDataFrameWithAllColumnTypes(dfLength, withNulls: true); DataFrame intDf = MakeDataFrameWithTwoColumns(intDfLength, false); - Int32DataFrameColumn intColumn = intDf["Int1"] as Int32DataFrameColumn; + Int32DataFrameColumn intColumn = intDf.Columns["Int1"] as Int32DataFrameColumn; DataFrame clone = df[intColumn]; Assert.Equal(intDfLength, clone.Rows.Count); Assert.Equal(df.Columns.Count, clone.Columns.Count); @@ -1869,7 +1821,7 @@ public void TestClone(int dfLength, int intDfLength) public void TestColumnCreationFromExisitingColumn() { DataFrame df = MakeDataFrameWithAllColumnTypes(10); - BooleanDataFrameColumn bigInts = new BooleanDataFrameColumn("BigInts", df["Int"].ElementwiseGreaterThan(5)); + BooleanDataFrameColumn bigInts = new BooleanDataFrameColumn("BigInts", df.Columns["Int"].ElementwiseGreaterThan(5)); for (int i = 0; i < 10; i++) { if (i <= 5) @@ -2036,41 +1988,41 @@ public void TestAppendRow() df.Append(new Dictionary { { "Column1", 5 } }, inPlace: true); Assert.Equal(15, df.Rows.Count); - Assert.Equal(15, df["Column1"].Length); - Assert.Equal(15, df["Column2"].Length); + Assert.Equal(15, df.Columns["Column1"].Length); + Assert.Equal(15, df.Columns["Column2"].Length); Assert.Equal(2, df.Columns[0].NullCount); Assert.Equal(4, df.Columns[1].NullCount); ret = df.Append(new Dictionary { { "Column1", 5 } }, inPlace: false); Assert.Equal(16, ret.Rows.Count); - Assert.Equal(16, ret["Column1"].Length); - Assert.Equal(16, ret["Column2"].Length); + Assert.Equal(16, ret.Columns["Column1"].Length); + Assert.Equal(16, ret.Columns["Column2"].Length); Assert.Equal(2, ret.Columns[0].NullCount); Assert.Equal(5, ret.Columns[1].NullCount); df.Append(new Dictionary { { "Column2", false } }, inPlace: true); Assert.Equal(16, df.Rows.Count); - Assert.Equal(16, df["Column1"].Length); - Assert.Equal(16, df["Column2"].Length); + Assert.Equal(16, df.Columns["Column1"].Length); + Assert.Equal(16, df.Columns["Column2"].Length); Assert.Equal(3, df.Columns[0].NullCount); Assert.Equal(4, df.Columns[1].NullCount); ret = df.Append(new Dictionary { { "Column2", false } }, inPlace: false); Assert.Equal(17, ret.Rows.Count); - Assert.Equal(17, ret["Column1"].Length); - Assert.Equal(17, ret["Column2"].Length); + Assert.Equal(17, ret.Columns["Column1"].Length); + Assert.Equal(17, ret.Columns["Column2"].Length); Assert.Equal(4, ret.Columns[0].NullCount); Assert.Equal(4, ret.Columns[1].NullCount); df.Append((IEnumerable)null, inPlace: true); Assert.Equal(17, df.Rows.Count); - Assert.Equal(17, df["Column1"].Length); - Assert.Equal(17, df["Column2"].Length); + Assert.Equal(17, df.Columns["Column1"].Length); + Assert.Equal(17, df.Columns["Column2"].Length); Assert.Equal(4, df.Columns[0].NullCount); Assert.Equal(5, df.Columns[1].NullCount); ret = df.Append((IEnumerable)null, inPlace: false); Assert.Equal(18, ret.Rows.Count); - Assert.Equal(18, ret["Column1"].Length); - Assert.Equal(18, ret["Column2"].Length); + Assert.Equal(18, ret.Columns["Column1"].Length); + Assert.Equal(18, ret.Columns["Column2"].Length); Assert.Equal(5, ret.Columns[0].NullCount); Assert.Equal(6, ret.Columns[1].NullCount); @@ -2081,20 +2033,20 @@ public void TestAppendRow() df.Append(inPlace: true); Assert.Equal(18, df.Rows.Count); - Assert.Equal(18, df["Column1"].Length); - Assert.Equal(18, df["Column2"].Length); + Assert.Equal(18, df.Columns["Column1"].Length); + Assert.Equal(18, df.Columns["Column2"].Length); Assert.Equal(5, df.Columns[0].NullCount); Assert.Equal(6, df.Columns[1].NullCount); ret = df.Append(inPlace: false); Assert.Equal(18, df.Rows.Count); - Assert.Equal(18, df["Column1"].Length); - Assert.Equal(18, df["Column2"].Length); + Assert.Equal(18, df.Columns["Column1"].Length); + Assert.Equal(18, df.Columns["Column2"].Length); Assert.Equal(5, df.Columns[0].NullCount); Assert.Equal(6, df.Columns[1].NullCount); Assert.Equal(19, ret.Rows.Count); - Assert.Equal(19, ret["Column1"].Length); - Assert.Equal(19, ret["Column2"].Length); + Assert.Equal(19, ret.Columns["Column1"].Length); + Assert.Equal(19, ret.Columns["Column2"].Length); Assert.Equal(6, ret.Columns[0].NullCount); Assert.Equal(7, ret.Columns[1].NullCount); } From 8d7fb66c6af65f61b8e074a7fa157e7c337b727d Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 19 Mar 2020 16:36:08 -0700 Subject: [PATCH 21/53] Add binary operations and operators on the exploded columns (#2867) * Generate combinations of binary operations and Add * Numeric Converters and CloneAsNumericColumns * Binary, Comparison and Shift operations * Clean up and bug fix * Fix the binary op apis to not be overridden * Internal constructors for exploded types * Proper return types for exploded types * Update unit tests * Update csproj * Revert "Fix the binary op apis to not be overridden" This reverts commit 2dc2240c9449930139c1492d1388d5e1f8ba5fa1. * Bug fix and unit test * Constructor that takes in a container * Unit tests * Call the implementation where possible * Review sq * sq * Cherry pick for next commit * sq * Undo unnecessary change * Rename to the system namespace column types * Address comments * Push to pull locally * Mimic C#'s arithmetic grammar in DataFrame * Address feedback * Reduce the number of partial column definitions * Address feedback --- .../ColumnArithmeticTemplate.ttinclude | 90 +- src/Microsoft.Data.Analysis/Converters.cs | 410 +- .../Microsoft.Data.Analysis.csproj | 26 +- .../PrimitiveColumnContainer.cs | 26 +- ...umn.BinaryOperationAPIs.ExplodedColumns.cs | 15832 ++++++++++++++++ ...umn.BinaryOperationAPIs.ExplodedColumns.tt | 606 + ...BinaryOperationImplementations.Exploded.cs | 2395 +++ ...BinaryOperationImplementations.Exploded.tt | 235 + ...ameColumn.BinaryOperations.Combinations.tt | 116 + ...mn.BinaryOperations.Combinations.ttinclude | 271 + ...imitiveDataFrameColumn.BinaryOperations.cs | 128 +- ...imitiveDataFrameColumn.BinaryOperations.tt | 16 +- ...rimitiveDataFrameColumn.BinaryOperators.cs | 7397 ++++++++ ...rimitiveDataFrameColumn.BinaryOperators.tt | 236 + .../PrimitiveDataFrameColumn.cs | 18 +- .../DataFrameColumn.BinaryOperationTests.cs | 2648 +++ .../DataFrameColumn.BinaryOperationTests.tt | 626 + .../DataFrameTests.cs | 57 +- .../Microsoft.Data.Analysis.Tests.csproj | 19 + 19 files changed, 30835 insertions(+), 317 deletions(-) create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperators.cs create mode 100644 src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperators.tt create mode 100644 tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs create mode 100644 tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt diff --git a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude index f97eea5a1e..9fc80f4a64 100644 --- a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude +++ b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude @@ -64,6 +64,38 @@ { typeFirstCharUpper = type[0].ToString().ToUpper() + type.Substring(1); } + if (typeFirstCharUpper == "Bool") + { + return "Boolean"; + } + else if (typeFirstCharUpper == "Float") + { + return "Single"; + } + else if (typeFirstCharUpper == "Int") + { + return "Int32"; + } + else if (typeFirstCharUpper == "Short") + { + return "Int16"; + } + else if (typeFirstCharUpper == "Long") + { + return "Int64"; + } + else if (typeFirstCharUpper == "UInt") + { + return "UInt32"; + } + else if (typeFirstCharUpper == "UShort") + { + return "UInt16"; + } + else if (typeFirstCharUpper == "ULong") + { + return "UInt64"; + } return typeFirstCharUpper; } @@ -88,6 +120,22 @@ return false; } + // These are a subset of the implicit conversions allowed in C#. They are used to generate the return type for binary ops + // https://github.com/dotnet/csharplang/blob/master/spec/conversions.md#implicit-numeric-conversions + public Dictionary> primitiveTypeToImplicitConversions = new Dictionary> { + {"sbyte", new List {"int", "long", "float", "double", "decimal"}}, + {"byte", new List {"int", "uint", "long", "ulong", "float", "double", "decimal"}}, + {"short", new List {"int", "long", "float", "double", "decimal"}}, + {"ushort", new List {"int", "uint", "long", "ulong", "float", "double", "decimal"}}, + {"int", new List {"int", "long", "float", "double", "decimal"}}, + {"uint", new List {"uint", "long", "ulong", "float", "double", "decimal"}}, + {"long", new List {"long", "float", "double", "decimal"}}, + {"ulong", new List {"ulong", "float", "double", "decimal"}}, + {"float", new List {"float", "double"}}, + {"double", new List {"double"}}, + {"decimal", new List {"decimal"}}, + }; + public TypeConfiguration[] typeConfiguration = new [] { new TypeConfiguration("bool", oneLiteral:"true", zeroLiteral:"false", supportsNumeric: false, unsupportedMethods: new[] {"LeftShift", "RightShift"}), @@ -105,28 +153,40 @@ new TypeConfiguration("ushort", classPrefix:"UShort", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}) }; - public string GetBinaryOperationReturnType(TypeConfiguration t1, TypeConfiguration t2) + public string GetBinaryShiftOperationReturnType(TypeConfiguration t1) { - int t1Level; - if (!primitiveTypeToPrimitivityLevelMap.TryGetValue(t1.TypeName, out t1Level)) - { - throw new Exception("Unknown type"); - } - int t2Level; - if (!primitiveTypeToPrimitivityLevelMap.TryGetValue(t2.TypeName, out t2Level)) + primitiveTypeToImplicitConversions.TryGetValue(t1.TypeName, out IReadOnlyList t1ImplicitConversions); + return t1ImplicitConversions.First() ?? string.Empty; + } + + public string GetBinaryOperationReturnType(string t1, string t2) + { + if (t1 == "long" && t2 == "ulong" || t1 == "ulong" && t2 == "long") { - throw new Exception("Unknown type"); + return string.Empty; } - if (t1Level + t2Level <= 2 * t1Level) + primitiveTypeToImplicitConversions.TryGetValue(t1, out IReadOnlyList t1ImplicitConversions); + primitiveTypeToImplicitConversions.TryGetValue(t2, out IReadOnlyList t2ImplicitConversions); + var intersection = t1ImplicitConversions.Intersect(t2ImplicitConversions); + string ret; + if (intersection.Count() == 0) { - return t1.TypeName; + ret = string.Empty; } - if (t1Level + t2Level <= 2 * t2Level) + else { - return t2.TypeName; + ret = intersection.First(); } - throw new Exception("Bug in GetBinaryOperationReturnType"); - return ""; + return ret; + } + + // Returns an empty string for binary ops that are not valid: For ex: float + decimal is NOT allowed. + // Special case: long + ulong is NOT allowed. The other mixed signed and unsigned are valid + public string GetBinaryOperationReturnType(TypeConfiguration t1, TypeConfiguration t2) + { + string t1Type = t1.TypeName; + string t2Type = t2.TypeName; + return GetBinaryOperationReturnType(t1Type, t2Type); } public enum MethodType diff --git a/src/Microsoft.Data.Analysis/Converters.cs b/src/Microsoft.Data.Analysis/Converters.cs index a3d2abc67c..a6900ea3f4 100644 --- a/src/Microsoft.Data.Analysis/Converters.cs +++ b/src/Microsoft.Data.Analysis/Converters.cs @@ -84,602 +84,602 @@ public sbyte GetSByte(sbyte value) return (sbyte)value; } } - internal interface IShortConverter + internal interface IInt16Converter { - short GetShort(T value); + short GetInt16(T value); } - internal static class ShortConverter + internal static class Int16Converter { - public static IShortConverter Instance { get; } = ShortConverter.GetShortConverter(); + public static IInt16Converter Instance { get; } = Int16Converter.GetInt16Converter(); } - internal static class ShortConverter + internal static class Int16Converter { - public static IShortConverter GetShortConverter() + public static IInt16Converter GetInt16Converter() { if (typeof(T) == typeof(byte)) { - return (IShortConverter)new ByteShortConverter(); + return (IInt16Converter)new ByteInt16Converter(); } if (typeof(T) == typeof(sbyte)) { - return (IShortConverter)new SByteShortConverter(); + return (IInt16Converter)new SByteInt16Converter(); } if (typeof(T) == typeof(short)) { - return (IShortConverter)new ShortShortConverter(); + return (IInt16Converter)new Int16Int16Converter(); } if (typeof(T) == typeof(ushort)) { - return (IShortConverter)new UShortShortConverter(); + return (IInt16Converter)new UInt16Int16Converter(); } throw new NotSupportedException(); } } - internal class ByteShortConverter : IShortConverter + internal class ByteInt16Converter : IInt16Converter { - public short GetShort(byte value) + public short GetInt16(byte value) { return (short)value; } } - internal class SByteShortConverter : IShortConverter + internal class SByteInt16Converter : IInt16Converter { - public short GetShort(sbyte value) + public short GetInt16(sbyte value) { return (short)value; } } - internal class ShortShortConverter : IShortConverter + internal class Int16Int16Converter : IInt16Converter { - public short GetShort(short value) + public short GetInt16(short value) { return (short)value; } } - internal class UShortShortConverter : IShortConverter + internal class UInt16Int16Converter : IInt16Converter { - public short GetShort(ushort value) + public short GetInt16(ushort value) { return (short)value; } } - internal interface IUShortConverter + internal interface IUInt16Converter { - ushort GetUShort(T value); + ushort GetUInt16(T value); } - internal static class UShortConverter + internal static class UInt16Converter { - public static IUShortConverter Instance { get; } = UShortConverter.GetUShortConverter(); + public static IUInt16Converter Instance { get; } = UInt16Converter.GetUInt16Converter(); } - internal static class UShortConverter + internal static class UInt16Converter { - public static IUShortConverter GetUShortConverter() + public static IUInt16Converter GetUInt16Converter() { if (typeof(T) == typeof(byte)) { - return (IUShortConverter)new ByteUShortConverter(); + return (IUInt16Converter)new ByteUInt16Converter(); } if (typeof(T) == typeof(sbyte)) { - return (IUShortConverter)new SByteUShortConverter(); + return (IUInt16Converter)new SByteUInt16Converter(); } if (typeof(T) == typeof(short)) { - return (IUShortConverter)new ShortUShortConverter(); + return (IUInt16Converter)new Int16UInt16Converter(); } if (typeof(T) == typeof(ushort)) { - return (IUShortConverter)new UShortUShortConverter(); + return (IUInt16Converter)new UInt16UInt16Converter(); } throw new NotSupportedException(); } } - internal class ByteUShortConverter : IUShortConverter + internal class ByteUInt16Converter : IUInt16Converter { - public ushort GetUShort(byte value) + public ushort GetUInt16(byte value) { return (ushort)value; } } - internal class SByteUShortConverter : IUShortConverter + internal class SByteUInt16Converter : IUInt16Converter { - public ushort GetUShort(sbyte value) + public ushort GetUInt16(sbyte value) { return (ushort)value; } } - internal class ShortUShortConverter : IUShortConverter + internal class Int16UInt16Converter : IUInt16Converter { - public ushort GetUShort(short value) + public ushort GetUInt16(short value) { return (ushort)value; } } - internal class UShortUShortConverter : IUShortConverter + internal class UInt16UInt16Converter : IUInt16Converter { - public ushort GetUShort(ushort value) + public ushort GetUInt16(ushort value) { return (ushort)value; } } - internal interface IIntConverter + internal interface IInt32Converter { - int GetInt(T value); + int GetInt32(T value); } - internal static class IntConverter + internal static class Int32Converter { - public static IIntConverter Instance { get; } = IntConverter.GetIntConverter(); + public static IInt32Converter Instance { get; } = Int32Converter.GetInt32Converter(); } - internal static class IntConverter + internal static class Int32Converter { - public static IIntConverter GetIntConverter() + public static IInt32Converter GetInt32Converter() { if (typeof(T) == typeof(byte)) { - return (IIntConverter)new ByteIntConverter(); + return (IInt32Converter)new ByteInt32Converter(); } if (typeof(T) == typeof(sbyte)) { - return (IIntConverter)new SByteIntConverter(); + return (IInt32Converter)new SByteInt32Converter(); } if (typeof(T) == typeof(short)) { - return (IIntConverter)new ShortIntConverter(); + return (IInt32Converter)new Int16Int32Converter(); } if (typeof(T) == typeof(ushort)) { - return (IIntConverter)new UShortIntConverter(); + return (IInt32Converter)new UInt16Int32Converter(); } if (typeof(T) == typeof(int)) { - return (IIntConverter)new IntIntConverter(); + return (IInt32Converter)new Int32Int32Converter(); } if (typeof(T) == typeof(uint)) { - return (IIntConverter)new UIntIntConverter(); + return (IInt32Converter)new UInt32Int32Converter(); } throw new NotSupportedException(); } } - internal class ByteIntConverter : IIntConverter + internal class ByteInt32Converter : IInt32Converter { - public int GetInt(byte value) + public int GetInt32(byte value) { return (int)value; } } - internal class SByteIntConverter : IIntConverter + internal class SByteInt32Converter : IInt32Converter { - public int GetInt(sbyte value) + public int GetInt32(sbyte value) { return (int)value; } } - internal class ShortIntConverter : IIntConverter + internal class Int16Int32Converter : IInt32Converter { - public int GetInt(short value) + public int GetInt32(short value) { return (int)value; } } - internal class UShortIntConverter : IIntConverter + internal class UInt16Int32Converter : IInt32Converter { - public int GetInt(ushort value) + public int GetInt32(ushort value) { return (int)value; } } - internal class IntIntConverter : IIntConverter + internal class Int32Int32Converter : IInt32Converter { - public int GetInt(int value) + public int GetInt32(int value) { return (int)value; } } - internal class UIntIntConverter : IIntConverter + internal class UInt32Int32Converter : IInt32Converter { - public int GetInt(uint value) + public int GetInt32(uint value) { return (int)value; } } - internal interface IUIntConverter + internal interface IUInt32Converter { - uint GetUInt(T value); + uint GetUInt32(T value); } - internal static class UIntConverter + internal static class UInt32Converter { - public static IUIntConverter Instance { get; } = UIntConverter.GetUIntConverter(); + public static IUInt32Converter Instance { get; } = UInt32Converter.GetUInt32Converter(); } - internal static class UIntConverter + internal static class UInt32Converter { - public static IUIntConverter GetUIntConverter() + public static IUInt32Converter GetUInt32Converter() { if (typeof(T) == typeof(byte)) { - return (IUIntConverter)new ByteUIntConverter(); + return (IUInt32Converter)new ByteUInt32Converter(); } if (typeof(T) == typeof(sbyte)) { - return (IUIntConverter)new SByteUIntConverter(); + return (IUInt32Converter)new SByteUInt32Converter(); } if (typeof(T) == typeof(short)) { - return (IUIntConverter)new ShortUIntConverter(); + return (IUInt32Converter)new Int16UInt32Converter(); } if (typeof(T) == typeof(ushort)) { - return (IUIntConverter)new UShortUIntConverter(); + return (IUInt32Converter)new UInt16UInt32Converter(); } if (typeof(T) == typeof(int)) { - return (IUIntConverter)new IntUIntConverter(); + return (IUInt32Converter)new Int32UInt32Converter(); } if (typeof(T) == typeof(uint)) { - return (IUIntConverter)new UIntUIntConverter(); + return (IUInt32Converter)new UInt32UInt32Converter(); } throw new NotSupportedException(); } } - internal class ByteUIntConverter : IUIntConverter + internal class ByteUInt32Converter : IUInt32Converter { - public uint GetUInt(byte value) + public uint GetUInt32(byte value) { return (uint)value; } } - internal class SByteUIntConverter : IUIntConverter + internal class SByteUInt32Converter : IUInt32Converter { - public uint GetUInt(sbyte value) + public uint GetUInt32(sbyte value) { return (uint)value; } } - internal class ShortUIntConverter : IUIntConverter + internal class Int16UInt32Converter : IUInt32Converter { - public uint GetUInt(short value) + public uint GetUInt32(short value) { return (uint)value; } } - internal class UShortUIntConverter : IUIntConverter + internal class UInt16UInt32Converter : IUInt32Converter { - public uint GetUInt(ushort value) + public uint GetUInt32(ushort value) { return (uint)value; } } - internal class IntUIntConverter : IUIntConverter + internal class Int32UInt32Converter : IUInt32Converter { - public uint GetUInt(int value) + public uint GetUInt32(int value) { return (uint)value; } } - internal class UIntUIntConverter : IUIntConverter + internal class UInt32UInt32Converter : IUInt32Converter { - public uint GetUInt(uint value) + public uint GetUInt32(uint value) { return (uint)value; } } - internal interface ILongConverter + internal interface IInt64Converter { - long GetLong(T value); + long GetInt64(T value); } - internal static class LongConverter + internal static class Int64Converter { - public static ILongConverter Instance { get; } = LongConverter.GetLongConverter(); + public static IInt64Converter Instance { get; } = Int64Converter.GetInt64Converter(); } - internal static class LongConverter + internal static class Int64Converter { - public static ILongConverter GetLongConverter() + public static IInt64Converter GetInt64Converter() { if (typeof(T) == typeof(byte)) { - return (ILongConverter)new ByteLongConverter(); + return (IInt64Converter)new ByteInt64Converter(); } if (typeof(T) == typeof(sbyte)) { - return (ILongConverter)new SByteLongConverter(); + return (IInt64Converter)new SByteInt64Converter(); } if (typeof(T) == typeof(short)) { - return (ILongConverter)new ShortLongConverter(); + return (IInt64Converter)new Int16Int64Converter(); } if (typeof(T) == typeof(ushort)) { - return (ILongConverter)new UShortLongConverter(); + return (IInt64Converter)new UInt16Int64Converter(); } if (typeof(T) == typeof(int)) { - return (ILongConverter)new IntLongConverter(); + return (IInt64Converter)new Int32Int64Converter(); } if (typeof(T) == typeof(uint)) { - return (ILongConverter)new UIntLongConverter(); + return (IInt64Converter)new UInt32Int64Converter(); } if (typeof(T) == typeof(long)) { - return (ILongConverter)new LongLongConverter(); + return (IInt64Converter)new Int64Int64Converter(); } if (typeof(T) == typeof(ulong)) { - return (ILongConverter)new ULongLongConverter(); + return (IInt64Converter)new UInt64Int64Converter(); } throw new NotSupportedException(); } } - internal class ByteLongConverter : ILongConverter + internal class ByteInt64Converter : IInt64Converter { - public long GetLong(byte value) + public long GetInt64(byte value) { return (long)value; } } - internal class SByteLongConverter : ILongConverter + internal class SByteInt64Converter : IInt64Converter { - public long GetLong(sbyte value) + public long GetInt64(sbyte value) { return (long)value; } } - internal class ShortLongConverter : ILongConverter + internal class Int16Int64Converter : IInt64Converter { - public long GetLong(short value) + public long GetInt64(short value) { return (long)value; } } - internal class UShortLongConverter : ILongConverter + internal class UInt16Int64Converter : IInt64Converter { - public long GetLong(ushort value) + public long GetInt64(ushort value) { return (long)value; } } - internal class IntLongConverter : ILongConverter + internal class Int32Int64Converter : IInt64Converter { - public long GetLong(int value) + public long GetInt64(int value) { return (long)value; } } - internal class UIntLongConverter : ILongConverter + internal class UInt32Int64Converter : IInt64Converter { - public long GetLong(uint value) + public long GetInt64(uint value) { return (long)value; } } - internal class LongLongConverter : ILongConverter + internal class Int64Int64Converter : IInt64Converter { - public long GetLong(long value) + public long GetInt64(long value) { return (long)value; } } - internal class ULongLongConverter : ILongConverter + internal class UInt64Int64Converter : IInt64Converter { - public long GetLong(ulong value) + public long GetInt64(ulong value) { return (long)value; } } - internal interface IULongConverter + internal interface IUInt64Converter { - ulong GetULong(T value); + ulong GetUInt64(T value); } - internal static class ULongConverter + internal static class UInt64Converter { - public static IULongConverter Instance { get; } = ULongConverter.GetULongConverter(); + public static IUInt64Converter Instance { get; } = UInt64Converter.GetUInt64Converter(); } - internal static class ULongConverter + internal static class UInt64Converter { - public static IULongConverter GetULongConverter() + public static IUInt64Converter GetUInt64Converter() { if (typeof(T) == typeof(byte)) { - return (IULongConverter)new ByteULongConverter(); + return (IUInt64Converter)new ByteUInt64Converter(); } if (typeof(T) == typeof(sbyte)) { - return (IULongConverter)new SByteULongConverter(); + return (IUInt64Converter)new SByteUInt64Converter(); } if (typeof(T) == typeof(short)) { - return (IULongConverter)new ShortULongConverter(); + return (IUInt64Converter)new Int16UInt64Converter(); } if (typeof(T) == typeof(ushort)) { - return (IULongConverter)new UShortULongConverter(); + return (IUInt64Converter)new UInt16UInt64Converter(); } if (typeof(T) == typeof(int)) { - return (IULongConverter)new IntULongConverter(); + return (IUInt64Converter)new Int32UInt64Converter(); } if (typeof(T) == typeof(uint)) { - return (IULongConverter)new UIntULongConverter(); + return (IUInt64Converter)new UInt32UInt64Converter(); } if (typeof(T) == typeof(long)) { - return (IULongConverter)new LongULongConverter(); + return (IUInt64Converter)new Int64UInt64Converter(); } if (typeof(T) == typeof(ulong)) { - return (IULongConverter)new ULongULongConverter(); + return (IUInt64Converter)new UInt64UInt64Converter(); } throw new NotSupportedException(); } } - internal class ByteULongConverter : IULongConverter + internal class ByteUInt64Converter : IUInt64Converter { - public ulong GetULong(byte value) + public ulong GetUInt64(byte value) { return (ulong)value; } } - internal class SByteULongConverter : IULongConverter + internal class SByteUInt64Converter : IUInt64Converter { - public ulong GetULong(sbyte value) + public ulong GetUInt64(sbyte value) { return (ulong)value; } } - internal class ShortULongConverter : IULongConverter + internal class Int16UInt64Converter : IUInt64Converter { - public ulong GetULong(short value) + public ulong GetUInt64(short value) { return (ulong)value; } } - internal class UShortULongConverter : IULongConverter + internal class UInt16UInt64Converter : IUInt64Converter { - public ulong GetULong(ushort value) + public ulong GetUInt64(ushort value) { return (ulong)value; } } - internal class IntULongConverter : IULongConverter + internal class Int32UInt64Converter : IUInt64Converter { - public ulong GetULong(int value) + public ulong GetUInt64(int value) { return (ulong)value; } } - internal class UIntULongConverter : IULongConverter + internal class UInt32UInt64Converter : IUInt64Converter { - public ulong GetULong(uint value) + public ulong GetUInt64(uint value) { return (ulong)value; } } - internal class LongULongConverter : IULongConverter + internal class Int64UInt64Converter : IUInt64Converter { - public ulong GetULong(long value) + public ulong GetUInt64(long value) { return (ulong)value; } } - internal class ULongULongConverter : IULongConverter + internal class UInt64UInt64Converter : IUInt64Converter { - public ulong GetULong(ulong value) + public ulong GetUInt64(ulong value) { return (ulong)value; } } - internal interface IFloatConverter + internal interface ISingleConverter { - float GetFloat(T value); + float GetSingle(T value); } - internal static class FloatConverter + internal static class SingleConverter { - public static IFloatConverter Instance { get; } = FloatConverter.GetFloatConverter(); + public static ISingleConverter Instance { get; } = SingleConverter.GetSingleConverter(); } - internal static class FloatConverter + internal static class SingleConverter { - public static IFloatConverter GetFloatConverter() + public static ISingleConverter GetSingleConverter() { if (typeof(T) == typeof(byte)) { - return (IFloatConverter)new ByteFloatConverter(); + return (ISingleConverter)new ByteSingleConverter(); } if (typeof(T) == typeof(sbyte)) { - return (IFloatConverter)new SByteFloatConverter(); + return (ISingleConverter)new SByteSingleConverter(); } if (typeof(T) == typeof(short)) { - return (IFloatConverter)new ShortFloatConverter(); + return (ISingleConverter)new Int16SingleConverter(); } if (typeof(T) == typeof(ushort)) { - return (IFloatConverter)new UShortFloatConverter(); + return (ISingleConverter)new UInt16SingleConverter(); } if (typeof(T) == typeof(int)) { - return (IFloatConverter)new IntFloatConverter(); + return (ISingleConverter)new Int32SingleConverter(); } if (typeof(T) == typeof(uint)) { - return (IFloatConverter)new UIntFloatConverter(); + return (ISingleConverter)new UInt32SingleConverter(); } if (typeof(T) == typeof(long)) { - return (IFloatConverter)new LongFloatConverter(); + return (ISingleConverter)new Int64SingleConverter(); } if (typeof(T) == typeof(ulong)) { - return (IFloatConverter)new ULongFloatConverter(); + return (ISingleConverter)new UInt64SingleConverter(); } if (typeof(T) == typeof(float)) { - return (IFloatConverter)new FloatFloatConverter(); + return (ISingleConverter)new SingleSingleConverter(); } throw new NotSupportedException(); } } - internal class ByteFloatConverter : IFloatConverter + internal class ByteSingleConverter : ISingleConverter { - public float GetFloat(byte value) + public float GetSingle(byte value) { return (float)value; } } - internal class SByteFloatConverter : IFloatConverter + internal class SByteSingleConverter : ISingleConverter { - public float GetFloat(sbyte value) + public float GetSingle(sbyte value) { return (float)value; } } - internal class ShortFloatConverter : IFloatConverter + internal class Int16SingleConverter : ISingleConverter { - public float GetFloat(short value) + public float GetSingle(short value) { return (float)value; } } - internal class UShortFloatConverter : IFloatConverter + internal class UInt16SingleConverter : ISingleConverter { - public float GetFloat(ushort value) + public float GetSingle(ushort value) { return (float)value; } } - internal class IntFloatConverter : IFloatConverter + internal class Int32SingleConverter : ISingleConverter { - public float GetFloat(int value) + public float GetSingle(int value) { return (float)value; } } - internal class UIntFloatConverter : IFloatConverter + internal class UInt32SingleConverter : ISingleConverter { - public float GetFloat(uint value) + public float GetSingle(uint value) { return (float)value; } } - internal class LongFloatConverter : IFloatConverter + internal class Int64SingleConverter : ISingleConverter { - public float GetFloat(long value) + public float GetSingle(long value) { return (float)value; } } - internal class ULongFloatConverter : IFloatConverter + internal class UInt64SingleConverter : ISingleConverter { - public float GetFloat(ulong value) + public float GetSingle(ulong value) { return (float)value; } } - internal class FloatFloatConverter : IFloatConverter + internal class SingleSingleConverter : ISingleConverter { - public float GetFloat(float value) + public float GetSingle(float value) { return (float)value; } @@ -706,31 +706,31 @@ public static IDoubleConverter GetDoubleConverter() } if (typeof(T) == typeof(short)) { - return (IDoubleConverter)new ShortDoubleConverter(); + return (IDoubleConverter)new Int16DoubleConverter(); } if (typeof(T) == typeof(ushort)) { - return (IDoubleConverter)new UShortDoubleConverter(); + return (IDoubleConverter)new UInt16DoubleConverter(); } if (typeof(T) == typeof(int)) { - return (IDoubleConverter)new IntDoubleConverter(); + return (IDoubleConverter)new Int32DoubleConverter(); } if (typeof(T) == typeof(uint)) { - return (IDoubleConverter)new UIntDoubleConverter(); + return (IDoubleConverter)new UInt32DoubleConverter(); } if (typeof(T) == typeof(long)) { - return (IDoubleConverter)new LongDoubleConverter(); + return (IDoubleConverter)new Int64DoubleConverter(); } if (typeof(T) == typeof(ulong)) { - return (IDoubleConverter)new ULongDoubleConverter(); + return (IDoubleConverter)new UInt64DoubleConverter(); } if (typeof(T) == typeof(float)) { - return (IDoubleConverter)new FloatDoubleConverter(); + return (IDoubleConverter)new SingleDoubleConverter(); } if (typeof(T) == typeof(double)) { @@ -753,49 +753,49 @@ public double GetDouble(sbyte value) return (double)value; } } - internal class ShortDoubleConverter : IDoubleConverter + internal class Int16DoubleConverter : IDoubleConverter { public double GetDouble(short value) { return (double)value; } } - internal class UShortDoubleConverter : IDoubleConverter + internal class UInt16DoubleConverter : IDoubleConverter { public double GetDouble(ushort value) { return (double)value; } } - internal class IntDoubleConverter : IDoubleConverter + internal class Int32DoubleConverter : IDoubleConverter { public double GetDouble(int value) { return (double)value; } } - internal class UIntDoubleConverter : IDoubleConverter + internal class UInt32DoubleConverter : IDoubleConverter { public double GetDouble(uint value) { return (double)value; } } - internal class LongDoubleConverter : IDoubleConverter + internal class Int64DoubleConverter : IDoubleConverter { public double GetDouble(long value) { return (double)value; } } - internal class ULongDoubleConverter : IDoubleConverter + internal class UInt64DoubleConverter : IDoubleConverter { public double GetDouble(ulong value) { return (double)value; } } - internal class FloatDoubleConverter : IDoubleConverter + internal class SingleDoubleConverter : IDoubleConverter { public double GetDouble(float value) { @@ -831,31 +831,31 @@ public static IDecimalConverter GetDecimalConverter() } if (typeof(T) == typeof(short)) { - return (IDecimalConverter)new ShortDecimalConverter(); + return (IDecimalConverter)new Int16DecimalConverter(); } if (typeof(T) == typeof(ushort)) { - return (IDecimalConverter)new UShortDecimalConverter(); + return (IDecimalConverter)new UInt16DecimalConverter(); } if (typeof(T) == typeof(int)) { - return (IDecimalConverter)new IntDecimalConverter(); + return (IDecimalConverter)new Int32DecimalConverter(); } if (typeof(T) == typeof(uint)) { - return (IDecimalConverter)new UIntDecimalConverter(); + return (IDecimalConverter)new UInt32DecimalConverter(); } if (typeof(T) == typeof(long)) { - return (IDecimalConverter)new LongDecimalConverter(); + return (IDecimalConverter)new Int64DecimalConverter(); } if (typeof(T) == typeof(ulong)) { - return (IDecimalConverter)new ULongDecimalConverter(); + return (IDecimalConverter)new UInt64DecimalConverter(); } if (typeof(T) == typeof(float)) { - return (IDecimalConverter)new FloatDecimalConverter(); + return (IDecimalConverter)new SingleDecimalConverter(); } if (typeof(T) == typeof(double)) { @@ -882,49 +882,49 @@ public decimal GetDecimal(sbyte value) return (decimal)value; } } - internal class ShortDecimalConverter : IDecimalConverter + internal class Int16DecimalConverter : IDecimalConverter { public decimal GetDecimal(short value) { return (decimal)value; } } - internal class UShortDecimalConverter : IDecimalConverter + internal class UInt16DecimalConverter : IDecimalConverter { public decimal GetDecimal(ushort value) { return (decimal)value; } } - internal class IntDecimalConverter : IDecimalConverter + internal class Int32DecimalConverter : IDecimalConverter { public decimal GetDecimal(int value) { return (decimal)value; } } - internal class UIntDecimalConverter : IDecimalConverter + internal class UInt32DecimalConverter : IDecimalConverter { public decimal GetDecimal(uint value) { return (decimal)value; } } - internal class LongDecimalConverter : IDecimalConverter + internal class Int64DecimalConverter : IDecimalConverter { public decimal GetDecimal(long value) { return (decimal)value; } } - internal class ULongDecimalConverter : IDecimalConverter + internal class UInt64DecimalConverter : IDecimalConverter { public decimal GetDecimal(ulong value) { return (decimal)value; } } - internal class FloatDecimalConverter : IDecimalConverter + internal class SingleDecimalConverter : IDecimalConverter { public decimal GetDecimal(float value) { diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 7071a50700..1d1e345e73 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -18,6 +18,11 @@ True Converters.tt + + True + True + PrimitiveDataFrameColumn.BinaryOperators.tt + @@ -34,9 +39,13 @@ TextTemplatingFileGenerator Converters.cs - + TextTemplatingFileGenerator - DataFrameColumn.BinaryOperations.ExplodedColumns.cs + PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs TextTemplatingFileGenerator @@ -118,21 +127,26 @@ - + True True - ColumnArithmeticTemplate.ttinclude + Converters.tt - + True True - Converters.tt + PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt True True DataFrameColumn.BinaryOperations.tt + + True + True + PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt + True True diff --git a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs index 45521c137e..2e04f63fee 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveColumnContainer.cs @@ -6,6 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; @@ -608,7 +609,16 @@ internal PrimitiveColumnContainer CloneAsBoolContainer() DataFrameBuffer newBuffer = new DataFrameBuffer(); ret.Buffers.Add(newBuffer); newBuffer.EnsureCapacity(buffer.Length); - newBuffer.Span.Fill(false); + if (typeof(T) == typeof(bool)) + { + var localBuffer = buffer; + ReadOnlyDataFrameBuffer boolLocalBuffer = Unsafe.As, ReadOnlyDataFrameBuffer>(ref localBuffer); + boolLocalBuffer.ReadOnlySpan.TryCopyTo(newBuffer.RawSpan); + } + else + { + newBuffer.Span.Fill(false); + } newBuffer.Length = buffer.Length; ret.Length += buffer.Length; } @@ -709,7 +719,7 @@ internal PrimitiveColumnContainer CloneAsShortContainer() ReadOnlySpan span = buffer.ReadOnlySpan; for (int i = 0; i < span.Length; i++) { - newBuffer.Append(ShortConverter.Instance.GetShort(span[i])); + newBuffer.Append(Int16Converter.Instance.GetInt16(span[i])); } } ret.NullBitMapBuffers = CloneNullBitMapBuffers(); @@ -729,7 +739,7 @@ internal PrimitiveColumnContainer CloneAsUShortContainer() ReadOnlySpan span = buffer.ReadOnlySpan; for (int i = 0; i < span.Length; i++) { - newBuffer.Append(UShortConverter.Instance.GetUShort(span[i])); + newBuffer.Append(UInt16Converter.Instance.GetUInt16(span[i])); } } ret.NullBitMapBuffers = CloneNullBitMapBuffers(); @@ -749,7 +759,7 @@ internal PrimitiveColumnContainer CloneAsIntContainer() ReadOnlySpan span = buffer.ReadOnlySpan; for (int i = 0; i < span.Length; i++) { - newBuffer.Append(IntConverter.Instance.GetInt(span[i])); + newBuffer.Append(Int32Converter.Instance.GetInt32(span[i])); } } ret.NullBitMapBuffers = CloneNullBitMapBuffers(); @@ -769,7 +779,7 @@ internal PrimitiveColumnContainer CloneAsUIntContainer() ReadOnlySpan span = buffer.ReadOnlySpan; for (int i = 0; i < span.Length; i++) { - newBuffer.Append(UIntConverter.Instance.GetUInt(span[i])); + newBuffer.Append(UInt32Converter.Instance.GetUInt32(span[i])); } } ret.NullBitMapBuffers = CloneNullBitMapBuffers(); @@ -789,7 +799,7 @@ internal PrimitiveColumnContainer CloneAsLongContainer() ReadOnlySpan span = buffer.ReadOnlySpan; for (int i = 0; i < span.Length; i++) { - newBuffer.Append(LongConverter.Instance.GetLong(span[i])); + newBuffer.Append(Int64Converter.Instance.GetInt64(span[i])); } } ret.NullBitMapBuffers = CloneNullBitMapBuffers(); @@ -809,7 +819,7 @@ internal PrimitiveColumnContainer CloneAsULongContainer() ReadOnlySpan span = buffer.ReadOnlySpan; for (int i = 0; i < span.Length; i++) { - newBuffer.Append(ULongConverter.Instance.GetULong(span[i])); + newBuffer.Append(UInt64Converter.Instance.GetUInt64(span[i])); } } ret.NullBitMapBuffers = CloneNullBitMapBuffers(); @@ -829,7 +839,7 @@ internal PrimitiveColumnContainer CloneAsFloatContainer() ReadOnlySpan span = buffer.ReadOnlySpan; for (int i = 0; i < span.Length; i++) { - newBuffer.Append(FloatConverter.Instance.GetFloat(span[i])); + newBuffer.Append(SingleConverter.Instance.GetSingle(span[i])); } } ret.NullBitMapBuffers = CloneNullBitMapBuffers(); diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs new file mode 100644 index 0000000000..51258d1d77 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs @@ -0,0 +1,15832 @@ + + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class ByteDataFrameColumn + { + public Int32DataFrameColumn Add(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Subtract(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Multiply(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Divide(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Modulo(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Add(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Subtract(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Multiply(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Divide(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Modulo(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Add(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public UInt32DataFrameColumn Add(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.AddImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Subtract(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.SubtractImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Multiply(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.MultiplyImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Divide(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.DivideImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Modulo(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ModuloImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Add(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.AddImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Subtract(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.SubtractImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Multiply(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.MultiplyImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Divide(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.DivideImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Modulo(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + } + public partial class DecimalDataFrameColumn + { + public DecimalDataFrameColumn Add(ByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return AddImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Subtract(ByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return SubtractImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Multiply(ByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return MultiplyImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Divide(ByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return DivideImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Modulo(ByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ModuloImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column, bool inPlace = false) + { + return AddImplementation(column, inPlace); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column, bool inPlace = false) + { + return SubtractImplementation(column, inPlace); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column, bool inPlace = false) + { + return MultiplyImplementation(column, inPlace); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column, bool inPlace = false) + { + return DivideImplementation(column, inPlace); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column, bool inPlace = false) + { + return ModuloImplementation(column, inPlace); + } + public DecimalDataFrameColumn Add(Int32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return AddImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Subtract(Int32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return SubtractImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Multiply(Int32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return MultiplyImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Divide(Int32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return DivideImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Modulo(Int32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ModuloImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Add(Int64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return AddImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Subtract(Int64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return SubtractImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Multiply(Int64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return MultiplyImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Divide(Int64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return DivideImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Modulo(Int64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ModuloImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Add(SByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return AddImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Subtract(SByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return SubtractImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Multiply(SByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return MultiplyImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Divide(SByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return DivideImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Modulo(SByteDataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ModuloImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Add(Int16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return AddImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Subtract(Int16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return SubtractImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Multiply(Int16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return MultiplyImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Divide(Int16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return DivideImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Modulo(Int16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ModuloImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Add(UInt32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return AddImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Subtract(UInt32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return SubtractImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Multiply(UInt32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return MultiplyImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Divide(UInt32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return DivideImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Modulo(UInt32DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ModuloImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Add(UInt64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return AddImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Subtract(UInt64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return SubtractImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Multiply(UInt64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return MultiplyImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Divide(UInt64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return DivideImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Modulo(UInt64DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ModuloImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Add(UInt16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return AddImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Subtract(UInt16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return SubtractImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Multiply(UInt16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return MultiplyImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Divide(UInt16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return DivideImplementation(otherdecimalColumn, inPlace); + } + public DecimalDataFrameColumn Modulo(UInt16DataFrameColumn column, bool inPlace = false) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ModuloImplementation(otherdecimalColumn, inPlace); + } + } + public partial class DoubleDataFrameColumn + { + public DoubleDataFrameColumn Add(ByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(ByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(ByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(ByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(ByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column, bool inPlace = false) + { + return AddImplementation(column, inPlace); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column, bool inPlace = false) + { + return SubtractImplementation(column, inPlace); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column, bool inPlace = false) + { + return MultiplyImplementation(column, inPlace); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column, bool inPlace = false) + { + return DivideImplementation(column, inPlace); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column, bool inPlace = false) + { + return ModuloImplementation(column, inPlace); + } + public DoubleDataFrameColumn Add(SingleDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(SingleDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(SingleDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(SingleDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(SingleDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Add(Int32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(Int32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(Int32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(Int32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(Int32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Add(Int64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(Int64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(Int64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(Int64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(Int64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Add(SByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(SByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(SByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(SByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(SByteDataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Add(Int16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(Int16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(Int16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(Int16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(Int16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Add(UInt32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(UInt32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(UInt32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(UInt32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(UInt32DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Add(UInt64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(UInt64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(UInt64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(UInt64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(UInt64DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Add(UInt16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return AddImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Subtract(UInt16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return SubtractImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Multiply(UInt16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return MultiplyImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Divide(UInt16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return DivideImplementation(otherdoubleColumn, inPlace); + } + public DoubleDataFrameColumn Modulo(UInt16DataFrameColumn column, bool inPlace = false) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ModuloImplementation(otherdoubleColumn, inPlace); + } + } + public partial class SingleDataFrameColumn + { + public SingleDataFrameColumn Add(ByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return AddImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Subtract(ByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return SubtractImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Multiply(ByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return MultiplyImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Divide(ByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return DivideImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Modulo(ByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ModuloImplementation(otherfloatColumn, inPlace); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column, bool inPlace = false) + { + return AddImplementation(column, inPlace); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column, bool inPlace = false) + { + return SubtractImplementation(column, inPlace); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column, bool inPlace = false) + { + return MultiplyImplementation(column, inPlace); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column, bool inPlace = false) + { + return DivideImplementation(column, inPlace); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column, bool inPlace = false) + { + return ModuloImplementation(column, inPlace); + } + public SingleDataFrameColumn Add(Int32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return AddImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Subtract(Int32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return SubtractImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Multiply(Int32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return MultiplyImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Divide(Int32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return DivideImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Modulo(Int32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ModuloImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Add(Int64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return AddImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Subtract(Int64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return SubtractImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Multiply(Int64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return MultiplyImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Divide(Int64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return DivideImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Modulo(Int64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ModuloImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Add(SByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return AddImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Subtract(SByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return SubtractImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Multiply(SByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return MultiplyImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Divide(SByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return DivideImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Modulo(SByteDataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ModuloImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Add(Int16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return AddImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Subtract(Int16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return SubtractImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Multiply(Int16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return MultiplyImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Divide(Int16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return DivideImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Modulo(Int16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ModuloImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Add(UInt32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return AddImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Subtract(UInt32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return SubtractImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Multiply(UInt32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return MultiplyImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Divide(UInt32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return DivideImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Modulo(UInt32DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ModuloImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Add(UInt64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return AddImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Subtract(UInt64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return SubtractImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Multiply(UInt64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return MultiplyImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Divide(UInt64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return DivideImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Modulo(UInt64DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ModuloImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Add(UInt16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return AddImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Subtract(UInt16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return SubtractImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Multiply(UInt16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return MultiplyImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Divide(UInt16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return DivideImplementation(otherfloatColumn, inPlace); + } + public SingleDataFrameColumn Modulo(UInt16DataFrameColumn column, bool inPlace = false) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ModuloImplementation(otherfloatColumn, inPlace); + } + } + public partial class Int32DataFrameColumn + { + public Int32DataFrameColumn Add(ByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return AddImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Subtract(ByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return SubtractImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Multiply(ByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return MultiplyImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Divide(ByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return DivideImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Modulo(ByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ModuloImplementation(otherintColumn, inPlace); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(Int32DataFrameColumn column, bool inPlace = false) + { + return AddImplementation(column, inPlace); + } + public Int32DataFrameColumn Subtract(Int32DataFrameColumn column, bool inPlace = false) + { + return SubtractImplementation(column, inPlace); + } + public Int32DataFrameColumn Multiply(Int32DataFrameColumn column, bool inPlace = false) + { + return MultiplyImplementation(column, inPlace); + } + public Int32DataFrameColumn Divide(Int32DataFrameColumn column, bool inPlace = false) + { + return DivideImplementation(column, inPlace); + } + public Int32DataFrameColumn Modulo(Int32DataFrameColumn column, bool inPlace = false) + { + return ModuloImplementation(column, inPlace); + } + public Int64DataFrameColumn Add(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Subtract(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Multiply(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Divide(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Modulo(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(SByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return AddImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Subtract(SByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return SubtractImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Multiply(SByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return MultiplyImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Divide(SByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return DivideImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Modulo(SByteDataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ModuloImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Add(Int16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return AddImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Subtract(Int16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return SubtractImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Multiply(Int16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return MultiplyImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Divide(Int16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return DivideImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Modulo(Int16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ModuloImplementation(otherintColumn, inPlace); + } + public Int64DataFrameColumn Add(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.AddImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Subtract(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.SubtractImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Multiply(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.MultiplyImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Divide(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.DivideImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Modulo(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.ModuloImplementation(otherlongColumn, inPlace: true); + } + public SingleDataFrameColumn Add(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.AddImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Subtract(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Multiply(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Divide(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.DivideImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Modulo(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(otherfloatColumn, inPlace: true); + } + public Int32DataFrameColumn Add(UInt16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return AddImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Subtract(UInt16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return SubtractImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Multiply(UInt16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return MultiplyImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Divide(UInt16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return DivideImplementation(otherintColumn, inPlace); + } + public Int32DataFrameColumn Modulo(UInt16DataFrameColumn column, bool inPlace = false) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ModuloImplementation(otherintColumn, inPlace); + } + } + public partial class Int64DataFrameColumn + { + public Int64DataFrameColumn Add(ByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return AddImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Subtract(ByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return SubtractImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Multiply(ByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return MultiplyImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Divide(ByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return DivideImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Modulo(ByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ModuloImplementation(otherlongColumn, inPlace); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Add(Int32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return AddImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Subtract(Int32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return SubtractImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Multiply(Int32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return MultiplyImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Divide(Int32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return DivideImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Modulo(Int32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ModuloImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Add(Int64DataFrameColumn column, bool inPlace = false) + { + return AddImplementation(column, inPlace); + } + public Int64DataFrameColumn Subtract(Int64DataFrameColumn column, bool inPlace = false) + { + return SubtractImplementation(column, inPlace); + } + public Int64DataFrameColumn Multiply(Int64DataFrameColumn column, bool inPlace = false) + { + return MultiplyImplementation(column, inPlace); + } + public Int64DataFrameColumn Divide(Int64DataFrameColumn column, bool inPlace = false) + { + return DivideImplementation(column, inPlace); + } + public Int64DataFrameColumn Modulo(Int64DataFrameColumn column, bool inPlace = false) + { + return ModuloImplementation(column, inPlace); + } + public Int64DataFrameColumn Add(SByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return AddImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Subtract(SByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return SubtractImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Multiply(SByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return MultiplyImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Divide(SByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return DivideImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Modulo(SByteDataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ModuloImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Add(Int16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return AddImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Subtract(Int16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return SubtractImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Multiply(Int16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return MultiplyImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Divide(Int16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return DivideImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Modulo(Int16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ModuloImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Add(UInt32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return AddImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Subtract(UInt32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return SubtractImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Multiply(UInt32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return MultiplyImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Divide(UInt32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return DivideImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Modulo(UInt32DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ModuloImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Add(UInt16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return AddImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Subtract(UInt16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return SubtractImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Multiply(UInt16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return MultiplyImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Divide(UInt16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return DivideImplementation(otherlongColumn, inPlace); + } + public Int64DataFrameColumn Modulo(UInt16DataFrameColumn column, bool inPlace = false) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ModuloImplementation(otherlongColumn, inPlace); + } + } + public partial class SByteDataFrameColumn + { + public Int32DataFrameColumn Add(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Subtract(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Multiply(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Divide(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Modulo(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Add(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Subtract(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Multiply(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Divide(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Modulo(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Add(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public Int64DataFrameColumn Add(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.AddImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Subtract(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.SubtractImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Multiply(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.MultiplyImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Divide(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.DivideImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Modulo(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.ModuloImplementation(otherlongColumn, inPlace: true); + } + public SingleDataFrameColumn Add(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.AddImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Subtract(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Multiply(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Divide(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.DivideImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Modulo(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(otherfloatColumn, inPlace: true); + } + public Int32DataFrameColumn Add(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + } + public partial class Int16DataFrameColumn + { + public Int32DataFrameColumn Add(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Subtract(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Multiply(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Divide(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Modulo(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Add(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Subtract(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Multiply(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Divide(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Modulo(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Add(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public Int64DataFrameColumn Add(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.AddImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Subtract(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.SubtractImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Multiply(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.MultiplyImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Divide(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.DivideImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Modulo(UInt32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.ModuloImplementation(otherlongColumn, inPlace: true); + } + public SingleDataFrameColumn Add(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.AddImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Subtract(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Multiply(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Divide(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.DivideImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Modulo(UInt64DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(otherfloatColumn, inPlace: true); + } + public Int32DataFrameColumn Add(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + } + public partial class UInt32DataFrameColumn + { + public UInt32DataFrameColumn Add(ByteDataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return AddImplementation(otheruintColumn, inPlace); + } + public UInt32DataFrameColumn Subtract(ByteDataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return SubtractImplementation(otheruintColumn, inPlace); + } + public UInt32DataFrameColumn Multiply(ByteDataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return MultiplyImplementation(otheruintColumn, inPlace); + } + public UInt32DataFrameColumn Divide(ByteDataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return DivideImplementation(otheruintColumn, inPlace); + } + public UInt32DataFrameColumn Modulo(ByteDataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ModuloImplementation(otheruintColumn, inPlace); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Add(Int32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.AddImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Subtract(Int32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.SubtractImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Multiply(Int32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.MultiplyImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Divide(Int32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.DivideImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Modulo(Int32DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.ModuloImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Add(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Subtract(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Multiply(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Divide(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Modulo(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Add(SByteDataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.AddImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Subtract(SByteDataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.SubtractImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Multiply(SByteDataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.MultiplyImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Divide(SByteDataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.DivideImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Modulo(SByteDataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.ModuloImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Add(Int16DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.AddImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Subtract(Int16DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.SubtractImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Multiply(Int16DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.MultiplyImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Divide(Int16DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.DivideImplementation(otherlongColumn, inPlace: true); + } + public Int64DataFrameColumn Modulo(Int16DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return longColumn.ModuloImplementation(otherlongColumn, inPlace: true); + } + public UInt32DataFrameColumn Add(UInt32DataFrameColumn column, bool inPlace = false) + { + return AddImplementation(column, inPlace); + } + public UInt32DataFrameColumn Subtract(UInt32DataFrameColumn column, bool inPlace = false) + { + return SubtractImplementation(column, inPlace); + } + public UInt32DataFrameColumn Multiply(UInt32DataFrameColumn column, bool inPlace = false) + { + return MultiplyImplementation(column, inPlace); + } + public UInt32DataFrameColumn Divide(UInt32DataFrameColumn column, bool inPlace = false) + { + return DivideImplementation(column, inPlace); + } + public UInt32DataFrameColumn Modulo(UInt32DataFrameColumn column, bool inPlace = false) + { + return ModuloImplementation(column, inPlace); + } + public UInt64DataFrameColumn Add(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.AddImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Subtract(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.SubtractImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Multiply(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.MultiplyImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Divide(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.DivideImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Modulo(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ModuloImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Add(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return AddImplementation(otheruintColumn, inPlace); + } + public UInt32DataFrameColumn Subtract(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return SubtractImplementation(otheruintColumn, inPlace); + } + public UInt32DataFrameColumn Multiply(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return MultiplyImplementation(otheruintColumn, inPlace); + } + public UInt32DataFrameColumn Divide(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return DivideImplementation(otheruintColumn, inPlace); + } + public UInt32DataFrameColumn Modulo(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ModuloImplementation(otheruintColumn, inPlace); + } + } + public partial class UInt64DataFrameColumn + { + public UInt64DataFrameColumn Add(ByteDataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return AddImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Subtract(ByteDataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return SubtractImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Multiply(ByteDataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return MultiplyImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Divide(ByteDataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return DivideImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Modulo(ByteDataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ModuloImplementation(otherulongColumn, inPlace); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(Int32DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.AddImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Subtract(Int32DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Multiply(Int32DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Divide(Int32DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.DivideImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Modulo(Int32DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Add(SByteDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.AddImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Subtract(SByteDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Multiply(SByteDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Divide(SByteDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.DivideImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Modulo(SByteDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Add(Int16DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.AddImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Subtract(Int16DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Multiply(Int16DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Divide(Int16DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.DivideImplementation(otherfloatColumn, inPlace: true); + } + public SingleDataFrameColumn Modulo(Int16DataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(otherfloatColumn, inPlace: true); + } + public UInt64DataFrameColumn Add(UInt32DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return AddImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Subtract(UInt32DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return SubtractImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Multiply(UInt32DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return MultiplyImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Divide(UInt32DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return DivideImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Modulo(UInt32DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ModuloImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Add(UInt64DataFrameColumn column, bool inPlace = false) + { + return AddImplementation(column, inPlace); + } + public UInt64DataFrameColumn Subtract(UInt64DataFrameColumn column, bool inPlace = false) + { + return SubtractImplementation(column, inPlace); + } + public UInt64DataFrameColumn Multiply(UInt64DataFrameColumn column, bool inPlace = false) + { + return MultiplyImplementation(column, inPlace); + } + public UInt64DataFrameColumn Divide(UInt64DataFrameColumn column, bool inPlace = false) + { + return DivideImplementation(column, inPlace); + } + public UInt64DataFrameColumn Modulo(UInt64DataFrameColumn column, bool inPlace = false) + { + return ModuloImplementation(column, inPlace); + } + public UInt64DataFrameColumn Add(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return AddImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Subtract(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return SubtractImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Multiply(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return MultiplyImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Divide(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return DivideImplementation(otherulongColumn, inPlace); + } + public UInt64DataFrameColumn Modulo(UInt16DataFrameColumn column, bool inPlace = false) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ModuloImplementation(otherulongColumn, inPlace); + } + } + public partial class UInt16DataFrameColumn + { + public Int32DataFrameColumn Add(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(ByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public DecimalDataFrameColumn Add(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Subtract(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Multiply(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Divide(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(column, inPlace: true); + } + public DecimalDataFrameColumn Modulo(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Add(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Subtract(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Multiply(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Divide(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(column, inPlace: true); + } + public DoubleDataFrameColumn Modulo(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Add(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Subtract(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Multiply(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Divide(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(column, inPlace: true); + } + public SingleDataFrameColumn Modulo(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Subtract(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Multiply(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Divide(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Modulo(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Add(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Subtract(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Multiply(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Divide(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(column, inPlace: true); + } + public Int64DataFrameColumn Modulo(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(SByteDataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Add(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(Int16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + public UInt32DataFrameColumn Add(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.AddImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Subtract(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.SubtractImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Multiply(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.MultiplyImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Divide(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.DivideImplementation(column, inPlace: true); + } + public UInt32DataFrameColumn Modulo(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ModuloImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Add(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.AddImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Subtract(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.SubtractImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Multiply(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.MultiplyImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Divide(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.DivideImplementation(column, inPlace: true); + } + public UInt64DataFrameColumn Modulo(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ModuloImplementation(column, inPlace: true); + } + public Int32DataFrameColumn Add(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.AddImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Subtract(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.SubtractImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Multiply(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.MultiplyImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Divide(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.DivideImplementation(otherintColumn, inPlace: true); + } + public Int32DataFrameColumn Modulo(UInt16DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return intColumn.ModuloImplementation(otherintColumn, inPlace: true); + } + } + public partial class ByteDataFrameColumn + { + public Int32DataFrameColumn Add(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Add(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseAdd(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseAddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Subtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Multiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Divide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseDivide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Modulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseModulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Add(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.AddImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseAdd(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseAddImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Subtract(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.SubtractImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseSubtract(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Multiply(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.MultiplyImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseMultiply(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Divide(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.DivideImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseDivide(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseDivideImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Modulo(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ModuloImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseModulo(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseModuloImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Add(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.AddImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseAdd(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseAddImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Subtract(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.SubtractImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseSubtract(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Multiply(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.MultiplyImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseMultiply(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Divide(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.DivideImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseDivide(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseDivideImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Modulo(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ModuloImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseModulo(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + } + public partial class DecimalDataFrameColumn + { + public DecimalDataFrameColumn Add(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return AddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Subtract(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Multiply(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Divide(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return DivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Modulo(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(byte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(decimal value, bool inPlace = false) + { + return AddImplementation(value, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(decimal value, bool inPlace = false) + { + return ReverseAddImplementation(value, inPlace); + } + public DecimalDataFrameColumn Subtract(decimal value, bool inPlace = false) + { + return SubtractImplementation(value, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value, bool inPlace = false) + { + return ReverseSubtractImplementation(value, inPlace); + } + public DecimalDataFrameColumn Multiply(decimal value, bool inPlace = false) + { + return MultiplyImplementation(value, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value, bool inPlace = false) + { + return ReverseMultiplyImplementation(value, inPlace); + } + public DecimalDataFrameColumn Divide(decimal value, bool inPlace = false) + { + return DivideImplementation(value, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(decimal value, bool inPlace = false) + { + return ReverseDivideImplementation(value, inPlace); + } + public DecimalDataFrameColumn Modulo(decimal value, bool inPlace = false) + { + return ModuloImplementation(value, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(decimal value, bool inPlace = false) + { + return ReverseModuloImplementation(value, inPlace); + } + public DecimalDataFrameColumn Add(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return AddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Subtract(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Multiply(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Divide(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return DivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Modulo(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(int value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return AddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Subtract(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Multiply(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Divide(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return DivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Modulo(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(long value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return AddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Subtract(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Multiply(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Divide(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return DivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Modulo(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(sbyte value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return AddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Subtract(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Multiply(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Divide(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return DivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Modulo(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(short value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return AddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Subtract(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Multiply(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Divide(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return DivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Modulo(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(uint value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return AddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Subtract(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Multiply(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Divide(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return DivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Modulo(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(ulong value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return AddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseAdd(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Subtract(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseSubtract(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Multiply(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseMultiply(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Divide(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return DivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseDivide(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Modulo(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn ReverseModulo(ushort value, bool inPlace = false) + { + decimal convertedValue = (decimal)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + } + public partial class DoubleDataFrameColumn + { + public DoubleDataFrameColumn Add(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(byte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(double value, bool inPlace = false) + { + return AddImplementation(value, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(double value, bool inPlace = false) + { + return ReverseAddImplementation(value, inPlace); + } + public DoubleDataFrameColumn Subtract(double value, bool inPlace = false) + { + return SubtractImplementation(value, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(double value, bool inPlace = false) + { + return ReverseSubtractImplementation(value, inPlace); + } + public DoubleDataFrameColumn Multiply(double value, bool inPlace = false) + { + return MultiplyImplementation(value, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(double value, bool inPlace = false) + { + return ReverseMultiplyImplementation(value, inPlace); + } + public DoubleDataFrameColumn Divide(double value, bool inPlace = false) + { + return DivideImplementation(value, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(double value, bool inPlace = false) + { + return ReverseDivideImplementation(value, inPlace); + } + public DoubleDataFrameColumn Modulo(double value, bool inPlace = false) + { + return ModuloImplementation(value, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(double value, bool inPlace = false) + { + return ReverseModuloImplementation(value, inPlace); + } + public DoubleDataFrameColumn Add(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(float value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(int value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(long value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(sbyte value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(short value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(uint value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(ulong value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return AddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseAdd(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Subtract(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return SubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseSubtract(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Multiply(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseMultiply(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Divide(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return DivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseDivide(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Modulo(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return ModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn ReverseModulo(ushort value, bool inPlace = false) + { + double convertedValue = (double)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + } + public partial class SingleDataFrameColumn + { + public SingleDataFrameColumn Add(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return AddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseAdd(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Subtract(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return SubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Multiply(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Divide(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return DivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseDivide(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Modulo(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseModulo(byte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value, bool inPlace = false) + { + return AddImplementation(value, inPlace); + } + public SingleDataFrameColumn ReverseAdd(float value, bool inPlace = false) + { + return ReverseAddImplementation(value, inPlace); + } + public SingleDataFrameColumn Subtract(float value, bool inPlace = false) + { + return SubtractImplementation(value, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(float value, bool inPlace = false) + { + return ReverseSubtractImplementation(value, inPlace); + } + public SingleDataFrameColumn Multiply(float value, bool inPlace = false) + { + return MultiplyImplementation(value, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(float value, bool inPlace = false) + { + return ReverseMultiplyImplementation(value, inPlace); + } + public SingleDataFrameColumn Divide(float value, bool inPlace = false) + { + return DivideImplementation(value, inPlace); + } + public SingleDataFrameColumn ReverseDivide(float value, bool inPlace = false) + { + return ReverseDivideImplementation(value, inPlace); + } + public SingleDataFrameColumn Modulo(float value, bool inPlace = false) + { + return ModuloImplementation(value, inPlace); + } + public SingleDataFrameColumn ReverseModulo(float value, bool inPlace = false) + { + return ReverseModuloImplementation(value, inPlace); + } + public SingleDataFrameColumn Add(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return AddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseAdd(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Subtract(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return SubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Multiply(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Divide(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return DivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseDivide(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Modulo(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return ModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseModulo(int value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Add(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return AddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseAdd(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Subtract(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return SubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Multiply(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Divide(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return DivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseDivide(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Modulo(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return ModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseModulo(long value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Add(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return AddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseAdd(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Subtract(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return SubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Multiply(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Divide(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return DivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseDivide(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Modulo(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseModulo(sbyte value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Add(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return AddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseAdd(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Subtract(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return SubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Multiply(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Divide(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return DivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseDivide(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Modulo(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return ModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseModulo(short value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Add(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return AddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseAdd(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Subtract(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return SubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Multiply(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Divide(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return DivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseDivide(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Modulo(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return ModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseModulo(uint value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Add(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return AddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseAdd(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Subtract(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return SubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Multiply(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Divide(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return DivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseDivide(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Modulo(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return ModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseModulo(ulong value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Add(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return AddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseAdd(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Subtract(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return SubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseSubtract(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Multiply(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseMultiply(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Divide(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return DivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseDivide(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn Modulo(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return ModuloImplementation(convertedValue, inPlace); + } + public SingleDataFrameColumn ReverseModulo(ushort value, bool inPlace = false) + { + float convertedValue = (float)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + } + public partial class Int32DataFrameColumn + { + public Int32DataFrameColumn Add(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return AddImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseAdd(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Subtract(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseSubtract(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Multiply(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseMultiply(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Divide(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseDivide(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Modulo(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseModulo(byte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseAdd(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseAddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Subtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Multiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Divide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseDivide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Modulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseModulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(int value, bool inPlace = false) + { + return AddImplementation(value, inPlace); + } + public Int32DataFrameColumn ReverseAdd(int value, bool inPlace = false) + { + return ReverseAddImplementation(value, inPlace); + } + public Int32DataFrameColumn Subtract(int value, bool inPlace = false) + { + return SubtractImplementation(value, inPlace); + } + public Int32DataFrameColumn ReverseSubtract(int value, bool inPlace = false) + { + return ReverseSubtractImplementation(value, inPlace); + } + public Int32DataFrameColumn Multiply(int value, bool inPlace = false) + { + return MultiplyImplementation(value, inPlace); + } + public Int32DataFrameColumn ReverseMultiply(int value, bool inPlace = false) + { + return ReverseMultiplyImplementation(value, inPlace); + } + public Int32DataFrameColumn Divide(int value, bool inPlace = false) + { + return DivideImplementation(value, inPlace); + } + public Int32DataFrameColumn ReverseDivide(int value, bool inPlace = false) + { + return ReverseDivideImplementation(value, inPlace); + } + public Int32DataFrameColumn Modulo(int value, bool inPlace = false) + { + return ModuloImplementation(value, inPlace); + } + public Int32DataFrameColumn ReverseModulo(int value, bool inPlace = false) + { + return ReverseModuloImplementation(value, inPlace); + } + public Int64DataFrameColumn Add(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return AddImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseAdd(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Subtract(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseSubtract(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Multiply(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseMultiply(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Divide(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseDivide(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Modulo(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseModulo(sbyte value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Add(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return AddImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseAdd(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Subtract(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseSubtract(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Multiply(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseMultiply(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Divide(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseDivide(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Modulo(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseModulo(short value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Add(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return AddImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseAdd(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Subtract(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseSubtract(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Multiply(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseMultiply(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Divide(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseDivide(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn Modulo(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int32DataFrameColumn ReverseModulo(ushort value, bool inPlace = false) + { + int convertedValue = (int)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + } + public partial class Int64DataFrameColumn + { + public Int64DataFrameColumn Add(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return AddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseAdd(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Subtract(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseSubtract(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Multiply(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseMultiply(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Divide(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseDivide(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Modulo(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseModulo(byte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseAdd(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseAddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Subtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Multiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Divide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseDivide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Modulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseModulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return AddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseAdd(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Subtract(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseSubtract(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Multiply(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseMultiply(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Divide(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseDivide(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Modulo(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseModulo(int value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Add(long value, bool inPlace = false) + { + return AddImplementation(value, inPlace); + } + public Int64DataFrameColumn ReverseAdd(long value, bool inPlace = false) + { + return ReverseAddImplementation(value, inPlace); + } + public Int64DataFrameColumn Subtract(long value, bool inPlace = false) + { + return SubtractImplementation(value, inPlace); + } + public Int64DataFrameColumn ReverseSubtract(long value, bool inPlace = false) + { + return ReverseSubtractImplementation(value, inPlace); + } + public Int64DataFrameColumn Multiply(long value, bool inPlace = false) + { + return MultiplyImplementation(value, inPlace); + } + public Int64DataFrameColumn ReverseMultiply(long value, bool inPlace = false) + { + return ReverseMultiplyImplementation(value, inPlace); + } + public Int64DataFrameColumn Divide(long value, bool inPlace = false) + { + return DivideImplementation(value, inPlace); + } + public Int64DataFrameColumn ReverseDivide(long value, bool inPlace = false) + { + return ReverseDivideImplementation(value, inPlace); + } + public Int64DataFrameColumn Modulo(long value, bool inPlace = false) + { + return ModuloImplementation(value, inPlace); + } + public Int64DataFrameColumn ReverseModulo(long value, bool inPlace = false) + { + return ReverseModuloImplementation(value, inPlace); + } + public Int64DataFrameColumn Add(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return AddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseAdd(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Subtract(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseSubtract(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Multiply(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseMultiply(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Divide(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseDivide(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Modulo(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseModulo(sbyte value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Add(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return AddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseAdd(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Subtract(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseSubtract(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Multiply(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseMultiply(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Divide(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseDivide(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Modulo(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseModulo(short value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Add(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return AddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseAdd(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Subtract(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseSubtract(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Multiply(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseMultiply(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Divide(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseDivide(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Modulo(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseModulo(uint value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Add(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return AddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseAdd(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Subtract(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return SubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseSubtract(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Multiply(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseMultiply(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Divide(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return DivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseDivide(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn Modulo(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return ModuloImplementation(convertedValue, inPlace); + } + public Int64DataFrameColumn ReverseModulo(ushort value, bool inPlace = false) + { + long convertedValue = (long)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + } + public partial class SByteDataFrameColumn + { + public Int32DataFrameColumn Add(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Add(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseAdd(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseAddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Subtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Multiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Divide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseDivide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Modulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseModulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + } + public partial class Int16DataFrameColumn + { + public Int32DataFrameColumn Add(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Add(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseAdd(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseAddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Subtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Multiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Divide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseDivide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Modulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseModulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(uint value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(ulong value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + } + public partial class UInt32DataFrameColumn + { + public UInt32DataFrameColumn Add(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return AddImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseAdd(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn Subtract(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return SubtractImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseSubtract(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn Multiply(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseMultiply(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn Divide(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return DivideImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseDivide(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn Modulo(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ModuloImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseModulo(byte value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseAdd(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseAddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Subtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Multiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Divide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseDivide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Modulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseModulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(int value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(sbyte value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(short value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Add(uint value, bool inPlace = false) + { + return AddImplementation(value, inPlace); + } + public UInt32DataFrameColumn ReverseAdd(uint value, bool inPlace = false) + { + return ReverseAddImplementation(value, inPlace); + } + public UInt32DataFrameColumn Subtract(uint value, bool inPlace = false) + { + return SubtractImplementation(value, inPlace); + } + public UInt32DataFrameColumn ReverseSubtract(uint value, bool inPlace = false) + { + return ReverseSubtractImplementation(value, inPlace); + } + public UInt32DataFrameColumn Multiply(uint value, bool inPlace = false) + { + return MultiplyImplementation(value, inPlace); + } + public UInt32DataFrameColumn ReverseMultiply(uint value, bool inPlace = false) + { + return ReverseMultiplyImplementation(value, inPlace); + } + public UInt32DataFrameColumn Divide(uint value, bool inPlace = false) + { + return DivideImplementation(value, inPlace); + } + public UInt32DataFrameColumn ReverseDivide(uint value, bool inPlace = false) + { + return ReverseDivideImplementation(value, inPlace); + } + public UInt32DataFrameColumn Modulo(uint value, bool inPlace = false) + { + return ModuloImplementation(value, inPlace); + } + public UInt32DataFrameColumn ReverseModulo(uint value, bool inPlace = false) + { + return ReverseModuloImplementation(value, inPlace); + } + public UInt64DataFrameColumn Add(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.AddImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseAdd(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseAddImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Subtract(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.SubtractImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseSubtract(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Multiply(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.MultiplyImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseMultiply(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Divide(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.DivideImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseDivide(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseDivideImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Modulo(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ModuloImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseModulo(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseModuloImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Add(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return AddImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseAdd(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn Subtract(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return SubtractImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseSubtract(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn Multiply(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseMultiply(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn Divide(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return DivideImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseDivide(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn Modulo(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ModuloImplementation(convertedValue, inPlace); + } + public UInt32DataFrameColumn ReverseModulo(ushort value, bool inPlace = false) + { + uint convertedValue = (uint)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + } + public partial class UInt64DataFrameColumn + { + public UInt64DataFrameColumn Add(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return AddImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseAdd(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Subtract(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return SubtractImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseSubtract(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Multiply(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseMultiply(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Divide(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return DivideImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseDivide(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Modulo(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ModuloImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseModulo(byte value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public DecimalDataFrameColumn Add(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseAdd(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseAddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Subtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Multiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Divide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseDivide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Modulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseModulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(int value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(sbyte value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(short value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Add(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return AddImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseAdd(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Subtract(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return SubtractImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseSubtract(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Multiply(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseMultiply(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Divide(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return DivideImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseDivide(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Modulo(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ModuloImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseModulo(uint value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Add(ulong value, bool inPlace = false) + { + return AddImplementation(value, inPlace); + } + public UInt64DataFrameColumn ReverseAdd(ulong value, bool inPlace = false) + { + return ReverseAddImplementation(value, inPlace); + } + public UInt64DataFrameColumn Subtract(ulong value, bool inPlace = false) + { + return SubtractImplementation(value, inPlace); + } + public UInt64DataFrameColumn ReverseSubtract(ulong value, bool inPlace = false) + { + return ReverseSubtractImplementation(value, inPlace); + } + public UInt64DataFrameColumn Multiply(ulong value, bool inPlace = false) + { + return MultiplyImplementation(value, inPlace); + } + public UInt64DataFrameColumn ReverseMultiply(ulong value, bool inPlace = false) + { + return ReverseMultiplyImplementation(value, inPlace); + } + public UInt64DataFrameColumn Divide(ulong value, bool inPlace = false) + { + return DivideImplementation(value, inPlace); + } + public UInt64DataFrameColumn ReverseDivide(ulong value, bool inPlace = false) + { + return ReverseDivideImplementation(value, inPlace); + } + public UInt64DataFrameColumn Modulo(ulong value, bool inPlace = false) + { + return ModuloImplementation(value, inPlace); + } + public UInt64DataFrameColumn ReverseModulo(ulong value, bool inPlace = false) + { + return ReverseModuloImplementation(value, inPlace); + } + public UInt64DataFrameColumn Add(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return AddImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseAdd(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseAddImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Subtract(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return SubtractImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseSubtract(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseSubtractImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Multiply(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return MultiplyImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseMultiply(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseMultiplyImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Divide(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return DivideImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseDivide(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseDivideImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn Modulo(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ModuloImplementation(convertedValue, inPlace); + } + public UInt64DataFrameColumn ReverseModulo(ushort value, bool inPlace = false) + { + ulong convertedValue = (ulong)value; + return ReverseModuloImplementation(convertedValue, inPlace); + } + } + public partial class UInt16DataFrameColumn + { + public Int32DataFrameColumn Add(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(byte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Add(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.AddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseAdd(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseAddImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Subtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.SubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseSubtract(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Multiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.MultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseMultiply(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Divide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.DivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseDivide(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn Modulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ModuloImplementation(value, inPlace: true); + } + public DecimalDataFrameColumn ReverseModulo(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ReverseModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Add(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.AddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseAdd(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseAddImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Subtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.SubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseSubtract(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Multiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.MultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseMultiply(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Divide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.DivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseDivide(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseDivideImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn Modulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ModuloImplementation(value, inPlace: true); + } + public DoubleDataFrameColumn ReverseModulo(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ReverseModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Add(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.AddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseAdd(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseAddImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Subtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.SubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseSubtract(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Multiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.MultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseMultiply(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Divide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.DivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseDivide(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseDivideImplementation(value, inPlace: true); + } + public SingleDataFrameColumn Modulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ModuloImplementation(value, inPlace: true); + } + public SingleDataFrameColumn ReverseModulo(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Add(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.AddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseAdd(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Subtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.SubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseSubtract(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Multiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.MultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseMultiply(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Divide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.DivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseDivide(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int64DataFrameColumn Modulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ModuloImplementation(value, inPlace: true); + } + public Int64DataFrameColumn ReverseModulo(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(sbyte value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(short value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Add(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.AddImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseAdd(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseAddImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Subtract(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.SubtractImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseSubtract(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Multiply(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.MultiplyImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseMultiply(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Divide(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.DivideImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseDivide(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseDivideImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn Modulo(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ModuloImplementation(value, inPlace: true); + } + public UInt32DataFrameColumn ReverseModulo(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ReverseModuloImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Add(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.AddImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseAdd(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseAddImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Subtract(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.SubtractImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseSubtract(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Multiply(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.MultiplyImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseMultiply(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Divide(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.DivideImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseDivide(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseDivideImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn Modulo(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ModuloImplementation(value, inPlace: true); + } + public UInt64DataFrameColumn ReverseModulo(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ReverseModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Add(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.AddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseAdd(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseAddImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Subtract(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.SubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseSubtract(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseSubtractImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Multiply(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.MultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseMultiply(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseMultiplyImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Divide(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.DivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseDivide(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseDivideImplementation(value, inPlace: true); + } + public Int32DataFrameColumn Modulo(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ModuloImplementation(value, inPlace: true); + } + public Int32DataFrameColumn ReverseModulo(ushort value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ReverseModuloImplementation(value, inPlace: true); + } + } + public partial class BooleanDataFrameColumn + { + public BooleanDataFrameColumn And(BooleanDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + BooleanDataFrameColumn retColumn = inPlace ? this : CloneAsBooleanColumn(); + retColumn.ColumnContainer.And(column.ColumnContainer); + return retColumn; + } + } + public partial class BooleanDataFrameColumn + { + public new BooleanDataFrameColumn And(bool value, bool inPlace = false) + { + BooleanDataFrameColumn retColumn = inPlace ? this : CloneAsBooleanColumn(); + retColumn.ColumnContainer.And(value); + return retColumn; + } + } + public partial class BooleanDataFrameColumn + { + public BooleanDataFrameColumn Or(BooleanDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + BooleanDataFrameColumn retColumn = inPlace ? this : CloneAsBooleanColumn(); + retColumn.ColumnContainer.Or(column.ColumnContainer); + return retColumn; + } + } + public partial class BooleanDataFrameColumn + { + public new BooleanDataFrameColumn Or(bool value, bool inPlace = false) + { + BooleanDataFrameColumn retColumn = inPlace ? this : CloneAsBooleanColumn(); + retColumn.ColumnContainer.Or(value); + return retColumn; + } + } + public partial class BooleanDataFrameColumn + { + public BooleanDataFrameColumn Xor(BooleanDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + BooleanDataFrameColumn retColumn = inPlace ? this : CloneAsBooleanColumn(); + retColumn.ColumnContainer.Xor(column.ColumnContainer); + return retColumn; + } + } + public partial class BooleanDataFrameColumn + { + public new BooleanDataFrameColumn Xor(bool value, bool inPlace = false) + { + BooleanDataFrameColumn retColumn = inPlace ? this : CloneAsBooleanColumn(); + retColumn.ColumnContainer.Xor(value); + return retColumn; + } + } + + public partial class BooleanDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(BooleanDataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(BooleanDataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(BooleanDataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(BooleanDataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(BooleanDataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(BooleanDataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + } + public partial class ByteDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + ByteDataFrameColumn otherbyteColumn = column.CloneAsByteColumn(); + return ElementwiseEqualsImplementation(otherbyteColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + ByteDataFrameColumn otherbyteColumn = column.CloneAsByteColumn(); + return ElementwiseNotEqualsImplementation(otherbyteColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + ByteDataFrameColumn otherbyteColumn = column.CloneAsByteColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherbyteColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + ByteDataFrameColumn otherbyteColumn = column.CloneAsByteColumn(); + return ElementwiseLessThanOrEqualImplementation(otherbyteColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + ByteDataFrameColumn otherbyteColumn = column.CloneAsByteColumn(); + return ElementwiseGreaterThanImplementation(otherbyteColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + ByteDataFrameColumn otherbyteColumn = column.CloneAsByteColumn(); + return ElementwiseLessThanImplementation(otherbyteColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseLessThanImplementation(column); + } + } + public partial class DecimalDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseNotEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseNotEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseNotEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseNotEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseNotEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseNotEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseNotEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseNotEqualsImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseGreaterThanImplementation(otherdecimalColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + DecimalDataFrameColumn otherdecimalColumn = column.CloneAsDecimalColumn(); + return ElementwiseLessThanImplementation(otherdecimalColumn); + } + } + public partial class DoubleDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseNotEqualsImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseGreaterThanImplementation(otherdoubleColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + DoubleDataFrameColumn otherdoubleColumn = column.CloneAsDoubleColumn(); + return ElementwiseLessThanImplementation(otherdoubleColumn); + } + } + public partial class SingleDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseNotEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseNotEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseNotEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseNotEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseNotEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseNotEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseNotEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseNotEqualsImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanOrEqualImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseGreaterThanImplementation(otherfloatColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + SingleDataFrameColumn otherfloatColumn = column.CloneAsSingleColumn(); + return ElementwiseLessThanImplementation(otherfloatColumn); + } + } + public partial class Int32DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseNotEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseNotEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseNotEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseNotEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseNotEqualsImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseGreaterThanImplementation(otherintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + Int32DataFrameColumn otherintColumn = column.CloneAsInt32Column(); + return ElementwiseLessThanImplementation(otherintColumn); + } + } + public partial class Int64DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseNotEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseNotEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseNotEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseNotEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseNotEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseNotEqualsImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseGreaterThanImplementation(otherlongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + Int64DataFrameColumn otherlongColumn = column.CloneAsInt64Column(); + return ElementwiseLessThanImplementation(otherlongColumn); + } + } + public partial class SByteDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + SByteDataFrameColumn othersbyteColumn = column.CloneAsSByteColumn(); + return ElementwiseEqualsImplementation(othersbyteColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + SByteDataFrameColumn othersbyteColumn = column.CloneAsSByteColumn(); + return ElementwiseNotEqualsImplementation(othersbyteColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + SByteDataFrameColumn othersbyteColumn = column.CloneAsSByteColumn(); + return ElementwiseGreaterThanOrEqualImplementation(othersbyteColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + SByteDataFrameColumn othersbyteColumn = column.CloneAsSByteColumn(); + return ElementwiseLessThanOrEqualImplementation(othersbyteColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + SByteDataFrameColumn othersbyteColumn = column.CloneAsSByteColumn(); + return ElementwiseGreaterThanImplementation(othersbyteColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + SByteDataFrameColumn othersbyteColumn = column.CloneAsSByteColumn(); + return ElementwiseLessThanImplementation(othersbyteColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseLessThanImplementation(column); + } + } + public partial class Int16DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseEqualsImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseNotEqualsImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseGreaterThanOrEqualImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseLessThanOrEqualImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseGreaterThanImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseLessThanImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseEqualsImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseNotEqualsImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseGreaterThanOrEqualImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseLessThanOrEqualImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseGreaterThanImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseLessThanImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseEqualsImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseNotEqualsImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseGreaterThanOrEqualImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseLessThanOrEqualImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseGreaterThanImplementation(othershortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + Int16DataFrameColumn othershortColumn = column.CloneAsInt16Column(); + return ElementwiseLessThanImplementation(othershortColumn); + } + } + public partial class UInt32DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseNotEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseNotEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseNotEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseNotEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseNotEqualsImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanOrEqualImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseGreaterThanImplementation(otheruintColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + UInt32DataFrameColumn otheruintColumn = column.CloneAsUInt32Column(); + return ElementwiseLessThanImplementation(otheruintColumn); + } + } + public partial class UInt64DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseNotEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseNotEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseNotEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseNotEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseNotEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseNotEqualsImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanOrEqualImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseGreaterThanImplementation(otherulongColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + UInt64DataFrameColumn otherulongColumn = column.CloneAsUInt64Column(); + return ElementwiseLessThanImplementation(otherulongColumn); + } + } + public partial class UInt16DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(ByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseEqualsImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseNotEqualsImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseLessThanOrEqualImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseGreaterThanImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(ByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseLessThanImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DecimalDataFrameColumn column) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(DoubleDataFrameColumn column) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(SingleDataFrameColumn column) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int32DataFrameColumn column) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int64DataFrameColumn column) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(SByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseEqualsImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(SByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseNotEqualsImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(SByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(SByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseLessThanOrEqualImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(SByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseGreaterThanImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(SByteDataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseLessThanImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(Int16DataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseEqualsImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseNotEquals(Int16DataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseNotEqualsImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(Int16DataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseGreaterThanOrEqualImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(Int16DataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseLessThanOrEqualImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(Int16DataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseGreaterThanImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseLessThan(Int16DataFrameColumn column) + { + UInt16DataFrameColumn otherushortColumn = column.CloneAsUInt16Column(); + return ElementwiseLessThanImplementation(otherushortColumn); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt32DataFrameColumn column) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt64DataFrameColumn column) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseEquals(UInt16DataFrameColumn column) + { + return ElementwiseEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseNotEquals(UInt16DataFrameColumn column) + { + return ElementwiseNotEqualsImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(UInt16DataFrameColumn column) + { + return ElementwiseGreaterThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(UInt16DataFrameColumn column) + { + return ElementwiseLessThanOrEqualImplementation(column); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(UInt16DataFrameColumn column) + { + return ElementwiseGreaterThanImplementation(column); + } + public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column) + { + return ElementwiseLessThanImplementation(column); + } + } + public partial class BooleanDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(bool value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(bool value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(bool value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(bool value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(bool value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(bool value) + { + return ElementwiseLessThanImplementation(value); + } + } + public partial class ByteDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + byte otherbyteValue = (byte)value; + return ElementwiseEqualsImplementation(otherbyteValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + byte otherbyteValue = (byte)value; + return ElementwiseNotEqualsImplementation(otherbyteValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + byte otherbyteValue = (byte)value; + return ElementwiseGreaterThanOrEqualImplementation(otherbyteValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + byte otherbyteValue = (byte)value; + return ElementwiseLessThanOrEqualImplementation(otherbyteValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + byte otherbyteValue = (byte)value; + return ElementwiseGreaterThanImplementation(otherbyteValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + byte otherbyteValue = (byte)value; + return ElementwiseLessThanImplementation(otherbyteValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseLessThanImplementation(value); + } + } + public partial class DecimalDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseNotEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseNotEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseNotEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseNotEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseNotEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseNotEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseNotEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseNotEqualsImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanOrEqualImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseGreaterThanImplementation(otherdecimalValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + decimal otherdecimalValue = (decimal)value; + return ElementwiseLessThanImplementation(otherdecimalValue); + } + } + public partial class DoubleDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + double otherdoubleValue = (double)value; + return ElementwiseEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + double otherdoubleValue = (double)value; + return ElementwiseNotEqualsImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanOrEqualImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + double otherdoubleValue = (double)value; + return ElementwiseGreaterThanImplementation(otherdoubleValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + double otherdoubleValue = (double)value; + return ElementwiseLessThanImplementation(otherdoubleValue); + } + } + public partial class SingleDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + float otherfloatValue = (float)value; + return ElementwiseEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + float otherfloatValue = (float)value; + return ElementwiseNotEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + float otherfloatValue = (float)value; + return ElementwiseEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + float otherfloatValue = (float)value; + return ElementwiseNotEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + float otherfloatValue = (float)value; + return ElementwiseEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + float otherfloatValue = (float)value; + return ElementwiseNotEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + float otherfloatValue = (float)value; + return ElementwiseEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + float otherfloatValue = (float)value; + return ElementwiseNotEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + float otherfloatValue = (float)value; + return ElementwiseEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + float otherfloatValue = (float)value; + return ElementwiseNotEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + float otherfloatValue = (float)value; + return ElementwiseEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + float otherfloatValue = (float)value; + return ElementwiseNotEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + float otherfloatValue = (float)value; + return ElementwiseEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + float otherfloatValue = (float)value; + return ElementwiseNotEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + float otherfloatValue = (float)value; + return ElementwiseEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + float otherfloatValue = (float)value; + return ElementwiseNotEqualsImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanOrEqualImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + float otherfloatValue = (float)value; + return ElementwiseGreaterThanImplementation(otherfloatValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + float otherfloatValue = (float)value; + return ElementwiseLessThanImplementation(otherfloatValue); + } + } + public partial class Int32DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + int otherintValue = (int)value; + return ElementwiseEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + int otherintValue = (int)value; + return ElementwiseNotEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + int otherintValue = (int)value; + return ElementwiseLessThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + int otherintValue = (int)value; + return ElementwiseLessThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + int otherintValue = (int)value; + return ElementwiseEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + int otherintValue = (int)value; + return ElementwiseNotEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + int otherintValue = (int)value; + return ElementwiseLessThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + int otherintValue = (int)value; + return ElementwiseLessThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + int otherintValue = (int)value; + return ElementwiseEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + int otherintValue = (int)value; + return ElementwiseNotEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + int otherintValue = (int)value; + return ElementwiseLessThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + int otherintValue = (int)value; + return ElementwiseLessThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + int otherintValue = (int)value; + return ElementwiseEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + int otherintValue = (int)value; + return ElementwiseNotEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + int otherintValue = (int)value; + return ElementwiseLessThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + int otherintValue = (int)value; + return ElementwiseLessThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + int otherintValue = (int)value; + return ElementwiseEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + int otherintValue = (int)value; + return ElementwiseNotEqualsImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + int otherintValue = (int)value; + return ElementwiseLessThanOrEqualImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + int otherintValue = (int)value; + return ElementwiseGreaterThanImplementation(otherintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + int otherintValue = (int)value; + return ElementwiseLessThanImplementation(otherintValue); + } + } + public partial class Int64DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + long otherlongValue = (long)value; + return ElementwiseEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + long otherlongValue = (long)value; + return ElementwiseNotEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + long otherlongValue = (long)value; + return ElementwiseEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + long otherlongValue = (long)value; + return ElementwiseNotEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + long otherlongValue = (long)value; + return ElementwiseEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + long otherlongValue = (long)value; + return ElementwiseNotEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + long otherlongValue = (long)value; + return ElementwiseEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + long otherlongValue = (long)value; + return ElementwiseNotEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + long otherlongValue = (long)value; + return ElementwiseEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + long otherlongValue = (long)value; + return ElementwiseNotEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + long otherlongValue = (long)value; + return ElementwiseEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + long otherlongValue = (long)value; + return ElementwiseNotEqualsImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanOrEqualImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + long otherlongValue = (long)value; + return ElementwiseGreaterThanImplementation(otherlongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + long otherlongValue = (long)value; + return ElementwiseLessThanImplementation(otherlongValue); + } + } + public partial class SByteDataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + sbyte othersbyteValue = (sbyte)value; + return ElementwiseEqualsImplementation(othersbyteValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + sbyte othersbyteValue = (sbyte)value; + return ElementwiseNotEqualsImplementation(othersbyteValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + sbyte othersbyteValue = (sbyte)value; + return ElementwiseGreaterThanOrEqualImplementation(othersbyteValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + sbyte othersbyteValue = (sbyte)value; + return ElementwiseLessThanOrEqualImplementation(othersbyteValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + sbyte othersbyteValue = (sbyte)value; + return ElementwiseGreaterThanImplementation(othersbyteValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + sbyte othersbyteValue = (sbyte)value; + return ElementwiseLessThanImplementation(othersbyteValue); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + Int16DataFrameColumn shortColumn = CloneAsInt16Column(); + return shortColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + UInt16DataFrameColumn ushortColumn = CloneAsUInt16Column(); + return ushortColumn.ElementwiseLessThanImplementation(value); + } + } + public partial class Int16DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + short othershortValue = (short)value; + return ElementwiseEqualsImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + short othershortValue = (short)value; + return ElementwiseNotEqualsImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + short othershortValue = (short)value; + return ElementwiseGreaterThanOrEqualImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + short othershortValue = (short)value; + return ElementwiseLessThanOrEqualImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + short othershortValue = (short)value; + return ElementwiseGreaterThanImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + short othershortValue = (short)value; + return ElementwiseLessThanImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + short othershortValue = (short)value; + return ElementwiseEqualsImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + short othershortValue = (short)value; + return ElementwiseNotEqualsImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + short othershortValue = (short)value; + return ElementwiseGreaterThanOrEqualImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + short othershortValue = (short)value; + return ElementwiseLessThanOrEqualImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + short othershortValue = (short)value; + return ElementwiseGreaterThanImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + short othershortValue = (short)value; + return ElementwiseLessThanImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + short othershortValue = (short)value; + return ElementwiseEqualsImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + short othershortValue = (short)value; + return ElementwiseNotEqualsImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + short othershortValue = (short)value; + return ElementwiseGreaterThanOrEqualImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + short othershortValue = (short)value; + return ElementwiseLessThanOrEqualImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + short othershortValue = (short)value; + return ElementwiseGreaterThanImplementation(othershortValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + short othershortValue = (short)value; + return ElementwiseLessThanImplementation(othershortValue); + } + } + public partial class UInt32DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + uint otheruintValue = (uint)value; + return ElementwiseEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + uint otheruintValue = (uint)value; + return ElementwiseNotEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + uint otheruintValue = (uint)value; + return ElementwiseEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + uint otheruintValue = (uint)value; + return ElementwiseNotEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + uint otheruintValue = (uint)value; + return ElementwiseEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + uint otheruintValue = (uint)value; + return ElementwiseNotEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + uint otheruintValue = (uint)value; + return ElementwiseEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + uint otheruintValue = (uint)value; + return ElementwiseNotEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + uint otheruintValue = (uint)value; + return ElementwiseEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + uint otheruintValue = (uint)value; + return ElementwiseNotEqualsImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanOrEqualImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + uint otheruintValue = (uint)value; + return ElementwiseGreaterThanImplementation(otheruintValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + uint otheruintValue = (uint)value; + return ElementwiseLessThanImplementation(otheruintValue); + } + } + public partial class UInt64DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseNotEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseNotEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseNotEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseNotEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseNotEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + return ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseNotEqualsImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanOrEqualImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseGreaterThanImplementation(otherulongValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + ulong otherulongValue = (ulong)value; + return ElementwiseLessThanImplementation(otherulongValue); + } + } + public partial class UInt16DataFrameColumn + { + public BooleanDataFrameColumn ElementwiseEquals(byte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseEqualsImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(byte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseNotEqualsImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(byte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseGreaterThanOrEqualImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(byte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseLessThanOrEqualImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(byte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseGreaterThanImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(byte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseLessThanImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(decimal value) + { + DecimalDataFrameColumn decimalColumn = CloneAsDecimalColumn(); + return decimalColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(double value) + { + DoubleDataFrameColumn doubleColumn = CloneAsDoubleColumn(); + return doubleColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(float value) + { + SingleDataFrameColumn floatColumn = CloneAsSingleColumn(); + return floatColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(int value) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + return intColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(long value) + { + Int64DataFrameColumn longColumn = CloneAsInt64Column(); + return longColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(sbyte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseEqualsImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(sbyte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseNotEqualsImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(sbyte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseGreaterThanOrEqualImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(sbyte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseLessThanOrEqualImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(sbyte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseGreaterThanImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(sbyte value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseLessThanImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseEquals(short value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseEqualsImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseNotEquals(short value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseNotEqualsImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(short value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseGreaterThanOrEqualImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(short value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseLessThanOrEqualImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(short value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseGreaterThanImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseLessThan(short value) + { + ushort otherushortValue = (ushort)value; + return ElementwiseLessThanImplementation(otherushortValue); + } + public BooleanDataFrameColumn ElementwiseEquals(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(uint value) + { + UInt32DataFrameColumn uintColumn = CloneAsUInt32Column(); + return uintColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ulong value) + { + UInt64DataFrameColumn ulongColumn = CloneAsUInt64Column(); + return ulongColumn.ElementwiseLessThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseEquals(ushort value) + { + return ElementwiseEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseNotEquals(ushort value) + { + return ElementwiseNotEqualsImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(ushort value) + { + return ElementwiseGreaterThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThanOrEqual(ushort value) + { + return ElementwiseLessThanOrEqualImplementation(value); + } + public BooleanDataFrameColumn ElementwiseGreaterThan(ushort value) + { + return ElementwiseGreaterThanImplementation(value); + } + public BooleanDataFrameColumn ElementwiseLessThan(ushort value) + { + return ElementwiseLessThanImplementation(value); + } + } + + public partial class ByteDataFrameColumn + { + public new Int32DataFrameColumn LeftShift(int value, bool inPlace = false) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + var result = (PrimitiveDataFrameColumn)(intColumn.LeftShift(value, inPlace)); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class Int32DataFrameColumn + { + public new Int32DataFrameColumn LeftShift(int value, bool inPlace = false) + { + var result = (PrimitiveDataFrameColumn)base.LeftShift(value, inPlace); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class Int64DataFrameColumn + { + public new Int64DataFrameColumn LeftShift(int value, bool inPlace = false) + { + var result = (PrimitiveDataFrameColumn)base.LeftShift(value, inPlace); + return new Int64DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class SByteDataFrameColumn + { + public new Int32DataFrameColumn LeftShift(int value, bool inPlace = false) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + var result = (PrimitiveDataFrameColumn)(intColumn.LeftShift(value, inPlace)); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class Int16DataFrameColumn + { + public new Int32DataFrameColumn LeftShift(int value, bool inPlace = false) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + var result = (PrimitiveDataFrameColumn)(intColumn.LeftShift(value, inPlace)); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class UInt32DataFrameColumn + { + public new UInt32DataFrameColumn LeftShift(int value, bool inPlace = false) + { + var result = (PrimitiveDataFrameColumn)base.LeftShift(value, inPlace); + return new UInt32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class UInt64DataFrameColumn + { + public new UInt64DataFrameColumn LeftShift(int value, bool inPlace = false) + { + var result = (PrimitiveDataFrameColumn)base.LeftShift(value, inPlace); + return new UInt64DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class UInt16DataFrameColumn + { + public new Int32DataFrameColumn LeftShift(int value, bool inPlace = false) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + var result = (PrimitiveDataFrameColumn)(intColumn.LeftShift(value, inPlace)); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class ByteDataFrameColumn + { + public new Int32DataFrameColumn RightShift(int value, bool inPlace = false) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + var result = (PrimitiveDataFrameColumn)(intColumn.RightShift(value, inPlace)); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class Int32DataFrameColumn + { + public new Int32DataFrameColumn RightShift(int value, bool inPlace = false) + { + var result = (PrimitiveDataFrameColumn)base.RightShift(value, inPlace); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class Int64DataFrameColumn + { + public new Int64DataFrameColumn RightShift(int value, bool inPlace = false) + { + var result = (PrimitiveDataFrameColumn)base.RightShift(value, inPlace); + return new Int64DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class SByteDataFrameColumn + { + public new Int32DataFrameColumn RightShift(int value, bool inPlace = false) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + var result = (PrimitiveDataFrameColumn)(intColumn.RightShift(value, inPlace)); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class Int16DataFrameColumn + { + public new Int32DataFrameColumn RightShift(int value, bool inPlace = false) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + var result = (PrimitiveDataFrameColumn)(intColumn.RightShift(value, inPlace)); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class UInt32DataFrameColumn + { + public new UInt32DataFrameColumn RightShift(int value, bool inPlace = false) + { + var result = (PrimitiveDataFrameColumn)base.RightShift(value, inPlace); + return new UInt32DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class UInt64DataFrameColumn + { + public new UInt64DataFrameColumn RightShift(int value, bool inPlace = false) + { + var result = (PrimitiveDataFrameColumn)base.RightShift(value, inPlace); + return new UInt64DataFrameColumn(result.Name, result.ColumnContainer); + } + } + public partial class UInt16DataFrameColumn + { + public new Int32DataFrameColumn RightShift(int value, bool inPlace = false) + { + Int32DataFrameColumn intColumn = CloneAsInt32Column(); + var result = (PrimitiveDataFrameColumn)(intColumn.RightShift(value, inPlace)); + return new Int32DataFrameColumn(result.Name, result.ColumnContainer); + } + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt new file mode 100644 index 0000000000..e0e9067917 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt @@ -0,0 +1,606 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude"#> +<#@ include file="PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ +<# +bool supportedInPlace(string type1, string type2) +{ + string ret = GetBinaryOperationReturnType(type1, type2); + if (ret == type1) + { + return true; + } + return false; +} +#> +<# +void GenerateAllBinaryCombinationsForMethod() +{ + HashSet visited = new HashSet { }; + foreach (TypeCombination outer in BinaryOperationCombinations.binaryOperationCombinations) + { + string outerColumnType = outer.ThisColumnType; + if (visited.Contains(outerColumnType)) + { + continue; + } + visited.Add(outerColumnType); + string fullOuterColumnType = GetCapitalizedPrimitiveTypes(outerColumnType) + "DataFrameColumn"; +#> + public partial class <#=fullOuterColumnType#> + { +<# + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations.Where((ACombination) => ACombination.ThisColumnType == outerColumnType)) + { + foreach (MethodConfiguration method in methodConfiguration) + { + if (method.MethodType == MethodType.Binary && method.IsNumeric) + { + string methodName = method.MethodName; + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); +#> +<# + if (supportedInPlace(columnType, otherColumnType)) + { +#> + public <#=fullReturnType#> <#=methodName#>(<#=fullOtherColumnType#> column, bool inPlace = false) +<# + } + else + { +#> + public <#=fullReturnType#> <#=methodName#>(<#=fullOtherColumnType#> column) +<# + } +#> + { +<# + if (columnType == otherColumnType) + { + // Handle the straightforward cases such as int + int resulting in int + if (fullReturnType == fullColumnType || fullReturnType == fullOtherColumnType) + { +#> + return <#=methodName#>Implementation(column, inPlace); +<# + } + else + { + // Cases such as byte + byte resulting in int. Needs 2 clones +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + <#=fullReturnType#> other<#=returnType#>Column = column.CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(other<#=returnType#>Column, inPlace: true); +<# + } + } + else + { + // Handle the straightforward cases + if (fullReturnType == fullColumnType || fullReturnType == fullOtherColumnType) + { + primitiveTypeToPrimitivityLevelMap.TryGetValue(columnType, out int columnTypeLevel); + primitiveTypeToPrimitivityLevelMap.TryGetValue(otherColumnType, out int otherColumnTypeLevel); + if (otherColumnTypeLevel > columnTypeLevel) + { +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(column, inPlace: true); +<# + } + else + { +#> + <#=fullReturnType#> other<#=returnType#>Column = column.CloneAs<#=capitalizedReturnType#>Column(); + return <#=methodName#>Implementation(other<#=returnType#>Column, inPlace); +<# + } + } + else + { + // Cases such as byte + short resulting in int. Needs 2 clones +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + <#=fullReturnType#> other<#=returnType#>Column = column.CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(other<#=returnType#>Column, inPlace: true); +<# + } + } +#> + } +<# + } + } + } +#> + } +<# +} +} +#> +<# +void GenerateAllBinaryScalarCombinationsForMethod() +{ + HashSet visited = new HashSet { }; + foreach (TypeCombination outer in BinaryOperationCombinations.binaryOperationCombinations) + { + string outerColumnType = outer.ThisColumnType; + if (visited.Contains(outerColumnType)) + { + continue; + } + visited.Add(outerColumnType); + string fullOuterColumnType = GetCapitalizedPrimitiveTypes(outerColumnType) + "DataFrameColumn"; +#> + public partial class <#=fullOuterColumnType#> + { +<# + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations.Where((ACombination) => ACombination.ThisColumnType == outerColumnType)) + { + foreach (MethodConfiguration method in methodConfiguration) + { + if (method.MethodType == MethodType.BinaryScalar && method.IsNumeric) + { + string methodName = method.MethodName; + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string valueType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + +#> +<# + if (supportedInPlace(columnType, valueType)) + { +#> + public <#=fullReturnType#> <#=methodName#>(<#=valueType#> value, bool inPlace = false) +<# + } + else + { +#> + public <#=fullReturnType#> <#=methodName#>(<#=valueType#> value) +<# + } +#> + { +<# + if (columnType == valueType) + { + // Handle the straightforward cases such as int + int resulting in int + if (fullReturnType == fullColumnType) + { +#> + return <#=methodName#>Implementation(value, inPlace); +<# + } + else + { + // Cases such as byte + byte resulting in int. Needs 2 clones +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(value, inPlace: true); +<# + } + } + else + { + // Handle the straightforward cases + if (fullReturnType == fullColumnType) + { + primitiveTypeToPrimitivityLevelMap.TryGetValue(columnType, out int columnTypeLevel); + primitiveTypeToPrimitivityLevelMap.TryGetValue(valueType, out int valueTypeLevel); + if (valueTypeLevel > columnTypeLevel) + { +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(value, inPlace: true); +<# + } + else + { +#> + <#=returnType#> convertedValue = (<#=returnType#>)value; + return <#=methodName#>Implementation(convertedValue, inPlace); +<# + } + } + else + { + // Cases such as byte + short resulting in int. Needs 2 clones +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(value, inPlace: true); +<# + } + } +#> + } +<# + } + if (method.MethodType == MethodType.BinaryScalar && method.IsNumeric) + { + string methodName = "Reverse" + method.MethodName; + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string valueType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + +#> +<# + if (supportedInPlace(columnType, valueType)) + { +#> + public <#=fullReturnType#> <#=methodName#>(<#=valueType#> value, bool inPlace = false) +<# + } + else + { +#> + public <#=fullReturnType#> <#=methodName#>(<#=valueType#> value) +<# + } +#> + { +<# + if (columnType == valueType) + { + // Handle the straightforward cases such as int + int resulting in int + if (fullReturnType == fullColumnType) + { +#> + return <#=methodName#>Implementation(value, inPlace); +<# + } + else + { + // Cases such as byte + byte resulting in int. Needs 2 clones +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(value, inPlace: true); +<# + } + } + else + { + // Handle the straightforward cases + if (fullReturnType == fullColumnType) + { + primitiveTypeToPrimitivityLevelMap.TryGetValue(columnType, out int columnTypeLevel); + primitiveTypeToPrimitivityLevelMap.TryGetValue(valueType, out int valueTypeLevel); + if (valueTypeLevel > columnTypeLevel) + { +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(value, inPlace: true); +<# + } + else + { +#> + <#=returnType#> convertedValue = (<#=returnType#>)value; + return <#=methodName#>Implementation(convertedValue, inPlace); +<# + } + } + else + { + // Cases such as byte + short resulting in int. Needs 2 clones +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + return <#=returnType#>Column.<#=methodName#>Implementation(value, inPlace: true); +<# + } + } +#> + } +<# + } + } + } +#> + } +<# +} +} +#> +<# +void GenerateAllBinaryBitwiseOperationsForMethod(string methodName) +{ +#> + public partial class BooleanDataFrameColumn + { + public BooleanDataFrameColumn <#=methodName#>(BooleanDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + BooleanDataFrameColumn retColumn = inPlace ? this : CloneAsBooleanColumn(); + retColumn.ColumnContainer.<#=methodName#>(column.ColumnContainer); + return retColumn; + } + } +<# +} +#> +<# +void GenerateAllBinaryScalarBitwiseOperationsForMethod(string methodName) +{ +#> + public partial class BooleanDataFrameColumn + { + public new BooleanDataFrameColumn <#=methodName#>(bool value, bool inPlace = false) + { + BooleanDataFrameColumn retColumn = inPlace ? this : CloneAsBooleanColumn(); + retColumn.ColumnContainer.<#=methodName#>(value); + return retColumn; + } + } +<# +} +#> +<# + GenerateAllBinaryCombinationsForMethod(); + GenerateAllBinaryScalarCombinationsForMethod(); +foreach (MethodConfiguration method in methodConfiguration) +{ + if (method.MethodType == MethodType.Binary && method.IsBitwise) + { + GenerateAllBinaryBitwiseOperationsForMethod(method.MethodName); + } + else if (method.MethodType == MethodType.BinaryScalar && method.IsBitwise) + { + GenerateAllBinaryScalarBitwiseOperationsForMethod(method.MethodName); + } +} +#> +<# +void GenerateAllComparisonCombinationsForMethod() +{ + HashSet visited = new HashSet { }; + foreach (TypeCombination outer in ComparisonOperationCombinations.comparisonOperationCombinations) + { + string outerColumnType = outer.ThisColumnType; + if (visited.Contains(outerColumnType)) + { + continue; + } + visited.Add(outerColumnType); + string fullOuterColumnType = GetCapitalizedPrimitiveTypes(outerColumnType) + "DataFrameColumn"; +#> + public partial class <#=fullOuterColumnType#> + { +<# + foreach (TypeCombination types in ComparisonOperationCombinations.comparisonOperationCombinations.Where((ACombination) => ACombination.ThisColumnType == outerColumnType)) + { +foreach (MethodConfiguration method in methodConfiguration) +{ + if (method.MethodType == MethodType.ComparisonScalar) + { + string methodName = method.MethodName; + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string capitalizedOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType); + string capitalizedColumnType = GetCapitalizedPrimitiveTypes(columnType); + +#> + public <#=fullReturnType#> <#=methodName#>(<#=fullOtherColumnType#> column) + { +<# + if (columnType == otherColumnType) + { +#> + return <#=methodName#>Implementation(column); +<# + } + else + { + primitiveTypeToPrimitivityLevelMap.TryGetValue(columnType, out int columnTypeLevel); + primitiveTypeToPrimitivityLevelMap.TryGetValue(otherColumnType, out int otherColumnTypeLevel); + if (otherColumnTypeLevel > columnTypeLevel) + { +#> + <#=fullOtherColumnType#> <#=otherColumnType#>Column = CloneAs<#=capitalizedOtherColumnType#>Column(); + return <#=otherColumnType#>Column.<#=methodName#>Implementation(column); +<# + } + else + { +#> + <#=fullColumnType#> other<#=columnType#>Column = column.CloneAs<#=capitalizedColumnType#>Column(); + return <#=methodName#>Implementation(other<#=columnType#>Column); +<# + } +#> +<# + } +#> + } +<# + } + } + } +#> + } +<# + } + } +#> + +<# +void GenerateAllComparisonScalarCombinationsForMethod() +{ + HashSet visited = new HashSet { }; + foreach (TypeCombination outer in ComparisonOperationCombinations.comparisonOperationCombinations) + { + string outerColumnType = outer.ThisColumnType; + if (visited.Contains(outerColumnType)) + { + continue; + } + visited.Add(outerColumnType); + string fullOuterColumnType = GetCapitalizedPrimitiveTypes(outerColumnType) + "DataFrameColumn"; +#> + public partial class <#=fullOuterColumnType#> + { +<# + foreach (TypeCombination types in ComparisonOperationCombinations.comparisonOperationCombinations.Where((ACombination) => ACombination.ThisColumnType == outerColumnType)) +{ +foreach (MethodConfiguration method in methodConfiguration) +{ + if (method.MethodType == MethodType.Comparison) + { + string methodName = method.MethodName; + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string capitalizedOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType); + string capitalizedColumnType = GetCapitalizedPrimitiveTypes(columnType); +#> + public <#=fullReturnType#> <#=methodName#>(<#=otherColumnType#> value) + { +<# + if (columnType == otherColumnType) + { +#> + return <#=methodName#>Implementation(value); +<# + } + else + { + primitiveTypeToPrimitivityLevelMap.TryGetValue(columnType, out int columnTypeLevel); + primitiveTypeToPrimitivityLevelMap.TryGetValue(otherColumnType, out int otherColumnTypeLevel); + if (otherColumnTypeLevel > columnTypeLevel) + { +#> + <#=fullOtherColumnType#> <#=otherColumnType#>Column = CloneAs<#=capitalizedOtherColumnType#>Column(); + return <#=otherColumnType#>Column.<#=methodName#>Implementation(value); +<# + } + else + { +#> + <#=columnType#> other<#=columnType#>Value = (<#=columnType#>)value; + return <#=methodName#>Implementation(other<#=columnType#>Value); +<# + } +#> +<# + } +#> + } +<# + } + } + } +#> + } +<# +} +} +#> +<# + GenerateAllComparisonCombinationsForMethod(); + GenerateAllComparisonScalarCombinationsForMethod(); +#> + +<# +void GenerateAllBinaryShiftCombinationsForMethod(string methodName) +{ + foreach (var type in typeConfiguration) + { + if (!type.SupportsNumeric || !type.SupportsBitwise || type.TypeName == "char") + { + continue; + } + + string returnType = GetBinaryShiftOperationReturnType(type); + if (returnType == string.Empty) + { + continue; + } + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullColumnType = GetCapitalizedPrimitiveTypes(type.TypeName) + "DataFrameColumn"; + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); +#> + public partial class <#=fullColumnType#> + { + public new <#=fullReturnType#> <#=methodName#>(int value, bool inPlace = false) + { +<# + if (fullColumnType == fullReturnType) + { +#> + var result = (PrimitiveDataFrameColumn<<#=returnType#>>)base.<#=methodName#>(value, inPlace); + return new <#=fullReturnType#>(result.Name, result.ColumnContainer); +<# + } + else + { +#> + <#=fullReturnType#> <#=returnType#>Column = CloneAs<#=capitalizedReturnType#>Column(); + var result = (PrimitiveDataFrameColumn<<#=returnType#>>)(<#=returnType#>Column.<#=methodName#>(value, inPlace)); + return new <#=fullReturnType#>(result.Name, result.ColumnContainer); +<# + } +#> + } + } +<# + } +} +#> +<# +foreach (MethodConfiguration method in methodConfiguration) +{ + if (method.MethodType == MethodType.BinaryInt) + { + GenerateAllBinaryShiftCombinationsForMethod(method.MethodName); + } +} +#> +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs new file mode 100644 index 0000000000..9dd963a338 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs @@ -0,0 +1,2395 @@ + + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperationImplementations.ExplodedColumns.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn AddImplementation(DecimalDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Add(column.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn AddImplementation(DoubleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Add(column.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn AddImplementation(SingleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Add(column.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn AddImplementation(Int32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Add(column.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn AddImplementation(Int64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Add(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn AddImplementation(UInt32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Add(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn AddImplementation(UInt64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Add(column.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn AddImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Add(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn AddImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Add(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn AddImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Add(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn AddImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Add(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn AddImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Add(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn AddImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Add(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn AddImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Add(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn ReverseAddImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.ReverseAdd(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn ReverseAddImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.ReverseAdd(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn ReverseAddImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.ReverseAdd(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn ReverseAddImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.ReverseAdd(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn ReverseAddImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.ReverseAdd(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn ReverseAddImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.ReverseAdd(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn ReverseAddImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.ReverseAdd(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn SubtractImplementation(DecimalDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Subtract(column.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn SubtractImplementation(DoubleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Subtract(column.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn SubtractImplementation(SingleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Subtract(column.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn SubtractImplementation(Int32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Subtract(column.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn SubtractImplementation(Int64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Subtract(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn SubtractImplementation(UInt32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Subtract(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn SubtractImplementation(UInt64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Subtract(column.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn SubtractImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Subtract(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn SubtractImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Subtract(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn SubtractImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Subtract(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn SubtractImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Subtract(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn SubtractImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Subtract(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn SubtractImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Subtract(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn SubtractImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Subtract(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn ReverseSubtractImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.ReverseSubtract(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn ReverseSubtractImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.ReverseSubtract(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn ReverseSubtractImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.ReverseSubtract(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn ReverseSubtractImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.ReverseSubtract(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn ReverseSubtractImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.ReverseSubtract(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn ReverseSubtractImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.ReverseSubtract(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn ReverseSubtractImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.ReverseSubtract(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn MultiplyImplementation(DecimalDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Multiply(column.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn MultiplyImplementation(DoubleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Multiply(column.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn MultiplyImplementation(SingleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Multiply(column.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn MultiplyImplementation(Int32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Multiply(column.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn MultiplyImplementation(Int64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Multiply(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn MultiplyImplementation(UInt32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Multiply(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn MultiplyImplementation(UInt64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Multiply(column.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn MultiplyImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Multiply(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn MultiplyImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Multiply(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn MultiplyImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Multiply(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn MultiplyImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Multiply(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn MultiplyImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Multiply(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn MultiplyImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Multiply(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn MultiplyImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Multiply(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn ReverseMultiplyImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.ReverseMultiply(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn ReverseMultiplyImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.ReverseMultiply(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn ReverseMultiplyImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.ReverseMultiply(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn ReverseMultiplyImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.ReverseMultiply(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn ReverseMultiplyImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.ReverseMultiply(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn ReverseMultiplyImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.ReverseMultiply(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn ReverseMultiplyImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.ReverseMultiply(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn DivideImplementation(DecimalDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Divide(column.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn DivideImplementation(DoubleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Divide(column.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn DivideImplementation(SingleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Divide(column.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn DivideImplementation(Int32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Divide(column.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn DivideImplementation(Int64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Divide(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn DivideImplementation(UInt32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Divide(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn DivideImplementation(UInt64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Divide(column.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn DivideImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Divide(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn DivideImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Divide(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn DivideImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Divide(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn DivideImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Divide(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn DivideImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Divide(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn DivideImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Divide(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn DivideImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Divide(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn ReverseDivideImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.ReverseDivide(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn ReverseDivideImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.ReverseDivide(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn ReverseDivideImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.ReverseDivide(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn ReverseDivideImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.ReverseDivide(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn ReverseDivideImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.ReverseDivide(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn ReverseDivideImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.ReverseDivide(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn ReverseDivideImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.ReverseDivide(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn ModuloImplementation(DecimalDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Modulo(column.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn ModuloImplementation(DoubleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Modulo(column.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn ModuloImplementation(SingleDataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Modulo(column.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn ModuloImplementation(Int32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Modulo(column.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn ModuloImplementation(Int64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Modulo(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn ModuloImplementation(UInt32DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Modulo(column.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn ModuloImplementation(UInt64DataFrameColumn column, bool inPlace = false) + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Modulo(column.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn ModuloImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.Modulo(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn ModuloImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.Modulo(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn ModuloImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.Modulo(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn ModuloImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.Modulo(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn ModuloImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.Modulo(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn ModuloImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.Modulo(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn ModuloImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.Modulo(value); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal DecimalDataFrameColumn ReverseModuloImplementation(decimal value, bool inPlace = false) + { + DecimalDataFrameColumn newColumn = inPlace ? this : CloneAsDecimalColumn(); + newColumn.ColumnContainer.ReverseModulo(value); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal DoubleDataFrameColumn ReverseModuloImplementation(double value, bool inPlace = false) + { + DoubleDataFrameColumn newColumn = inPlace ? this : CloneAsDoubleColumn(); + newColumn.ColumnContainer.ReverseModulo(value); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal SingleDataFrameColumn ReverseModuloImplementation(float value, bool inPlace = false) + { + SingleDataFrameColumn newColumn = inPlace ? this : CloneAsSingleColumn(); + newColumn.ColumnContainer.ReverseModulo(value); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal Int32DataFrameColumn ReverseModuloImplementation(int value, bool inPlace = false) + { + Int32DataFrameColumn newColumn = inPlace ? this : CloneAsInt32Column(); + newColumn.ColumnContainer.ReverseModulo(value); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal Int64DataFrameColumn ReverseModuloImplementation(long value, bool inPlace = false) + { + Int64DataFrameColumn newColumn = inPlace ? this : CloneAsInt64Column(); + newColumn.ColumnContainer.ReverseModulo(value); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal UInt32DataFrameColumn ReverseModuloImplementation(uint value, bool inPlace = false) + { + UInt32DataFrameColumn newColumn = inPlace ? this : CloneAsUInt32Column(); + newColumn.ColumnContainer.ReverseModulo(value); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal UInt64DataFrameColumn ReverseModuloImplementation(ulong value, bool inPlace = false) + { + UInt64DataFrameColumn newColumn = inPlace ? this : CloneAsUInt64Column(); + newColumn.ColumnContainer.ReverseModulo(value); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(BooleanDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(ByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(DecimalDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(DoubleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(SingleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(Int32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(Int64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(SByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(Int16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(UInt32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(UInt64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(UInt16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(bool value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(byte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(decimal value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(double value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(float value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(int value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(long value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(sbyte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(short value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(uint value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(ulong value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseEqualsImplementation(ushort value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(BooleanDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(ByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(DecimalDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(DoubleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(SingleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(Int32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(Int64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(SByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(Int16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(UInt32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(UInt64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(UInt16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(bool value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(byte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(decimal value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(double value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(float value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(int value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(long value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(sbyte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(short value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(uint value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(ulong value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(ushort value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(BooleanDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(ByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(DecimalDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(DoubleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(SingleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(Int32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(Int64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(SByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(Int16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(UInt32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(UInt64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(UInt16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(bool value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(byte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(decimal value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(double value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(float value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(int value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(long value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(sbyte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(short value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(uint value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(ulong value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(ushort value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(BooleanDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(ByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(DecimalDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(DoubleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(SingleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(Int32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(Int64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(SByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(Int16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(UInt32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(UInt64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(UInt16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(bool value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(byte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(decimal value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(double value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(float value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(int value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(long value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(sbyte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(short value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(uint value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(ulong value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(ushort value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(BooleanDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(ByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(DecimalDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(DoubleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(SingleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(Int32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(Int64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(SByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(Int16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(UInt32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(UInt64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(UInt16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(bool value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(byte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(decimal value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(double value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(float value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(int value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(long value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(sbyte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(short value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(uint value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(ulong value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(ushort value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(BooleanDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(ByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(DecimalDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(DoubleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(SingleDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(Int32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(Int64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(SByteDataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(Int16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(UInt32DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(UInt64DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(UInt16DataFrameColumn column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class BooleanDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(bool value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class ByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(byte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DecimalDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(decimal value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class DoubleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(double value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SingleDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(float value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(int value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(long value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class SByteDataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(sbyte value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class Int16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(short value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt32DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(uint value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt64DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(ulong value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } + public partial class UInt16DataFrameColumn + { + internal BooleanDataFrameColumn ElementwiseLessThanImplementation(ushort value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer); + return newColumn; + } + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt new file mode 100644 index 0000000000..d71534742a --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt @@ -0,0 +1,235 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.Diagnostics" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude"#> +<#@ include file="PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperationImplementations.ExplodedColumns.tt. Do not modify directly + +using System; +using System.Collections.Generic; + +namespace Microsoft.Data.Analysis +{ +<# +bool supportedInPlace(string type1, string type2) +{ + string ret = GetBinaryOperationReturnType(type1, type2); + if (ret == type1) + { + return true; + } + return false; +} +#> +<# +// This method generates implementations where the arguments are of the same type. +void GenerateAllBinaryCombinationsForMethod(string inputMethodName) +{ + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations) +{ + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + if (columnType != otherColumnType) + { + continue; + } + if (columnType != returnType) + { + continue; + } + Debug.Assert(returnType == otherColumnType); + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = fullColumnType; + string fullOtherColumnType = fullColumnType; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string methodName = inputMethodName + "Implementation"; +#> + public partial class <#=fullColumnType#> + { +<# + if (supportedInPlace(columnType, otherColumnType)) + { +#> + internal <#=fullReturnType#> <#=methodName#>(<#=fullOtherColumnType#> column, bool inPlace = false) +<# + } + else + { +#> + internal <#=fullReturnType#> <#=methodName#>(<#=fullOtherColumnType#> column) +<# + } +#> + { + if (column.Length != Length) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + <#=fullReturnType#> newColumn = inPlace ? this : CloneAs<#=capitalizedReturnType#>Column(); + newColumn.ColumnContainer.<#=inputMethodName#>(column.ColumnContainer); + return newColumn; + } + } +<# +} +} +#> +<# +// This method generates implementations where the arguments are of the same type. +void GenerateAllBinaryScalarCombinationsForMethod(string inputMethodName) +{ + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations) +{ + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + if (columnType != otherColumnType) + { + continue; + } + if (columnType != returnType) + { + continue; + } + Debug.Assert(returnType == otherColumnType); + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = fullColumnType; + string fullOtherColumnType = fullColumnType; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string methodName = inputMethodName; + methodName += "Implementation"; +#> + public partial class <#=fullColumnType#> + { +<# + if (supportedInPlace(columnType, otherColumnType)) + { +#> + internal <#=fullReturnType#> <#=methodName#>(<#=otherColumnType#> value, bool inPlace = false) +<# + } + else + { +#> + internal <#=fullReturnType#> <#=methodName#>(<#=otherColumnType#> value) +<# + } +#> + { + <#=fullReturnType#> newColumn = inPlace ? this : CloneAs<#=capitalizedReturnType#>Column(); + newColumn.ColumnContainer.<#=inputMethodName#>(value); + return newColumn; + } + } +<# +} +} +#> +<# +void GenerateAllComparisonCombinationsForMethod(string inputMethodName) +{ + foreach (TypeCombination types in ComparisonOperationCombinations.comparisonOperationCombinations) + { + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + if (columnType != otherColumnType) + { + continue; + } + Debug.Assert(returnType == otherColumnType); + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string methodName = inputMethodName; + methodName += "Implementation"; + +#> + public partial class <#=fullColumnType#> + { + internal <#=fullReturnType#> <#=methodName#>(<#=fullOtherColumnType#> column) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.<#=inputMethodName#>(column.ColumnContainer, newColumn.ColumnContainer); + return newColumn; + } + } +<# + } + } +#> +<# +void GenerateAllComparisonScalarCombinationsForMethod(string inputMethodName) +{ + foreach (TypeCombination types in ComparisonOperationCombinations.comparisonOperationCombinations) + { + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + if (columnType != otherColumnType) + { + continue; + } + Debug.Assert(returnType == otherColumnType); + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string methodName = inputMethodName; + methodName += "Implementation"; + +#> + public partial class <#=fullColumnType#> + { + internal <#=fullReturnType#> <#=methodName#>(<#=otherColumnType#> value) + { + BooleanDataFrameColumn newColumn = CloneAsBooleanColumn(); + ColumnContainer.<#=inputMethodName#>(value, newColumn.ColumnContainer); + return newColumn; + } + } +<# + } + } +#> +<# +foreach (MethodConfiguration method in methodConfiguration) +{ + // Don't generate method for Comparison and ComparisonScalar methods here + if (method.MethodType == MethodType.Binary && method.IsNumeric) + { + GenerateAllBinaryCombinationsForMethod(method.MethodName); + } + else if (method.MethodType == MethodType.BinaryScalar && method.IsNumeric) + { + GenerateAllBinaryScalarCombinationsForMethod(method.MethodName); + GenerateAllBinaryScalarCombinationsForMethod("Reverse" + method.MethodName); + } + else if (method.MethodType == MethodType.Comparison) + { + GenerateAllComparisonCombinationsForMethod(method.MethodName); + } + else if (method.MethodType == MethodType.ComparisonScalar) + { + GenerateAllComparisonScalarCombinationsForMethod(method.MethodName); + } +} +#> +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt new file mode 100644 index 0000000000..33f0a0ad72 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt @@ -0,0 +1,116 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic"#> +<#@ output extension=".ttinclude"#> +<#@ include file="ColumnArithmeticTemplate.ttinclude"#> +\<#+ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt. Do not modify directly + +public class TypeCombination +{ + private string _thisColumnType; + private string _otherColumnType; + private string _returnColumnType; + + public TypeCombination(string thisColumnType, string otherColumnType, string returnColumnType) + { + _thisColumnType = thisColumnType; + _otherColumnType = otherColumnType; + _returnColumnType = returnColumnType; + } + public string ThisColumnType => _thisColumnType; + public string OtherColumnType => _otherColumnType; + public string ReturnColumnType => _returnColumnType; +} + +public static class BinaryOperationCombinations +{ + + public static List binaryOperationCombinations = new List + { +<# +foreach (TypeConfiguration type in typeConfiguration) +{ + if(!type.SupportsNumeric || type.TypeName == "char") + { + continue; + } + foreach (TypeConfiguration type2 in typeConfiguration) + { + if (!type2.SupportsNumeric || type2.TypeName == "char") + { + continue; + } +#> +<# +// We won't support binary operations on pairs of signed and unsigned types yet. For users, there is a simple work around of cloning the columns to higher types(short -> int, int -> long etc) and then performing binary ops on them +if (IsMixedSignedAndUnsignedTypePair(type.TypeName, type2.TypeName)) { + // continue; +} + +// If the C# spec doesn't allow some implicit conversions, don't define that API +string returnType = GetBinaryOperationReturnType(type, type2); +if (returnType == string.Empty) +{ + continue; +} +#> + new TypeCombination("<#=type.TypeName#>", "<#=type2.TypeName#>", "<#=returnType#>"), +<# + } +} +#> + }; +} + +public static class ComparisonOperationCombinations +{ + public static List comparisonOperationCombinations = new List + { +<# + foreach (TypeConfiguration type in typeConfiguration) + { + if (type.TypeName == "char") + { + continue; + } + foreach (TypeConfiguration innerType in typeConfiguration) + { + if (innerType.TypeName == "char") + { + continue; + } + if (type.TypeName == "bool" && innerType.TypeName != "bool") + { + continue; + } + if (type.SupportsNumeric != innerType.SupportsNumeric) + { + continue; + } + // For comparison, we don't exclude mixed signed and unsigned types since the result is always a bool + + if (type.SupportsNumeric) + { + // If the C# spec doesn't allow some implicit conversions, don't define that API. For ex: float == decimal or long == ulong are not allowed + string returnType = GetBinaryOperationReturnType(type, innerType); + if (returnType == string.Empty) + { + continue; + } + } +#> + new TypeCombination("<#=type.TypeName#>", "<#=innerType.TypeName#>", "bool"), +<# + } + } +#> + }; +} +\#> diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude new file mode 100644 index 0000000000..23a88d1f12 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude @@ -0,0 +1,271 @@ + +<#+ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt. Do not modify directly + +public class TypeCombination +{ + private string _thisColumnType; + private string _otherColumnType; + private string _returnColumnType; + + public TypeCombination(string thisColumnType, string otherColumnType, string returnColumnType) + { + _thisColumnType = thisColumnType; + _otherColumnType = otherColumnType; + _returnColumnType = returnColumnType; + } + public string ThisColumnType => _thisColumnType; + public string OtherColumnType => _otherColumnType; + public string ReturnColumnType => _returnColumnType; +} + +public static class BinaryOperationCombinations +{ + + public static List binaryOperationCombinations = new List + { + new TypeCombination("byte", "byte", "int"), + new TypeCombination("byte", "decimal", "decimal"), + new TypeCombination("byte", "double", "double"), + new TypeCombination("byte", "float", "float"), + new TypeCombination("byte", "int", "int"), + new TypeCombination("byte", "long", "long"), + new TypeCombination("byte", "sbyte", "int"), + new TypeCombination("byte", "short", "int"), + new TypeCombination("byte", "uint", "uint"), + new TypeCombination("byte", "ulong", "ulong"), + new TypeCombination("byte", "ushort", "int"), + new TypeCombination("decimal", "byte", "decimal"), + new TypeCombination("decimal", "decimal", "decimal"), + new TypeCombination("decimal", "int", "decimal"), + new TypeCombination("decimal", "long", "decimal"), + new TypeCombination("decimal", "sbyte", "decimal"), + new TypeCombination("decimal", "short", "decimal"), + new TypeCombination("decimal", "uint", "decimal"), + new TypeCombination("decimal", "ulong", "decimal"), + new TypeCombination("decimal", "ushort", "decimal"), + new TypeCombination("double", "byte", "double"), + new TypeCombination("double", "double", "double"), + new TypeCombination("double", "float", "double"), + new TypeCombination("double", "int", "double"), + new TypeCombination("double", "long", "double"), + new TypeCombination("double", "sbyte", "double"), + new TypeCombination("double", "short", "double"), + new TypeCombination("double", "uint", "double"), + new TypeCombination("double", "ulong", "double"), + new TypeCombination("double", "ushort", "double"), + new TypeCombination("float", "byte", "float"), + new TypeCombination("float", "double", "double"), + new TypeCombination("float", "float", "float"), + new TypeCombination("float", "int", "float"), + new TypeCombination("float", "long", "float"), + new TypeCombination("float", "sbyte", "float"), + new TypeCombination("float", "short", "float"), + new TypeCombination("float", "uint", "float"), + new TypeCombination("float", "ulong", "float"), + new TypeCombination("float", "ushort", "float"), + new TypeCombination("int", "byte", "int"), + new TypeCombination("int", "decimal", "decimal"), + new TypeCombination("int", "double", "double"), + new TypeCombination("int", "float", "float"), + new TypeCombination("int", "int", "int"), + new TypeCombination("int", "long", "long"), + new TypeCombination("int", "sbyte", "int"), + new TypeCombination("int", "short", "int"), + new TypeCombination("int", "uint", "long"), + new TypeCombination("int", "ulong", "float"), + new TypeCombination("int", "ushort", "int"), + new TypeCombination("long", "byte", "long"), + new TypeCombination("long", "decimal", "decimal"), + new TypeCombination("long", "double", "double"), + new TypeCombination("long", "float", "float"), + new TypeCombination("long", "int", "long"), + new TypeCombination("long", "long", "long"), + new TypeCombination("long", "sbyte", "long"), + new TypeCombination("long", "short", "long"), + new TypeCombination("long", "uint", "long"), + new TypeCombination("long", "ushort", "long"), + new TypeCombination("sbyte", "byte", "int"), + new TypeCombination("sbyte", "decimal", "decimal"), + new TypeCombination("sbyte", "double", "double"), + new TypeCombination("sbyte", "float", "float"), + new TypeCombination("sbyte", "int", "int"), + new TypeCombination("sbyte", "long", "long"), + new TypeCombination("sbyte", "sbyte", "int"), + new TypeCombination("sbyte", "short", "int"), + new TypeCombination("sbyte", "uint", "long"), + new TypeCombination("sbyte", "ulong", "float"), + new TypeCombination("sbyte", "ushort", "int"), + new TypeCombination("short", "byte", "int"), + new TypeCombination("short", "decimal", "decimal"), + new TypeCombination("short", "double", "double"), + new TypeCombination("short", "float", "float"), + new TypeCombination("short", "int", "int"), + new TypeCombination("short", "long", "long"), + new TypeCombination("short", "sbyte", "int"), + new TypeCombination("short", "short", "int"), + new TypeCombination("short", "uint", "long"), + new TypeCombination("short", "ulong", "float"), + new TypeCombination("short", "ushort", "int"), + new TypeCombination("uint", "byte", "uint"), + new TypeCombination("uint", "decimal", "decimal"), + new TypeCombination("uint", "double", "double"), + new TypeCombination("uint", "float", "float"), + new TypeCombination("uint", "int", "long"), + new TypeCombination("uint", "long", "long"), + new TypeCombination("uint", "sbyte", "long"), + new TypeCombination("uint", "short", "long"), + new TypeCombination("uint", "uint", "uint"), + new TypeCombination("uint", "ulong", "ulong"), + new TypeCombination("uint", "ushort", "uint"), + new TypeCombination("ulong", "byte", "ulong"), + new TypeCombination("ulong", "decimal", "decimal"), + new TypeCombination("ulong", "double", "double"), + new TypeCombination("ulong", "float", "float"), + new TypeCombination("ulong", "int", "float"), + new TypeCombination("ulong", "sbyte", "float"), + new TypeCombination("ulong", "short", "float"), + new TypeCombination("ulong", "uint", "ulong"), + new TypeCombination("ulong", "ulong", "ulong"), + new TypeCombination("ulong", "ushort", "ulong"), + new TypeCombination("ushort", "byte", "int"), + new TypeCombination("ushort", "decimal", "decimal"), + new TypeCombination("ushort", "double", "double"), + new TypeCombination("ushort", "float", "float"), + new TypeCombination("ushort", "int", "int"), + new TypeCombination("ushort", "long", "long"), + new TypeCombination("ushort", "sbyte", "int"), + new TypeCombination("ushort", "short", "int"), + new TypeCombination("ushort", "uint", "uint"), + new TypeCombination("ushort", "ulong", "ulong"), + new TypeCombination("ushort", "ushort", "int"), + }; +} + +public static class ComparisonOperationCombinations +{ + public static List comparisonOperationCombinations = new List + { + new TypeCombination("bool", "bool", "bool"), + new TypeCombination("byte", "byte", "bool"), + new TypeCombination("byte", "decimal", "bool"), + new TypeCombination("byte", "double", "bool"), + new TypeCombination("byte", "float", "bool"), + new TypeCombination("byte", "int", "bool"), + new TypeCombination("byte", "long", "bool"), + new TypeCombination("byte", "sbyte", "bool"), + new TypeCombination("byte", "short", "bool"), + new TypeCombination("byte", "uint", "bool"), + new TypeCombination("byte", "ulong", "bool"), + new TypeCombination("byte", "ushort", "bool"), + new TypeCombination("decimal", "byte", "bool"), + new TypeCombination("decimal", "decimal", "bool"), + new TypeCombination("decimal", "int", "bool"), + new TypeCombination("decimal", "long", "bool"), + new TypeCombination("decimal", "sbyte", "bool"), + new TypeCombination("decimal", "short", "bool"), + new TypeCombination("decimal", "uint", "bool"), + new TypeCombination("decimal", "ulong", "bool"), + new TypeCombination("decimal", "ushort", "bool"), + new TypeCombination("double", "byte", "bool"), + new TypeCombination("double", "double", "bool"), + new TypeCombination("double", "float", "bool"), + new TypeCombination("double", "int", "bool"), + new TypeCombination("double", "long", "bool"), + new TypeCombination("double", "sbyte", "bool"), + new TypeCombination("double", "short", "bool"), + new TypeCombination("double", "uint", "bool"), + new TypeCombination("double", "ulong", "bool"), + new TypeCombination("double", "ushort", "bool"), + new TypeCombination("float", "byte", "bool"), + new TypeCombination("float", "double", "bool"), + new TypeCombination("float", "float", "bool"), + new TypeCombination("float", "int", "bool"), + new TypeCombination("float", "long", "bool"), + new TypeCombination("float", "sbyte", "bool"), + new TypeCombination("float", "short", "bool"), + new TypeCombination("float", "uint", "bool"), + new TypeCombination("float", "ulong", "bool"), + new TypeCombination("float", "ushort", "bool"), + new TypeCombination("int", "byte", "bool"), + new TypeCombination("int", "decimal", "bool"), + new TypeCombination("int", "double", "bool"), + new TypeCombination("int", "float", "bool"), + new TypeCombination("int", "int", "bool"), + new TypeCombination("int", "long", "bool"), + new TypeCombination("int", "sbyte", "bool"), + new TypeCombination("int", "short", "bool"), + new TypeCombination("int", "uint", "bool"), + new TypeCombination("int", "ulong", "bool"), + new TypeCombination("int", "ushort", "bool"), + new TypeCombination("long", "byte", "bool"), + new TypeCombination("long", "decimal", "bool"), + new TypeCombination("long", "double", "bool"), + new TypeCombination("long", "float", "bool"), + new TypeCombination("long", "int", "bool"), + new TypeCombination("long", "long", "bool"), + new TypeCombination("long", "sbyte", "bool"), + new TypeCombination("long", "short", "bool"), + new TypeCombination("long", "uint", "bool"), + new TypeCombination("long", "ushort", "bool"), + new TypeCombination("sbyte", "byte", "bool"), + new TypeCombination("sbyte", "decimal", "bool"), + new TypeCombination("sbyte", "double", "bool"), + new TypeCombination("sbyte", "float", "bool"), + new TypeCombination("sbyte", "int", "bool"), + new TypeCombination("sbyte", "long", "bool"), + new TypeCombination("sbyte", "sbyte", "bool"), + new TypeCombination("sbyte", "short", "bool"), + new TypeCombination("sbyte", "uint", "bool"), + new TypeCombination("sbyte", "ulong", "bool"), + new TypeCombination("sbyte", "ushort", "bool"), + new TypeCombination("short", "byte", "bool"), + new TypeCombination("short", "decimal", "bool"), + new TypeCombination("short", "double", "bool"), + new TypeCombination("short", "float", "bool"), + new TypeCombination("short", "int", "bool"), + new TypeCombination("short", "long", "bool"), + new TypeCombination("short", "sbyte", "bool"), + new TypeCombination("short", "short", "bool"), + new TypeCombination("short", "uint", "bool"), + new TypeCombination("short", "ulong", "bool"), + new TypeCombination("short", "ushort", "bool"), + new TypeCombination("uint", "byte", "bool"), + new TypeCombination("uint", "decimal", "bool"), + new TypeCombination("uint", "double", "bool"), + new TypeCombination("uint", "float", "bool"), + new TypeCombination("uint", "int", "bool"), + new TypeCombination("uint", "long", "bool"), + new TypeCombination("uint", "sbyte", "bool"), + new TypeCombination("uint", "short", "bool"), + new TypeCombination("uint", "uint", "bool"), + new TypeCombination("uint", "ulong", "bool"), + new TypeCombination("uint", "ushort", "bool"), + new TypeCombination("ulong", "byte", "bool"), + new TypeCombination("ulong", "decimal", "bool"), + new TypeCombination("ulong", "double", "bool"), + new TypeCombination("ulong", "float", "bool"), + new TypeCombination("ulong", "int", "bool"), + new TypeCombination("ulong", "sbyte", "bool"), + new TypeCombination("ulong", "short", "bool"), + new TypeCombination("ulong", "uint", "bool"), + new TypeCombination("ulong", "ulong", "bool"), + new TypeCombination("ulong", "ushort", "bool"), + new TypeCombination("ushort", "byte", "bool"), + new TypeCombination("ushort", "decimal", "bool"), + new TypeCombination("ushort", "double", "bool"), + new TypeCombination("ushort", "float", "bool"), + new TypeCombination("ushort", "int", "bool"), + new TypeCombination("ushort", "long", "bool"), + new TypeCombination("ushort", "sbyte", "bool"), + new TypeCombination("ushort", "short", "bool"), + new TypeCombination("ushort", "uint", "bool"), + new TypeCombination("ushort", "ulong", "bool"), + new TypeCombination("ushort", "ushort", "bool"), + }; +} +#> diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs index 13cdeda040..db4fa787af 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs @@ -1710,7 +1710,7 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(Primi { throw new NotSupportedException(); } - PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn(); (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(column._columnContainer, retColumn._columnContainer); return retColumn; case Type decimalType when decimalType == typeof(decimal): @@ -1722,13 +1722,13 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(Primi { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseEquals(column._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseEquals(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -1752,7 +1752,7 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(Primi { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseEquals(column._columnContainer, newColumn._columnContainer); return newColumn; } @@ -1760,14 +1760,14 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(Primi { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseEquals((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseEquals(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -1786,7 +1786,7 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val { throw new NotSupportedException(); } - PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn(); (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(Unsafe.As(ref value), retColumn._columnContainer); return retColumn; case Type decimalType when decimalType == typeof(decimal): @@ -1798,13 +1798,13 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseEquals(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; @@ -1828,7 +1828,7 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseEquals(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } @@ -1836,14 +1836,14 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseEquals(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); return newColumn; @@ -1867,7 +1867,7 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(Pr { throw new NotSupportedException(); } - PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn(); (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(column._columnContainer, retColumn._columnContainer); return retColumn; case Type decimalType when decimalType == typeof(decimal): @@ -1879,13 +1879,13 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(Pr { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseNotEquals(column._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseNotEquals(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -1909,7 +1909,7 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(Pr { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseNotEquals(column._columnContainer, newColumn._columnContainer); return newColumn; } @@ -1917,14 +1917,14 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(Pr { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseNotEquals((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseNotEquals(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -1943,7 +1943,7 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U { throw new NotSupportedException(); } - PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn(); (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), retColumn._columnContainer); return retColumn; case Type decimalType when decimalType == typeof(decimal): @@ -1955,13 +1955,13 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseNotEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; @@ -1985,7 +1985,7 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } @@ -1993,14 +1993,14 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseNotEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseNotEquals(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); return newColumn; @@ -2030,13 +2030,13 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(column._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -2060,7 +2060,7 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(column._columnContainer, newColumn._columnContainer); return newColumn; } @@ -2068,14 +2068,14 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseGreaterThanOrEqual(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -2100,13 +2100,13 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; @@ -2130,7 +2130,7 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseGreaterThanOrEqual(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } @@ -2138,14 +2138,14 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseGreaterThanOrEqual(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); return newColumn; @@ -2175,13 +2175,13 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(column._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseLessThanOrEqual(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -2205,7 +2205,7 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(column._columnContainer, newColumn._columnContainer); return newColumn; } @@ -2213,14 +2213,14 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseLessThanOrEqual((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseLessThanOrEqual(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -2245,13 +2245,13 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseLessThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; @@ -2275,7 +2275,7 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseLessThanOrEqual(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } @@ -2283,14 +2283,14 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseLessThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseLessThanOrEqual(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); return newColumn; @@ -2320,13 +2320,13 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseGreaterThan(column._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseGreaterThan(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -2350,7 +2350,7 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseGreaterThan(column._columnContainer, newColumn._columnContainer); return newColumn; } @@ -2358,14 +2358,14 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseGreaterThan((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseGreaterThan(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -2390,13 +2390,13 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseGreaterThan(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseGreaterThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; @@ -2420,7 +2420,7 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseGreaterThan(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } @@ -2428,14 +2428,14 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation( { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseGreaterThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseGreaterThan(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); return newColumn; @@ -2465,13 +2465,13 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(Pri { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseLessThan(column._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseLessThan(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -2495,7 +2495,7 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(Pri { // No conversions PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseLessThan(column._columnContainer, newColumn._columnContainer); return newColumn; } @@ -2503,14 +2503,14 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(Pri { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseLessThan((column as PrimitiveDataFrameColumn)._columnContainer, newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseLessThan(column.CloneAsDoubleColumn()._columnContainer, newColumn._columnContainer); return newColumn; @@ -2535,13 +2535,13 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(U v { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseLessThan(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseLessThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; @@ -2565,7 +2565,7 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(U v { // No conversions PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.ElementwiseLessThan(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; } @@ -2573,14 +2573,14 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(U v { if (typeof(U) == typeof(decimal)) { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.ElementwiseLessThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); return newColumn; } else { - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.ElementwiseLessThan(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); return newColumn; diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt index 8dee5658d3..3c7bc4d635 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt @@ -173,7 +173,7 @@ namespace Microsoft.Data.Analysis throw new NotSupportedException(); } <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> - PrimitiveDataFrameColumn retColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn(); <# if (method.MethodType == MethodType.ComparisonScalar) { #> (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value), retColumn._columnContainer); <# } else { #> @@ -202,12 +202,12 @@ namespace Microsoft.Data.Analysis <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> <# if (method.MethodType == MethodType.ComparisonScalar) { #> PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; <# } else { #> PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.<#=method.MethodName#>(column._columnContainer, newColumn._columnContainer); return newColumn; <# } #> @@ -239,7 +239,7 @@ namespace Microsoft.Data.Analysis } <# } #> <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); <# if (method.MethodType == MethodType.ComparisonScalar) { #> PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); @@ -285,12 +285,12 @@ namespace Microsoft.Data.Analysis <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> <# if (method.MethodType == MethodType.ComparisonScalar) { #> PrimitiveDataFrameColumn primitiveColumn = this; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value), newColumn._columnContainer); return newColumn; <# } else { #> PrimitiveDataFrameColumn primitiveColumn = this as PrimitiveDataFrameColumn; - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); primitiveColumn._columnContainer.<#=method.MethodName#>(column._columnContainer, newColumn._columnContainer); return newColumn; <# } #> @@ -324,7 +324,7 @@ namespace Microsoft.Data.Analysis if (typeof(U) == typeof(decimal)) { <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); <# if (method.MethodType == MethodType.ComparisonScalar) { #> PrimitiveDataFrameColumn decimalColumn = CloneAsDecimalColumn(); decimalColumn._columnContainer.<#=method.MethodName#>(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer); @@ -349,7 +349,7 @@ namespace Microsoft.Data.Analysis else { <# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #> - PrimitiveDataFrameColumn newColumn = CloneAsBoolColumn(); + PrimitiveDataFrameColumn newColumn = CloneAsBooleanColumn(); <# if (method.MethodType == MethodType.ComparisonScalar) { #> PrimitiveDataFrameColumn doubleColumn = CloneAsDoubleColumn(); doubleColumn._columnContainer.<#=method.MethodName#>(DoubleConverter.Instance.GetDouble(value), newColumn._columnContainer); diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperators.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperators.cs new file mode 100644 index 0000000000..ab89c880d9 --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperators.cs @@ -0,0 +1,7397 @@ + + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(ByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(ByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(ByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(ByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(ByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(ByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(SingleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(Int32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(Int32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(Int32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(Int32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(Int64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(Int64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(Int64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(SByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(SByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(SByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(SByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(SByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(Int16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(Int16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(Int16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(Int16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(Int16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator +(UInt32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(UInt32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(UInt32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(UInt32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(UInt32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(UInt32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(UInt32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(UInt32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(UInt32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(UInt32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(UInt32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator +(UInt64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(UInt64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(UInt64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(UInt64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(UInt64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(UInt64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(UInt64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(UInt64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(UInt64DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(UInt64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(UInt16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(UInt16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(UInt16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(UInt16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(UInt16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(UInt16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Add(right); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, byte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(byte left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(ByteDataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(ByteDataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(ByteDataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, int right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(int left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(ByteDataFrameColumn left, long right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(long left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(sbyte left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, short right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(short left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt32DataFrameColumn operator +(ByteDataFrameColumn left, uint right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(uint left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt64DataFrameColumn operator +(ByteDataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(ulong left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(ByteDataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ushort left, ByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, byte right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(byte left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, int right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(int left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, long right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(long left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(sbyte left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, short right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(short left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, uint right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(uint left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(ulong left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(DecimalDataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(ushort left, DecimalDataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, byte right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(byte left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, float right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(float left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, int right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(int left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, long right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(long left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(sbyte left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, short right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(short left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, uint right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(uint left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(ulong left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(DoubleDataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(ushort left, DoubleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, byte right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(byte left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(SingleDataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, int right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(int left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, long right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(long left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(sbyte left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, short right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(short left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, uint right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(uint left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(ulong left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SingleDataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(ushort left, SingleDataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, byte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(byte left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(Int32DataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(Int32DataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(Int32DataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, int right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(int left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int32DataFrameColumn left, long right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(long left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(sbyte left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, short right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(short left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int32DataFrameColumn left, uint right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(uint left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(Int32DataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(ulong left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(Int32DataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ushort left, Int32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, byte right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(byte left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(Int64DataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(Int64DataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(Int64DataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, int right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(int left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, long right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(long left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(sbyte left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, short right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(short left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, uint right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(uint left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int64DataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(ushort left, Int64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, byte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(byte left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(SByteDataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(SByteDataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SByteDataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, int right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(int left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(SByteDataFrameColumn left, long right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(long left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(sbyte left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, short right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(short left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(SByteDataFrameColumn left, uint right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(uint left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(SByteDataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(ulong left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(SByteDataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ushort left, SByteDataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, byte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(byte left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(Int16DataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(Int16DataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(Int16DataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, int right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(int left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int16DataFrameColumn left, long right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(long left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(sbyte left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, short right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(short left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(Int16DataFrameColumn left, uint right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(uint left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(Int16DataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(ulong left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(Int16DataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ushort left, Int16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator +(UInt32DataFrameColumn left, byte right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(byte left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(UInt32DataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(UInt32DataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(UInt32DataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(UInt32DataFrameColumn left, int right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(int left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(UInt32DataFrameColumn left, long right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(long left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(UInt32DataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(sbyte left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(UInt32DataFrameColumn left, short right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(short left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt32DataFrameColumn operator +(UInt32DataFrameColumn left, uint right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(uint left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt64DataFrameColumn operator +(UInt32DataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(ulong left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt32DataFrameColumn operator +(UInt32DataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(ushort left, UInt32DataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator +(UInt64DataFrameColumn left, byte right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(byte left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(UInt64DataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(UInt64DataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(UInt64DataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(UInt64DataFrameColumn left, int right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(int left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(UInt64DataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(sbyte left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(UInt64DataFrameColumn left, short right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(short left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt64DataFrameColumn operator +(UInt64DataFrameColumn left, uint right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(uint left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt64DataFrameColumn operator +(UInt64DataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(ulong left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt64DataFrameColumn operator +(UInt64DataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(ushort left, UInt64DataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, byte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(byte left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DecimalDataFrameColumn operator +(UInt16DataFrameColumn left, decimal right) + { + return left.Add(right); + } + public static DecimalDataFrameColumn operator +(decimal left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static DoubleDataFrameColumn operator +(UInt16DataFrameColumn left, double right) + { + return left.Add(right); + } + public static DoubleDataFrameColumn operator +(double left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static SingleDataFrameColumn operator +(UInt16DataFrameColumn left, float right) + { + return left.Add(right); + } + public static SingleDataFrameColumn operator +(float left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, int right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(int left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int64DataFrameColumn operator +(UInt16DataFrameColumn left, long right) + { + return left.Add(right); + } + public static Int64DataFrameColumn operator +(long left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, sbyte right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(sbyte left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, short right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(short left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt32DataFrameColumn operator +(UInt16DataFrameColumn left, uint right) + { + return left.Add(right); + } + public static UInt32DataFrameColumn operator +(uint left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static UInt64DataFrameColumn operator +(UInt16DataFrameColumn left, ulong right) + { + return left.Add(right); + } + public static UInt64DataFrameColumn operator +(ulong left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + public static Int32DataFrameColumn operator +(UInt16DataFrameColumn left, ushort right) + { + return left.Add(right); + } + public static Int32DataFrameColumn operator +(ushort left, UInt16DataFrameColumn right) + { + return right.ReverseAdd(left); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(ByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(ByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(ByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(ByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(ByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(ByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(SingleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(Int32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(Int32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(Int32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(Int32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(Int64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(Int64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(Int64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(SByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(SByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(SByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(SByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(SByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(Int16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(Int16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(Int16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(Int16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(Int16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator -(UInt32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(UInt32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(UInt32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(UInt32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(UInt32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(UInt32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(UInt32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(UInt32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(UInt32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(UInt32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(UInt32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator -(UInt64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(UInt64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(UInt64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(UInt64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(UInt64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(UInt64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(UInt64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(UInt64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(UInt64DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(UInt64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(UInt16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(UInt16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(UInt16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(UInt16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(UInt16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(UInt16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Subtract(right); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(byte left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(ByteDataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(ByteDataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(ByteDataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(int left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(ByteDataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(long left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(sbyte left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(short left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt32DataFrameColumn operator -(ByteDataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(uint left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt64DataFrameColumn operator -(ByteDataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(ulong left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(ByteDataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ushort left, ByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(byte left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(int left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(long left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(sbyte left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(short left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(uint left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(ulong left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(DecimalDataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(ushort left, DecimalDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(byte left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(float left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(int left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(long left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(sbyte left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(short left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(uint left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(ulong left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(DoubleDataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(ushort left, DoubleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(byte left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(SingleDataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(int left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(long left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(sbyte left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(short left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(uint left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(ulong left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SingleDataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(ushort left, SingleDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(byte left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(Int32DataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(Int32DataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(Int32DataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(int left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int32DataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(long left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(sbyte left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(short left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int32DataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(uint left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(Int32DataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(ulong left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(Int32DataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ushort left, Int32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(byte left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(Int64DataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(Int64DataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(Int64DataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(int left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(long left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(sbyte left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(short left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(uint left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int64DataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(ushort left, Int64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(byte left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(SByteDataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(SByteDataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SByteDataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(int left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(SByteDataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(long left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(sbyte left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(short left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(SByteDataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(uint left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(SByteDataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(ulong left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(SByteDataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ushort left, SByteDataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(byte left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(Int16DataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(Int16DataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(Int16DataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(int left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int16DataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(long left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(sbyte left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(short left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(Int16DataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(uint left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(Int16DataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(ulong left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(Int16DataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ushort left, Int16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator -(UInt32DataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(byte left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(UInt32DataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(UInt32DataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(UInt32DataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(UInt32DataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(int left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(UInt32DataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(long left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(UInt32DataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(sbyte left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(UInt32DataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(short left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt32DataFrameColumn operator -(UInt32DataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(uint left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt64DataFrameColumn operator -(UInt32DataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(ulong left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt32DataFrameColumn operator -(UInt32DataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(ushort left, UInt32DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator -(UInt64DataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(byte left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(UInt64DataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(UInt64DataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(UInt64DataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(UInt64DataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(int left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(UInt64DataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(sbyte left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(UInt64DataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(short left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt64DataFrameColumn operator -(UInt64DataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(uint left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt64DataFrameColumn operator -(UInt64DataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(ulong left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt64DataFrameColumn operator -(UInt64DataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(ushort left, UInt64DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, byte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(byte left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DecimalDataFrameColumn operator -(UInt16DataFrameColumn left, decimal right) + { + return left.Subtract(right); + } + public static DecimalDataFrameColumn operator -(decimal left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static DoubleDataFrameColumn operator -(UInt16DataFrameColumn left, double right) + { + return left.Subtract(right); + } + public static DoubleDataFrameColumn operator -(double left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static SingleDataFrameColumn operator -(UInt16DataFrameColumn left, float right) + { + return left.Subtract(right); + } + public static SingleDataFrameColumn operator -(float left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, int right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(int left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int64DataFrameColumn operator -(UInt16DataFrameColumn left, long right) + { + return left.Subtract(right); + } + public static Int64DataFrameColumn operator -(long left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, sbyte right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(sbyte left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, short right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(short left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt32DataFrameColumn operator -(UInt16DataFrameColumn left, uint right) + { + return left.Subtract(right); + } + public static UInt32DataFrameColumn operator -(uint left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static UInt64DataFrameColumn operator -(UInt16DataFrameColumn left, ulong right) + { + return left.Subtract(right); + } + public static UInt64DataFrameColumn operator -(ulong left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + public static Int32DataFrameColumn operator -(UInt16DataFrameColumn left, ushort right) + { + return left.Subtract(right); + } + public static Int32DataFrameColumn operator -(ushort left, UInt16DataFrameColumn right) + { + return right.ReverseSubtract(left); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(ByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(ByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(ByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(ByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(ByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(ByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(SingleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(Int32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(Int32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(Int32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(Int32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(Int64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(Int64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(Int64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(SByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(SByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(SByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(SByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(SByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(Int16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(Int16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(Int16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(Int16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(Int16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator *(UInt32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(UInt32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(UInt32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(UInt32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(UInt32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(UInt32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(UInt32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(UInt32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(UInt32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(UInt32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(UInt32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator *(UInt64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(UInt64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(UInt64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(UInt64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(UInt64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(UInt64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(UInt64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(UInt64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(UInt64DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(UInt64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(UInt16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(UInt16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(UInt16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(UInt16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(UInt16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(UInt16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Multiply(right); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(byte left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(ByteDataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(ByteDataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(ByteDataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(int left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(ByteDataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(long left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(sbyte left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(short left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt32DataFrameColumn operator *(ByteDataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(uint left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt64DataFrameColumn operator *(ByteDataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(ulong left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(ByteDataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ushort left, ByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(byte left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(int left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(long left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(sbyte left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(short left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(uint left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(ulong left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(DecimalDataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(ushort left, DecimalDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(byte left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(float left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(int left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(long left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(sbyte left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(short left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(uint left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(ulong left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(DoubleDataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(ushort left, DoubleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(byte left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(SingleDataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(int left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(long left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(sbyte left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(short left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(uint left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(ulong left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SingleDataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(ushort left, SingleDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(byte left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(Int32DataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(Int32DataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(Int32DataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(int left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int32DataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(long left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(sbyte left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(short left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int32DataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(uint left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(Int32DataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(ulong left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(Int32DataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ushort left, Int32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(byte left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(Int64DataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(Int64DataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(Int64DataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(int left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(long left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(sbyte left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(short left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(uint left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int64DataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(ushort left, Int64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(byte left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(SByteDataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(SByteDataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SByteDataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(int left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(SByteDataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(long left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(sbyte left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(short left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(SByteDataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(uint left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(SByteDataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(ulong left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(SByteDataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ushort left, SByteDataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(byte left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(Int16DataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(Int16DataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(Int16DataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(int left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int16DataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(long left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(sbyte left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(short left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(Int16DataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(uint left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(Int16DataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(ulong left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(Int16DataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ushort left, Int16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator *(UInt32DataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(byte left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(UInt32DataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(UInt32DataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(UInt32DataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(UInt32DataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(int left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(UInt32DataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(long left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(UInt32DataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(sbyte left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(UInt32DataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(short left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt32DataFrameColumn operator *(UInt32DataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(uint left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt64DataFrameColumn operator *(UInt32DataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(ulong left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt32DataFrameColumn operator *(UInt32DataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(ushort left, UInt32DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator *(UInt64DataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(byte left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(UInt64DataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(UInt64DataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(UInt64DataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(UInt64DataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(int left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(UInt64DataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(sbyte left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(UInt64DataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(short left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt64DataFrameColumn operator *(UInt64DataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(uint left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt64DataFrameColumn operator *(UInt64DataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(ulong left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt64DataFrameColumn operator *(UInt64DataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(ushort left, UInt64DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, byte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(byte left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DecimalDataFrameColumn operator *(UInt16DataFrameColumn left, decimal right) + { + return left.Multiply(right); + } + public static DecimalDataFrameColumn operator *(decimal left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static DoubleDataFrameColumn operator *(UInt16DataFrameColumn left, double right) + { + return left.Multiply(right); + } + public static DoubleDataFrameColumn operator *(double left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static SingleDataFrameColumn operator *(UInt16DataFrameColumn left, float right) + { + return left.Multiply(right); + } + public static SingleDataFrameColumn operator *(float left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, int right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(int left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int64DataFrameColumn operator *(UInt16DataFrameColumn left, long right) + { + return left.Multiply(right); + } + public static Int64DataFrameColumn operator *(long left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, sbyte right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(sbyte left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, short right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(short left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt32DataFrameColumn operator *(UInt16DataFrameColumn left, uint right) + { + return left.Multiply(right); + } + public static UInt32DataFrameColumn operator *(uint left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static UInt64DataFrameColumn operator *(UInt16DataFrameColumn left, ulong right) + { + return left.Multiply(right); + } + public static UInt64DataFrameColumn operator *(ulong left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + public static Int32DataFrameColumn operator *(UInt16DataFrameColumn left, ushort right) + { + return left.Multiply(right); + } + public static Int32DataFrameColumn operator *(ushort left, UInt16DataFrameColumn right) + { + return right.ReverseMultiply(left); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(ByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(ByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(ByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(ByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(ByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(ByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(SingleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(Int32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(Int32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(Int32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(Int32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(Int64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(Int64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(Int64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(SByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(SByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(SByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(SByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(SByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(Int16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(Int16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(Int16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(Int16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(Int16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator /(UInt32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(UInt32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(UInt32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(UInt32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(UInt32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(UInt32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(UInt32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(UInt32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(UInt32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(UInt32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(UInt32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator /(UInt64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(UInt64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(UInt64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(UInt64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(UInt64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(UInt64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(UInt64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(UInt64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(UInt64DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(UInt64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(UInt16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(UInt16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(UInt16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(UInt16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(UInt16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(UInt16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Divide(right); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(byte left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(ByteDataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(ByteDataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(ByteDataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, int right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(int left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(ByteDataFrameColumn left, long right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(long left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(sbyte left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, short right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(short left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt32DataFrameColumn operator /(ByteDataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(uint left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt64DataFrameColumn operator /(ByteDataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(ulong left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(ByteDataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ushort left, ByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(byte left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, int right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(int left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, long right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(long left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(sbyte left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, short right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(short left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(uint left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(ulong left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(DecimalDataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(ushort left, DecimalDataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(byte left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, float right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(float left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, int right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(int left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, long right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(long left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(sbyte left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, short right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(short left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(uint left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(ulong left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(DoubleDataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(ushort left, DoubleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(byte left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(SingleDataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, int right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(int left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, long right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(long left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(sbyte left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, short right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(short left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(uint left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(ulong left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SingleDataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(ushort left, SingleDataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(byte left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(Int32DataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(Int32DataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(Int32DataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, int right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(int left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int32DataFrameColumn left, long right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(long left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(sbyte left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, short right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(short left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int32DataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(uint left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(Int32DataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(ulong left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(Int32DataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ushort left, Int32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(byte left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(Int64DataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(Int64DataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(Int64DataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, int right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(int left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, long right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(long left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(sbyte left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, short right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(short left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(uint left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int64DataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(ushort left, Int64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(byte left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(SByteDataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(SByteDataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SByteDataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, int right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(int left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(SByteDataFrameColumn left, long right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(long left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(sbyte left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, short right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(short left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(SByteDataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(uint left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(SByteDataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(ulong left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(SByteDataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ushort left, SByteDataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(byte left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(Int16DataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(Int16DataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(Int16DataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, int right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(int left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int16DataFrameColumn left, long right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(long left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(sbyte left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, short right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(short left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(Int16DataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(uint left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(Int16DataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(ulong left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(Int16DataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ushort left, Int16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator /(UInt32DataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(byte left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(UInt32DataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(UInt32DataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(UInt32DataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(UInt32DataFrameColumn left, int right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(int left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(UInt32DataFrameColumn left, long right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(long left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(UInt32DataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(sbyte left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(UInt32DataFrameColumn left, short right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(short left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt32DataFrameColumn operator /(UInt32DataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(uint left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt64DataFrameColumn operator /(UInt32DataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(ulong left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt32DataFrameColumn operator /(UInt32DataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(ushort left, UInt32DataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator /(UInt64DataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(byte left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(UInt64DataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(UInt64DataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(UInt64DataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(UInt64DataFrameColumn left, int right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(int left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(UInt64DataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(sbyte left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(UInt64DataFrameColumn left, short right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(short left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt64DataFrameColumn operator /(UInt64DataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(uint left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt64DataFrameColumn operator /(UInt64DataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(ulong left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt64DataFrameColumn operator /(UInt64DataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(ushort left, UInt64DataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, byte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(byte left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DecimalDataFrameColumn operator /(UInt16DataFrameColumn left, decimal right) + { + return left.Divide(right); + } + public static DecimalDataFrameColumn operator /(decimal left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static DoubleDataFrameColumn operator /(UInt16DataFrameColumn left, double right) + { + return left.Divide(right); + } + public static DoubleDataFrameColumn operator /(double left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static SingleDataFrameColumn operator /(UInt16DataFrameColumn left, float right) + { + return left.Divide(right); + } + public static SingleDataFrameColumn operator /(float left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, int right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(int left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int64DataFrameColumn operator /(UInt16DataFrameColumn left, long right) + { + return left.Divide(right); + } + public static Int64DataFrameColumn operator /(long left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, sbyte right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(sbyte left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, short right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(short left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt32DataFrameColumn operator /(UInt16DataFrameColumn left, uint right) + { + return left.Divide(right); + } + public static UInt32DataFrameColumn operator /(uint left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static UInt64DataFrameColumn operator /(UInt16DataFrameColumn left, ulong right) + { + return left.Divide(right); + } + public static UInt64DataFrameColumn operator /(ulong left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + public static Int32DataFrameColumn operator /(UInt16DataFrameColumn left, ushort right) + { + return left.Divide(right); + } + public static Int32DataFrameColumn operator /(ushort left, UInt16DataFrameColumn right) + { + return right.ReverseDivide(left); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(ByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(ByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(ByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(ByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(ByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(ByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(SingleDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(Int32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(Int32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(Int32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(Int32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(Int64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(Int64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(Int64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(SByteDataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(SByteDataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SByteDataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(SByteDataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(SByteDataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(SByteDataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(Int16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(Int16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(Int16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(Int16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(Int16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator %(UInt32DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(UInt32DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(UInt32DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(UInt32DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(UInt32DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(UInt32DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(UInt32DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(UInt32DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(UInt32DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(UInt32DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(UInt32DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator %(UInt64DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(UInt64DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(UInt64DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(UInt64DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(UInt64DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(UInt64DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(UInt64DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(UInt64DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(UInt64DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(UInt64DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, ByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(UInt16DataFrameColumn left, DecimalDataFrameColumn right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(UInt16DataFrameColumn left, DoubleDataFrameColumn right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(UInt16DataFrameColumn left, SingleDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, Int32DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(UInt16DataFrameColumn left, Int64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, SByteDataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, Int16DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(UInt16DataFrameColumn left, UInt32DataFrameColumn right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(UInt16DataFrameColumn left, UInt64DataFrameColumn right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, UInt16DataFrameColumn right) + { + return left.Modulo(right); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(byte left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(ByteDataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(ByteDataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(ByteDataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(int left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(ByteDataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(long left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(sbyte left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(short left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt32DataFrameColumn operator %(ByteDataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(uint left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt64DataFrameColumn operator %(ByteDataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(ulong left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(ByteDataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ushort left, ByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class DecimalDataFrameColumn + { + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(byte left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(int left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(long left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(sbyte left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(short left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(uint left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(ulong left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(DecimalDataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(ushort left, DecimalDataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class DoubleDataFrameColumn + { + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(byte left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(float left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(int left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(long left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(sbyte left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(short left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(uint left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(ulong left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(DoubleDataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(ushort left, DoubleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class SingleDataFrameColumn + { + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(byte left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(SingleDataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(int left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(long left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(sbyte left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(short left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(uint left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(ulong left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SingleDataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(ushort left, SingleDataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(byte left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(Int32DataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(Int32DataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(Int32DataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(int left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int32DataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(long left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(sbyte left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(short left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int32DataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(uint left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(Int32DataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(ulong left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(Int32DataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ushort left, Int32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(byte left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(Int64DataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(Int64DataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(Int64DataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(int left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(long left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(sbyte left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(short left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(uint left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int64DataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(ushort left, Int64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(byte left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(SByteDataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(SByteDataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SByteDataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(int left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(SByteDataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(long left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(sbyte left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(short left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(SByteDataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(uint left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(SByteDataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(ulong left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(SByteDataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ushort left, SByteDataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(byte left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(Int16DataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(Int16DataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(Int16DataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(int left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int16DataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(long left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(sbyte left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(short left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(Int16DataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(uint left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(Int16DataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(ulong left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(Int16DataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ushort left, Int16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator %(UInt32DataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(byte left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(UInt32DataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(UInt32DataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(UInt32DataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(UInt32DataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(int left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(UInt32DataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(long left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(UInt32DataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(sbyte left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(UInt32DataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(short left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt32DataFrameColumn operator %(UInt32DataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(uint left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt64DataFrameColumn operator %(UInt32DataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(ulong left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt32DataFrameColumn operator %(UInt32DataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(ushort left, UInt32DataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator %(UInt64DataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(byte left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(UInt64DataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(UInt64DataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(UInt64DataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(UInt64DataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(int left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(UInt64DataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(sbyte left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(UInt64DataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(short left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt64DataFrameColumn operator %(UInt64DataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(uint left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt64DataFrameColumn operator %(UInt64DataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(ulong left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt64DataFrameColumn operator %(UInt64DataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(ushort left, UInt64DataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, byte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(byte left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DecimalDataFrameColumn operator %(UInt16DataFrameColumn left, decimal right) + { + return left.Modulo(right); + } + public static DecimalDataFrameColumn operator %(decimal left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static DoubleDataFrameColumn operator %(UInt16DataFrameColumn left, double right) + { + return left.Modulo(right); + } + public static DoubleDataFrameColumn operator %(double left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static SingleDataFrameColumn operator %(UInt16DataFrameColumn left, float right) + { + return left.Modulo(right); + } + public static SingleDataFrameColumn operator %(float left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, int right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(int left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int64DataFrameColumn operator %(UInt16DataFrameColumn left, long right) + { + return left.Modulo(right); + } + public static Int64DataFrameColumn operator %(long left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, sbyte right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(sbyte left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, short right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(short left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt32DataFrameColumn operator %(UInt16DataFrameColumn left, uint right) + { + return left.Modulo(right); + } + public static UInt32DataFrameColumn operator %(uint left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static UInt64DataFrameColumn operator %(UInt16DataFrameColumn left, ulong right) + { + return left.Modulo(right); + } + public static UInt64DataFrameColumn operator %(ulong left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + public static Int32DataFrameColumn operator %(UInt16DataFrameColumn left, ushort right) + { + return left.Modulo(right); + } + public static Int32DataFrameColumn operator %(ushort left, UInt16DataFrameColumn right) + { + return right.ReverseModulo(left); + } + } + public partial class BooleanDataFrameColumn + { + public static BooleanDataFrameColumn operator &(BooleanDataFrameColumn left, BooleanDataFrameColumn right) + { + return left.And(right); + } + } + public partial class BooleanDataFrameColumn + { + public static BooleanDataFrameColumn operator &(BooleanDataFrameColumn left, bool right) + { + return left.And(right); + } + } + public partial class BooleanDataFrameColumn + { + public static BooleanDataFrameColumn operator |(BooleanDataFrameColumn left, BooleanDataFrameColumn right) + { + return left.Or(right); + } + } + public partial class BooleanDataFrameColumn + { + public static BooleanDataFrameColumn operator |(BooleanDataFrameColumn left, bool right) + { + return left.Or(right); + } + } + public partial class BooleanDataFrameColumn + { + public static BooleanDataFrameColumn operator ^(BooleanDataFrameColumn left, BooleanDataFrameColumn right) + { + return left.Xor(right); + } + } + public partial class BooleanDataFrameColumn + { + public static BooleanDataFrameColumn operator ^(BooleanDataFrameColumn left, bool right) + { + return left.Xor(right); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator <<(ByteDataFrameColumn left, int value) + { + return left.LeftShift(value); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator <<(Int32DataFrameColumn left, int value) + { + return left.LeftShift(value); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator <<(Int64DataFrameColumn left, int value) + { + return left.LeftShift(value); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator <<(SByteDataFrameColumn left, int value) + { + return left.LeftShift(value); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator <<(Int16DataFrameColumn left, int value) + { + return left.LeftShift(value); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator <<(UInt32DataFrameColumn left, int value) + { + return left.LeftShift(value); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator <<(UInt64DataFrameColumn left, int value) + { + return left.LeftShift(value); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator <<(UInt16DataFrameColumn left, int value) + { + return left.LeftShift(value); + } + } + public partial class ByteDataFrameColumn + { + public static Int32DataFrameColumn operator >>(ByteDataFrameColumn left, int value) + { + return left.RightShift(value); + } + } + public partial class Int32DataFrameColumn + { + public static Int32DataFrameColumn operator >>(Int32DataFrameColumn left, int value) + { + return left.RightShift(value); + } + } + public partial class Int64DataFrameColumn + { + public static Int64DataFrameColumn operator >>(Int64DataFrameColumn left, int value) + { + return left.RightShift(value); + } + } + public partial class SByteDataFrameColumn + { + public static Int32DataFrameColumn operator >>(SByteDataFrameColumn left, int value) + { + return left.RightShift(value); + } + } + public partial class Int16DataFrameColumn + { + public static Int32DataFrameColumn operator >>(Int16DataFrameColumn left, int value) + { + return left.RightShift(value); + } + } + public partial class UInt32DataFrameColumn + { + public static UInt32DataFrameColumn operator >>(UInt32DataFrameColumn left, int value) + { + return left.RightShift(value); + } + } + public partial class UInt64DataFrameColumn + { + public static UInt64DataFrameColumn operator >>(UInt64DataFrameColumn left, int value) + { + return left.RightShift(value); + } + } + public partial class UInt16DataFrameColumn + { + public static Int32DataFrameColumn operator >>(UInt16DataFrameColumn left, int value) + { + return left.RightShift(value); + } + } +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperators.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperators.tt new file mode 100644 index 0000000000..777dc4026d --- /dev/null +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperators.tt @@ -0,0 +1,236 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="ColumnArithmeticTemplate.ttinclude" #> +<#@ include file="PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Data.Analysis +{ +<# +void GenerateAllBinaryCombinationsForOperator(string op, string methodName) +{ + HashSet visited = new HashSet { }; + foreach (TypeCombination outer in BinaryOperationCombinations.binaryOperationCombinations) + { + string outerColumnType = outer.ThisColumnType; + if (visited.Contains(outerColumnType)) + { + continue; + } + visited.Add(outerColumnType); + string fullOuterColumnType = GetCapitalizedPrimitiveTypes(outerColumnType) + "DataFrameColumn"; +#> + public partial class <#=fullOuterColumnType#> + { +<# + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations.Where((ACombination) => ACombination.ThisColumnType == outerColumnType)) + { + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; +#> + public static <#=fullReturnType#> operator <#=op#>(<#=fullColumnType#> left, <#=fullOtherColumnType#> right) + { + return left.<#=methodName#>(right); + } +<# + } +#> + } +<# +} +} +#> +<# +void GenerateAllBinaryScalarCombinationsForOperator(string op, string methodName) +{ + HashSet visited = new HashSet { }; + foreach (TypeCombination outer in BinaryOperationCombinations.binaryOperationCombinations) + { + string outerColumnType = outer.ThisColumnType; + if (visited.Contains(outerColumnType)) + { + continue; + } + visited.Add(outerColumnType); + string fullOuterColumnType = GetCapitalizedPrimitiveTypes(outerColumnType) + "DataFrameColumn"; +#> + public partial class <#=fullOuterColumnType#> + { +<# + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations.Where((ACombination) => ACombination.ThisColumnType == outerColumnType)) + { + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; +#> + public static <#=fullReturnType#> operator <#=op#>(<#=fullColumnType#> left, <#=otherColumnType#> right) + { + return left.<#=methodName#>(right); + } + public static <#=fullReturnType#> operator <#=op#>(<#=otherColumnType#> left, <#=fullColumnType#> right) + { + return right.Reverse<#=methodName#>(left); + } +<# + } +#> + } +<# +} +} +#> +<# +void GenerateAllBinaryBitwiseCombinationsForOperator(string op, string methodName) +{ +#> + public partial class BooleanDataFrameColumn + { + public static BooleanDataFrameColumn operator <#=op#>(BooleanDataFrameColumn left, BooleanDataFrameColumn right) + { + return left.<#=methodName#>(right); + } + } +<# +} +#> +<# +void GenerateAllBinaryScalarBitwiseCombinationsForOperator(string op, string methodName) +{ +#> + public partial class BooleanDataFrameColumn + { + public static BooleanDataFrameColumn operator <#=op#>(BooleanDataFrameColumn left, bool right) + { + return left.<#=methodName#>(right); + } + } +<# +} +#> +<# +void GenerateAllBinaryIntBitwiseCombinationsForOperator(string op, string methodName) +{ + foreach (var type in typeConfiguration) + { + if (!type.SupportsNumeric || !type.SupportsBitwise || type.TypeName == "char") + { + continue; + } + string returnType = GetBinaryShiftOperationReturnType(type); + if (returnType == string.Empty) + { + continue; + } + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullColumnType = GetCapitalizedPrimitiveTypes(type.TypeName) + "DataFrameColumn"; + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); +#> + public partial class <#=fullColumnType#> + { + public static <#=fullReturnType#> operator <#=op#>(<#=fullColumnType#> left, int value) + { + return left.<#=methodName#>(value); + } + } +<# + } +} +#> +<# +void GenerateAllComparisonCombinationsForOperator(string op, string methodName) +{ + foreach (TypeCombination types in ComparisonOperationCombinations.comparisonOperationCombinations) + { + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + +#> + public partial class <#=fullColumnType#> + { + public static <#=fullReturnType#> operator <#=op#>(<#=fullColumnType#> left, <#=fullOtherColumnType#> right) + { + return left.<#=methodName#>(right); + } + } +<# + } + } +#> +<# +void GenerateAllComparisonScalarCombinationsForOperator(string op, string methodName) +{ + foreach (TypeCombination types in ComparisonOperationCombinations.comparisonOperationCombinations) + { + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + +#> + public partial class <#=fullColumnType#> + { + public static <#=fullReturnType#> operator <#=op#>(<#=fullColumnType#> left, <#=otherColumnType#> right) + { + return left.<#=methodName#>(right); + } + } +<# + } + } +#> +<# +foreach (MethodConfiguration method in methodConfiguration) +{ + // Don't generate method for Comparison and ComparisonScalar methods here + if (method.MethodType == MethodType.Binary && method.IsNumeric) + { + GenerateAllBinaryCombinationsForOperator(method.Operator, method.MethodName); + } + else if (method.MethodType == MethodType.BinaryScalar && method.IsNumeric) + { + GenerateAllBinaryScalarCombinationsForOperator(method.Operator, method.MethodName); + } + else if (method.MethodType == MethodType.Binary && method.IsBitwise) + { + GenerateAllBinaryBitwiseCombinationsForOperator(method.Operator, method.MethodName); + } + else if (method.MethodType == MethodType.BinaryScalar && method.IsBitwise) + { + GenerateAllBinaryScalarBitwiseCombinationsForOperator(method.Operator, method.MethodName); + } + else if (method.MethodType == MethodType.BinaryInt) + { + GenerateAllBinaryIntBitwiseCombinationsForOperator(method.Operator, method.MethodName); + } +} +#> +} diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs index a7bc108681..166d160063 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs @@ -22,6 +22,8 @@ public partial class PrimitiveDataFrameColumn : DataFrameColumn, IEnumerable< { private PrimitiveColumnContainer _columnContainer; + internal PrimitiveColumnContainer ColumnContainer => _columnContainer; + internal PrimitiveDataFrameColumn(string name, PrimitiveColumnContainer column) : base(name, column.Length, typeof(T)) { _columnContainer = column; @@ -429,7 +431,7 @@ public PrimitiveDataFrameColumn Clone(IEnumerable mapIndices) return ret; } - internal BooleanDataFrameColumn CloneAsBoolColumn() + internal BooleanDataFrameColumn CloneAsBooleanColumn() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsBoolContainer(); return new BooleanDataFrameColumn(Name, newColumnContainer); @@ -459,44 +461,44 @@ internal DecimalDataFrameColumn CloneAsDecimalColumn() return new DecimalDataFrameColumn(Name, newColumnContainer); } - internal Int16DataFrameColumn CloneAsShortColumn() + internal Int16DataFrameColumn CloneAsInt16Column() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsShortContainer(); return new Int16DataFrameColumn(Name, newColumnContainer); } - internal UInt16DataFrameColumn CloneAsUShortColumn() + internal UInt16DataFrameColumn CloneAsUInt16Column() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsUShortContainer(); return new UInt16DataFrameColumn(Name, newColumnContainer); } - internal Int32DataFrameColumn CloneAsIntColumn() + internal Int32DataFrameColumn CloneAsInt32Column() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsIntContainer(); return new Int32DataFrameColumn(Name, newColumnContainer); } - internal UInt32DataFrameColumn CloneAsUIntColumn() + internal UInt32DataFrameColumn CloneAsUInt32Column() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsUIntContainer(); return new UInt32DataFrameColumn(Name, newColumnContainer); } - internal Int64DataFrameColumn CloneAsLongColumn() + internal Int64DataFrameColumn CloneAsInt64Column() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsLongContainer(); return new Int64DataFrameColumn(Name, newColumnContainer); } - internal UInt64DataFrameColumn CloneAsULongColumn() + internal UInt64DataFrameColumn CloneAsUInt64Column() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsULongContainer(); return new UInt64DataFrameColumn(Name, newColumnContainer); } - internal SingleDataFrameColumn CloneAsFloatColumn() + internal SingleDataFrameColumn CloneAsSingleColumn() { PrimitiveColumnContainer newColumnContainer = _columnContainer.CloneAsFloatContainer(); return new SingleDataFrameColumn(Name, newColumnContainer); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs new file mode 100644 index 0000000000..03854c7c5e --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs @@ -0,0 +1,2648 @@ + + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperationTests.tt. Do not modify directly + +using System; +using System.Collections.Generic; +using System.Linq; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public partial class DataFrameColumnTests + { + [Fact] + public void AddByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn otherColumn = new ByteDataFrameColumn("Byte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(2 * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddDecimalDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (decimal)x); + DecimalDataFrameColumn otherColumn = new DecimalDataFrameColumn("Decimal", otherColumnEnumerable); + DecimalDataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)(2 * x)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddDoubleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (double)x); + DoubleDataFrameColumn otherColumn = new DoubleDataFrameColumn("Double", otherColumnEnumerable); + DoubleDataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (double)(2 * x)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddSingleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (float)x); + SingleDataFrameColumn otherColumn = new SingleDataFrameColumn("Single", otherColumnEnumerable); + SingleDataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (float)(2 * x)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (int)x); + Int32DataFrameColumn otherColumn = new Int32DataFrameColumn("Int32", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(2 * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (long)x); + Int64DataFrameColumn otherColumn = new Int64DataFrameColumn("Int64", otherColumnEnumerable); + Int64DataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (long)(2 * x)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddSByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (sbyte)x); + SByteDataFrameColumn otherColumn = new SByteDataFrameColumn("SByte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(2 * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (short)x); + Int16DataFrameColumn otherColumn = new Int16DataFrameColumn("Int16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(2 * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddUInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (uint)x); + UInt32DataFrameColumn otherColumn = new UInt32DataFrameColumn("UInt32", otherColumnEnumerable); + UInt32DataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (uint)(2 * x)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddUInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ulong)x); + UInt64DataFrameColumn otherColumn = new UInt64DataFrameColumn("UInt64", otherColumnEnumerable); + UInt64DataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)(2 * x)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddUInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ushort)x); + UInt16DataFrameColumn otherColumn = new UInt16DataFrameColumn("UInt16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column + otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(2 * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)x + (decimal)value)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)x + (double)value)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddSingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)x + (float)value)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)x + (long)value)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddSByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)x + (uint)value)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)x + (ulong)value)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void AddUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = column + value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)x + (decimal)value)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)x + (double)value)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddSingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)x + (float)value)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)x + (long)value)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddSByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)x + (uint)value)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)x + (ulong)value)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseAddUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = value + column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x + (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn otherColumn = new ByteDataFrameColumn("Byte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)0); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractDecimalDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (decimal)x); + DecimalDataFrameColumn otherColumn = new DecimalDataFrameColumn("Decimal", otherColumnEnumerable); + DecimalDataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)0); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractDoubleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (double)x); + DoubleDataFrameColumn otherColumn = new DoubleDataFrameColumn("Double", otherColumnEnumerable); + DoubleDataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (double)0); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractSingleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (float)x); + SingleDataFrameColumn otherColumn = new SingleDataFrameColumn("Single", otherColumnEnumerable); + SingleDataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (float)0); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (int)x); + Int32DataFrameColumn otherColumn = new Int32DataFrameColumn("Int32", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)0); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (long)x); + Int64DataFrameColumn otherColumn = new Int64DataFrameColumn("Int64", otherColumnEnumerable); + Int64DataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (long)0); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractSByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (sbyte)x); + SByteDataFrameColumn otherColumn = new SByteDataFrameColumn("SByte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)0); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (short)x); + Int16DataFrameColumn otherColumn = new Int16DataFrameColumn("Int16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)0); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractUInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (uint)x); + UInt32DataFrameColumn otherColumn = new UInt32DataFrameColumn("UInt32", otherColumnEnumerable); + UInt32DataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (uint)0); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractUInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ulong)x); + UInt64DataFrameColumn otherColumn = new UInt64DataFrameColumn("UInt64", otherColumnEnumerable); + UInt64DataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)0); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractUInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ushort)x); + UInt16DataFrameColumn otherColumn = new UInt16DataFrameColumn("UInt16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column - otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)0); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x - (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)x - (decimal)value)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)x - (double)value)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractSingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)x - (float)value)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x - (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)x - (long)value)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractSByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x - (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x - (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)x - (uint)value)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)x - (ulong)value)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void SubtractUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = column - value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x - (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value - (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)value - (decimal)x)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)value - (double)x)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractSingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)value - (float)x)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value - (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)value - (long)x)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractSByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value - (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value - (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)value - (uint)x)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)value - (ulong)x)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseSubtractUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = value - column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value - (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn otherColumn = new ByteDataFrameColumn("Byte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(x * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyDecimalDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (decimal)x); + DecimalDataFrameColumn otherColumn = new DecimalDataFrameColumn("Decimal", otherColumnEnumerable); + DecimalDataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)(x * x)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyDoubleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (double)x); + DoubleDataFrameColumn otherColumn = new DoubleDataFrameColumn("Double", otherColumnEnumerable); + DoubleDataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (double)(x * x)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplySingleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (float)x); + SingleDataFrameColumn otherColumn = new SingleDataFrameColumn("Single", otherColumnEnumerable); + SingleDataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (float)(x * x)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (int)x); + Int32DataFrameColumn otherColumn = new Int32DataFrameColumn("Int32", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(x * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (long)x); + Int64DataFrameColumn otherColumn = new Int64DataFrameColumn("Int64", otherColumnEnumerable); + Int64DataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (long)(x * x)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplySByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (sbyte)x); + SByteDataFrameColumn otherColumn = new SByteDataFrameColumn("SByte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(x * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (short)x); + Int16DataFrameColumn otherColumn = new Int16DataFrameColumn("Int16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(x * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyUInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (uint)x); + UInt32DataFrameColumn otherColumn = new UInt32DataFrameColumn("UInt32", otherColumnEnumerable); + UInt32DataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (uint)(x * x)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyUInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ulong)x); + UInt64DataFrameColumn otherColumn = new UInt64DataFrameColumn("UInt64", otherColumnEnumerable); + UInt64DataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)(x * x)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyUInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ushort)x); + UInt16DataFrameColumn otherColumn = new UInt16DataFrameColumn("UInt16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column * otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(x * x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)x * (decimal)value)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)x * (double)value)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplySingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)x * (float)value)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)x * (long)value)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplySByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)x * (uint)value)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)x * (ulong)value)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void MultiplyUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = column * value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)x * (decimal)value)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)x * (double)value)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplySingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)x * (float)value)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)x * (long)value)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplySByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)x * (uint)value)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)x * (ulong)value)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseMultiplyUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = value * column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x * (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn otherColumn = new ByteDataFrameColumn("Byte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(1)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideDecimalDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (decimal)x); + DecimalDataFrameColumn otherColumn = new DecimalDataFrameColumn("Decimal", otherColumnEnumerable); + DecimalDataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)(1)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideDoubleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (double)x); + DoubleDataFrameColumn otherColumn = new DoubleDataFrameColumn("Double", otherColumnEnumerable); + DoubleDataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (double)(1)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideSingleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (float)x); + SingleDataFrameColumn otherColumn = new SingleDataFrameColumn("Single", otherColumnEnumerable); + SingleDataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (float)(1)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (int)x); + Int32DataFrameColumn otherColumn = new Int32DataFrameColumn("Int32", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(1)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (long)x); + Int64DataFrameColumn otherColumn = new Int64DataFrameColumn("Int64", otherColumnEnumerable); + Int64DataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (long)(1)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideSByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (sbyte)x); + SByteDataFrameColumn otherColumn = new SByteDataFrameColumn("SByte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(1)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (short)x); + Int16DataFrameColumn otherColumn = new Int16DataFrameColumn("Int16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(1)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideUInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (uint)x); + UInt32DataFrameColumn otherColumn = new UInt32DataFrameColumn("UInt32", otherColumnEnumerable); + UInt32DataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (uint)(1)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideUInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ulong)x); + UInt64DataFrameColumn otherColumn = new UInt64DataFrameColumn("UInt64", otherColumnEnumerable); + UInt64DataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)(1)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideUInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ushort)x); + UInt16DataFrameColumn otherColumn = new UInt16DataFrameColumn("UInt16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column / otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(1)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x / (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)x / (decimal)value)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)x / (double)value)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideSingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)x / (float)value)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x / (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)x / (long)value)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideSByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x / (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x / (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)x / (uint)value)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)x / (ulong)value)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void DivideUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = column / value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x / (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value / (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)value / (decimal)x)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)value / (double)x)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideSingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)value / (float)x)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value / (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)value / (long)x)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideSByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value / (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value / (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)value / (uint)x)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)value / (ulong)x)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseDivideUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = value / column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value / (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn otherColumn = new ByteDataFrameColumn("Byte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(0)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloDecimalDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (decimal)x); + DecimalDataFrameColumn otherColumn = new DecimalDataFrameColumn("Decimal", otherColumnEnumerable); + DecimalDataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)(0)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloDoubleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (double)x); + DoubleDataFrameColumn otherColumn = new DoubleDataFrameColumn("Double", otherColumnEnumerable); + DoubleDataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (double)(0)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloSingleDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (float)x); + SingleDataFrameColumn otherColumn = new SingleDataFrameColumn("Single", otherColumnEnumerable); + SingleDataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (float)(0)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (int)x); + Int32DataFrameColumn otherColumn = new Int32DataFrameColumn("Int32", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(0)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (long)x); + Int64DataFrameColumn otherColumn = new Int64DataFrameColumn("Int64", otherColumnEnumerable); + Int64DataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (long)(0)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloSByteDataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (sbyte)x); + SByteDataFrameColumn otherColumn = new SByteDataFrameColumn("SByte", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(0)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (short)x); + Int16DataFrameColumn otherColumn = new Int16DataFrameColumn("Int16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(0)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloUInt32DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (uint)x); + UInt32DataFrameColumn otherColumn = new UInt32DataFrameColumn("UInt32", otherColumnEnumerable); + UInt32DataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (uint)(0)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloUInt64DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ulong)x); + UInt64DataFrameColumn otherColumn = new UInt64DataFrameColumn("UInt64", otherColumnEnumerable); + UInt64DataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)(0)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloUInt16DataFrameColumnToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ushort)x); + UInt16DataFrameColumn otherColumn = new UInt16DataFrameColumn("UInt16", otherColumnEnumerable); + Int32DataFrameColumn columnResult = column % otherColumn; + var verify = Enumerable.Range(1, 10).Select(x => (int)(0)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x % (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)x % (decimal)value)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)x % (double)value)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloSingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)x % (float)value)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x % (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)x % (long)value)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloSByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x % (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x % (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)x % (uint)value)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)x % (ulong)value)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ModuloUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = column % value; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)x % (int)value)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 5; + Int32DataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value % (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloDecimalToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 5; + DecimalDataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (decimal)((decimal)value % (decimal)x)); + var verifyColumn = new DecimalDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloDoubleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 5; + DoubleDataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (double)((double)value % (double)x)); + var verifyColumn = new DoubleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloSingleToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 5; + SingleDataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (float)((float)value % (float)x)); + var verifyColumn = new SingleDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 5; + Int32DataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value % (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 5; + Int64DataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (long)((long)value % (long)x)); + var verifyColumn = new Int64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloSByteToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 5; + Int32DataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value % (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 5; + Int32DataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value % (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloUInt32ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 5; + UInt32DataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (uint)((uint)value % (uint)x)); + var verifyColumn = new UInt32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloUInt64ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 5; + UInt64DataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (ulong)((ulong)value % (ulong)x)); + var verifyColumn = new UInt64DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ReverseModuloUInt16ToByteDataFrameColumn() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 5; + Int32DataFrameColumn columnResult = value % column; + var verify = Enumerable.Range(1, 10).Select(x => (int)((int)value % (int)x)); + var verifyColumn = new Int32DataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToByte() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn otherColumn = new ByteDataFrameColumn("Byte", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToDecimal() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (decimal)x); + DecimalDataFrameColumn otherColumn = new DecimalDataFrameColumn("Decimal", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToDouble() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (double)x); + DoubleDataFrameColumn otherColumn = new DoubleDataFrameColumn("Double", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToSingle() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (float)x); + SingleDataFrameColumn otherColumn = new SingleDataFrameColumn("Single", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToInt32() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (int)x); + Int32DataFrameColumn otherColumn = new Int32DataFrameColumn("Int32", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToInt64() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (long)x); + Int64DataFrameColumn otherColumn = new Int64DataFrameColumn("Int64", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToSByte() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (sbyte)x); + SByteDataFrameColumn otherColumn = new SByteDataFrameColumn("SByte", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToInt16() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (short)x); + Int16DataFrameColumn otherColumn = new Int16DataFrameColumn("Int16", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToUInt32() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (uint)x); + UInt32DataFrameColumn otherColumn = new UInt32DataFrameColumn("UInt32", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToUInt64() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ulong)x); + UInt64DataFrameColumn otherColumn = new UInt64DataFrameColumn("UInt64", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToUInt16() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ushort)x); + UInt16DataFrameColumn otherColumn = new UInt16DataFrameColumn("UInt16", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarByte() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarDecimal() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarDouble() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarSingle() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarInt32() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarInt64() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarSByte() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarInt16() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarUInt32() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarUInt64() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseEqualsBooleanToScalarUInt16() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToByte() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn otherColumn = new ByteDataFrameColumn("Byte", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToDecimal() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (decimal)x); + DecimalDataFrameColumn otherColumn = new DecimalDataFrameColumn("Decimal", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToDouble() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (double)x); + DoubleDataFrameColumn otherColumn = new DoubleDataFrameColumn("Double", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToSingle() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (float)x); + SingleDataFrameColumn otherColumn = new SingleDataFrameColumn("Single", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToInt32() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (int)x); + Int32DataFrameColumn otherColumn = new Int32DataFrameColumn("Int32", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToInt64() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (long)x); + Int64DataFrameColumn otherColumn = new Int64DataFrameColumn("Int64", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToSByte() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (sbyte)x); + SByteDataFrameColumn otherColumn = new SByteDataFrameColumn("SByte", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToInt16() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (short)x); + Int16DataFrameColumn otherColumn = new Int16DataFrameColumn("Int16", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToUInt32() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (uint)x); + UInt32DataFrameColumn otherColumn = new UInt32DataFrameColumn("UInt32", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToUInt64() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ulong)x); + UInt64DataFrameColumn otherColumn = new UInt64DataFrameColumn("UInt64", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToUInt16() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (ushort)x); + UInt16DataFrameColumn otherColumn = new UInt16DataFrameColumn("UInt16", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(otherColumn); + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarByte() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + byte value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarDecimal() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + decimal value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarDouble() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + double value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarSingle() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + float value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarInt32() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + int value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarInt64() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + long value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarSByte() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + sbyte value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarInt16() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + short value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarUInt32() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + uint value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarUInt64() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ulong value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + [Fact] + public void ElementwiseNotEqualsBooleanToScalarUInt16() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (byte)x); + ByteDataFrameColumn column = new ByteDataFrameColumn("Byte", columnEnumerable); + ushort value = 100; + BooleanDataFrameColumn columnResult = column.ElementwiseNotEquals(value); + var verify = Enumerable.Range(1, 10).Select(x => (bool)(false)); + var verifyColumn = new BooleanDataFrameColumn("Verify", verify); + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); + } + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt b/tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt new file mode 100644 index 0000000000..08597cc83b --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt @@ -0,0 +1,626 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ output extension=".cs" #> +<#@ include file="..\..\src\Microsoft.Data.Analysis\ColumnArithmeticTemplate.ttinclude"#> +<#@ include file="..\..\src\Microsoft.Data.Analysis\PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude" #> +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Generated from DataFrameColumn.BinaryOperationTests.tt. Do not modify directly + +using System; +using System.Collections.Generic; +using System.Linq; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public partial class DataFrameColumnTests + { +<# +bool supportedInPlace(string type1, string type2) +{ + primitiveTypeToPrimitivityLevelMap.TryGetValue(type1, out int columnTypeLevel); + primitiveTypeToPrimitivityLevelMap.TryGetValue(type2, out int otherColumnTypeLevel); + if (columnTypeLevel < otherColumnTypeLevel) + { + return false; + } + return true; +} +#> +<# +void GenerateBinaryVerify(string methodName, string fullReturnType, string returnType) +{ +#> +<# + if (methodName == "Add") + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)(2 * x)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName == "Subtract") + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)0); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName == "Multiply") + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)(x * x)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName == "Divide") + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)(1)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName == "Modulo") + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)(0)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } +#> +<# +} +#> +<# +// Only generate the tests for ByteDataFrameColumn. It exercises all the possible paths since it includes cloning the non byte columns and keeps the number of tests low enough. +void GenerateAllBinaryTestsForMethod(string methodName, string methodOperator) +{ + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations) +{ + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + if (columnType != "byte") + { + continue; + } + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string capitalizedColumnType = GetCapitalizedPrimitiveTypes(columnType); + string capitalizedOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType); +#> + [Fact] + public void <#=methodName#><#=fullOtherColumnType#>To<#=fullColumnType#>() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (<#=columnType#>)x); + <#=fullColumnType#> column = new <#=fullColumnType#>("<#=capitalizedColumnType#>", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (<#=otherColumnType#>)x); + <#=fullOtherColumnType#> otherColumn = new <#=fullOtherColumnType#>("<#=capitalizedOtherColumnType#>", otherColumnEnumerable); + <#=fullReturnType#> columnResult = column <#=methodOperator#> otherColumn; +<#GenerateBinaryVerify(methodName, fullReturnType, returnType); #> + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } +<# +} +} +#> +<# +void GenerateBinaryScalarVerify(string methodName, string fullReturnType, string returnType, int value, bool isReverse) +{ + if (methodName.Contains("Add")) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x + (<#=returnType#>)value)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Subtract")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x - (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value - (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Multiply")) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x * (<#=returnType#>)value)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Divide")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x / (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value / (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Modulo")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x % (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value % (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } +#> +<# +} +#> +<# +void GenerateBinaryComparisonScalarVerify(string methodName, string fullReturnType, string returnType, int value, bool isReverse) +{ + if (methodName.Contains("ElementwiseEquals")) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)(false)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("ElementwiseNotEquals")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)(false)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)(false)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Multiply")) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x * (<#=returnType#>)value)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Divide")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x / (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value / (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Modulo")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x % (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value % (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } +#> +<# +} +#> +<# +void GenerateBinaryComparisonVerify(string methodName, string fullReturnType, string returnType, int value, bool isReverse) +{ + if (methodName.Contains("ElementwiseEquals")) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => true); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("ElementwiseNotEquals")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => true); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => true); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Multiply")) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x * (<#=returnType#>)value)); + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Divide")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x / (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value / (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Modulo")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x % (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value % (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } +#> +<# +} +#> +<# +void GenerateBinaryBitwiseScalarVerify(string methodName, string fullReturnType, string returnType, bool value, bool isReverse) +{ + if (methodName.Contains("And")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x & (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value & (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Or")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x | (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value | (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } + else if (methodName.Contains("Xor")) + { + if (!isReverse) + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)x ^ (<#=returnType#>)value)); +<# + } + else + { +#> + var verify = Enumerable.Range(1, 10).Select(x => (<#=returnType#>)((<#=returnType#>)value ^ (<#=returnType#>)x)); +<# + } +#> + var verifyColumn = new <#=fullReturnType#>("Verify", verify); +<# + } +#> +<# +} +#> +<# +// Only generate the tests for ByteDataFrameColumn. It exercises all the possible paths since it includes cloning the non byte columns and keeps the number of tests low enough. +void GenerateAllBinaryScalarTestsForMethod(string methodName, string methodOperator) +{ + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations) +{ + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + if (columnType != "byte") + { + continue; + } + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string capitalizedColumnType = GetCapitalizedPrimitiveTypes(columnType); + string capitalizedOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType); +#> + [Fact] + public void <#=methodName#><#=capitalizedOtherColumnType#>To<#=fullColumnType#>() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (<#=columnType#>)x); + <#=fullColumnType#> column = new <#=fullColumnType#>("<#=capitalizedColumnType#>", columnEnumerable); + <#=otherColumnType#> value = 5; +<# + if (methodName.Contains("Reverse")) + { +#> + <#=fullReturnType#> columnResult = value <#=methodOperator#> column; +<# + } + else + { +#> + <#=fullReturnType#> columnResult = column <#=methodOperator#> value; +<# + } +#> +<#GenerateBinaryScalarVerify(methodName, fullReturnType, returnType, (byte)5, methodName.Contains("Reverse") ? true : false); #> + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } +<# +} +} +#> +<# +// Only generate the tests for BooleanDataFrameColumn. +void GenerateAllBinaryScalarBitwiseTestsForMethod(string methodName, string methodOperator) +{ + foreach (TypeCombination types in BinaryOperationCombinations.binaryOperationCombinations) +{ + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + if (columnType != "byte") + { + continue; + } + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string capitalizedColumnType = GetCapitalizedPrimitiveTypes(columnType); + string capitalizedOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType); +#> + [Fact] + public void TestScalar<#=methodName#>On<#=fullColumnType#>() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (<#=columnType#>)false); + <#=fullColumnType#> column = new <#=fullColumnType#>("<#=capitalizedColumnType#>", columnEnumerable); + <#=otherColumnType#> value = true; +<# + if (methodName.Contains("Reverse")) + { +#> + <#=fullReturnType#> columnResult = value <#=methodOperator#> column; +<# + } + else + { +#> + <#=fullReturnType#> columnResult = column <#=methodOperator#> value; +<# + } +#> +<#GenerateBinaryBitwiseScalarVerify(methodName, fullReturnType, returnType, true, methodName.Contains("Reverse") ? true : false); #> + Assert.Equal(columnResult.Length, verify.Count()); + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); + } +<# +} +} +#> +<# +// Only generate the tests for ByteDataFrameColumn. It exercises all the possible paths since it includes cloning the non byte columns and keeps the number of tests low enough. +void GenerateAllBinaryScalarComparisonTestsForMethod(string methodName, string methodOperator) +{ + foreach (TypeCombination types in ComparisonOperationCombinations.comparisonOperationCombinations) +{ + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + if (columnType != "byte") + { + continue; + } + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string capitalizedColumnType = GetCapitalizedPrimitiveTypes(columnType); + string capitalizedOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType); +#> + [Fact] + public void <#=methodName#><#=capitalizedReturnType#>ToScalar<#=capitalizedOtherColumnType#>() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (<#=columnType#>)x); + <#=fullColumnType#> column = new <#=fullColumnType#>("<#=capitalizedColumnType#>", columnEnumerable); + <#=otherColumnType#> value = 100; + BooleanDataFrameColumn columnResult = column.<#=methodName#>(value); +<#GenerateBinaryComparisonScalarVerify(methodName, fullReturnType, returnType, (byte)5, methodName.Contains("Reverse") ? true : false); #> + Assert.Equal(columnResult.Length, verify.Count()); +<# if (!methodName.Contains("Not")) { #> + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); +<# } else { #> + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); +<# } #> + } +<# +} +} +#> +<# +// Only generate the tests for ByteDataFrameColumn. It exercises all the possible paths since it includes cloning the non byte columns and keeps the number of tests low enough. +void GenerateAllBinaryComparisonTestsForMethod(string methodName, string methodOperator) +{ + foreach (TypeCombination types in ComparisonOperationCombinations.comparisonOperationCombinations) +{ + string returnType = types.ReturnColumnType; + string columnType = types.ThisColumnType; + if (columnType != "byte") + { + continue; + } + string otherColumnType = types.OtherColumnType; + + string fullColumnType = GetCapitalizedPrimitiveTypes(columnType) + "DataFrameColumn"; + string fullReturnType = GetCapitalizedPrimitiveTypes(returnType) + "DataFrameColumn"; + string fullOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType) + "DataFrameColumn"; + + string capitalizedReturnType = GetCapitalizedPrimitiveTypes(returnType); + string capitalizedColumnType = GetCapitalizedPrimitiveTypes(columnType); + string capitalizedOtherColumnType = GetCapitalizedPrimitiveTypes(otherColumnType); +#> + [Fact] + public void <#=methodName#><#=capitalizedReturnType#>To<#=capitalizedOtherColumnType#>() + { + var columnEnumerable = Enumerable.Range(1, 10).Select(x => (<#=columnType#>)x); + <#=fullColumnType#> column = new <#=fullColumnType#>("<#=capitalizedColumnType#>", columnEnumerable); + var otherColumnEnumerable = Enumerable.Range(1, 10).Select(x => (<#=otherColumnType#>)x); + <#=fullOtherColumnType#> otherColumn = new <#=fullOtherColumnType#>("<#=capitalizedOtherColumnType#>", otherColumnEnumerable); + BooleanDataFrameColumn columnResult = column.<#=methodName#>(otherColumn); +<#GenerateBinaryComparisonVerify(methodName, fullReturnType, returnType, (byte)5, methodName.Contains("Reverse") ? true : false); #> + Assert.Equal(columnResult.Length, verify.Count()); + + // If this is equals, change thisx to false +<# if (!methodName.Contains("Not")) { #> + Assert.True(columnResult.ElementwiseEquals(verifyColumn).All()); +<# } else { #> + Assert.True(columnResult.ElementwiseNotEquals(verifyColumn).All()); +<# } #> + } +<# +} +} +#> +<# + foreach (MethodConfiguration method in methodConfiguration) + { + if (method.MethodType == MethodType.Binary && method.IsNumeric) + { + GenerateAllBinaryTestsForMethod(method.MethodName, method.Operator); + } + else if (method.MethodType == MethodType.BinaryScalar && method.IsNumeric) + { + GenerateAllBinaryScalarTestsForMethod(method.MethodName, method.Operator); + GenerateAllBinaryScalarTestsForMethod("Reverse" + method.MethodName, method.Operator); + } + else if (method.MethodType == MethodType.ComparisonScalar) + { + // Test only the ElementwiseEquals and ElementwiseNotEquals methods to reduce the number of unit tests + if ((method.MethodName == "ElementwiseEquals") || (method.MethodName == "ElementwiseNotEquals")) + { + GenerateAllBinaryScalarComparisonTestsForMethod(method.MethodName, method.Operator); + } + } + else if (method.MethodType == MethodType.Comparison) + { + // Test only the ElementwiseEquals and ElementwiseNotEquals methods to reduce the number of unit tests + if ((method.MethodName == "ElementwiseEquals") || (method.MethodName == "ElementwiseNotEquals")) + { + GenerateAllBinaryComparisonTestsForMethod(method.MethodName, method.Operator); + } + } + /* + else if (method.MethodType == MethodType.BinaryScalar && method.IsBitwise) + { + GenerateAllBinaryScalarBitwiseTestsForMethod(method.MethodName, method.Operator); + } + */ + } +#> + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 29caa69b5c..0df08fb746 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -92,12 +92,15 @@ public static DataFrame MakeDataFrameWithAllMutableColumnTypes(int length, bool return df; } - public static DataFrame MakeDataFrameWithNumericAndBoolColumns(int length) + public static DataFrame MakeDataFrameWithNumericAndBoolColumns(int length, bool withNulls = true) { - DataFrame df = MakeDataFrameWithNumericColumns(length); + DataFrame df = MakeDataFrameWithNumericColumns(length, withNulls); DataFrameColumn boolColumn = new BooleanDataFrameColumn("Bool", Enumerable.Range(0, length).Select(x => x % 2 == 0)); df.Columns.Insert(df.Columns.Count, boolColumn); - boolColumn[length / 2] = null; + if (withNulls) + { + boolColumn[length / 2] = null; + } return df; } @@ -2128,5 +2131,53 @@ void AssertLengthTypeAndValues(DataFrameColumn column, Type type) DataFrameColumn ushortColumn = DataFrameColumn.Create("Ushort", Enumerable.Range(0, length).Select(x => (ushort)x)); AssertLengthTypeAndValues(ushortColumn, typeof(ushort)); } + + [Fact] + public void TestBinaryOperationsOnExplodedNumericColumns() + { + DataFrame df = MakeDataFrameWithNumericAndBoolColumns(10, withNulls: false); + Int32DataFrameColumn ints = df.Columns["Int"] as Int32DataFrameColumn; + Int32DataFrameColumn res = ints.Add(1).Subtract(1).Multiply(10).Divide(10).LeftShift(2).RightShift(2); + Assert.True(res.ElementwiseEquals(ints).All()); + Assert.True(res.ElementwiseGreaterThanOrEqual(ints).All()); + Assert.True(res.ElementwiseLessThanOrEqual(ints).All()); + Assert.False(res.ElementwiseNotEquals(ints).All()); + Assert.False(res.ElementwiseGreaterThan(ints).All()); + Assert.False(res.ElementwiseLessThan(ints).All()); + + // Test inPlace + Int32DataFrameColumn inPlace = ints.Add(1, inPlace: true).Subtract(1, inPlace: true).Multiply(10, inPlace: true).Divide(10, inPlace: true).LeftShift(2, inPlace: true).RightShift(2, inPlace: true).Add(100, inPlace: true); + Assert.True(inPlace.ElementwiseEquals(ints).All()); + Assert.True(inPlace.ElementwiseGreaterThanOrEqual(ints).All()); + Assert.True(inPlace.ElementwiseLessThanOrEqual(ints).All()); + Assert.False(inPlace.ElementwiseNotEquals(ints).All()); + Assert.False(inPlace.ElementwiseGreaterThan(ints).All()); + Assert.False(inPlace.ElementwiseLessThan(ints).All()); + + Assert.False(inPlace.ElementwiseEquals(res).All()); + Assert.True(inPlace.ElementwiseGreaterThanOrEqual(res).All()); + Assert.False(inPlace.ElementwiseLessThanOrEqual(res).All()); + Assert.True(inPlace.ElementwiseNotEquals(res).All()); + Assert.True(inPlace.ElementwiseGreaterThan(res).All()); + Assert.False(inPlace.ElementwiseLessThan(res).All()); + + // Test Bool column + BooleanDataFrameColumn bools = df.Columns["Bool"] as BooleanDataFrameColumn; + BooleanDataFrameColumn allFalse = bools.Or(true).And(true).Xor(true); + Assert.True(allFalse.ElementwiseEquals(false).All()); + + // Test inPlace + BooleanDataFrameColumn inPlaceAllFalse = bools.Or(true, inPlace: true).And(true, inPlace: true).Xor(true, inPlace: true); + Assert.True(inPlaceAllFalse.ElementwiseEquals(bools).All()); + + // Test Reverse Operations + Int32DataFrameColumn reverse = ints.ReverseAdd(1).ReverseSubtract(1).ReverseMultiply(-1); + Assert.True(reverse.ElementwiseEquals(ints).All()); + + // Test inPlace + Int32DataFrameColumn reverseInPlace = ints.ReverseAdd(1, inPlace: true).ReverseSubtract(1, inPlace: true).ReverseMultiply(-1, inPlace: true).ReverseDivide(100, inPlace: true); + Assert.True(reverseInPlace.ElementwiseEquals(ints).All()); + Assert.False(reverseInPlace.ElementwiseEquals(reverse).All()); + } } } diff --git a/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj index af02a02c85..fcfbedb82a 100644 --- a/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj +++ b/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj @@ -13,4 +13,23 @@ + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperationTests.cs + + + + + + + + + + True + True + DataFrameColumn.BinaryOperationTests.tt + + + From 7ef10ba207cef3112d9eb95416df7362eed27829 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 20 Mar 2020 13:56:48 -0700 Subject: [PATCH 22/53] Add APIs to get the strongly typed columns from a DataFrame (#2878) * CP * sq * sq * Improve docs --- .../DataFrameColumnCollection.cs | 273 ++++++++++++++++++ .../strings.Designer.cs | 9 + src/Microsoft.Data.Analysis/strings.resx | 3 + .../DataFrameTests.cs | 70 +++++ 4 files changed, 355 insertions(+) diff --git a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs index 5488d8ca93..2f73c4d547 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs @@ -175,5 +175,278 @@ public DataFrameColumn this[string columnName] } } + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public PrimitiveDataFrameColumn GetPrimitiveColumn(string name) + where T : unmanaged + { + DataFrameColumn column = this[name]; + if (column is PrimitiveDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(T)), nameof(T)); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public ArrowStringDataFrameColumn GetArrowStringColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is ArrowStringDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(string))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public StringDataFrameColumn GetStringColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is StringDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(string))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public BooleanDataFrameColumn GetBooleanColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is BooleanDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Boolean))); + } + + /// + /// Gets the with the specified and attempts to return it as an . If is not of type , an exception is thrown. + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public ByteDataFrameColumn GetByteColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is ByteDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Byte))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public CharDataFrameColumn GetCharColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is CharDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Char))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public DoubleDataFrameColumn GetDoubleColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is DoubleDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Double))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public DecimalDataFrameColumn GetDecimalColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is DecimalDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Decimal))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public SingleDataFrameColumn GetSingleColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is SingleDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Single))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public Int32DataFrameColumn GetInt32Column(string name) + { + DataFrameColumn column = this[name]; + if (column is Int32DataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Int32))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public Int64DataFrameColumn GetInt64Column(string name) + { + DataFrameColumn column = this[name]; + if (column is Int64DataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Int64))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public SByteDataFrameColumn GetSByteColumn(string name) + { + DataFrameColumn column = this[name]; + if (column is SByteDataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(SByte))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public Int16DataFrameColumn GetInt16Column(string name) + { + DataFrameColumn column = this[name]; + if (column is Int16DataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Int16))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public UInt32DataFrameColumn GetUInt32Column(string name) + { + DataFrameColumn column = this[name]; + if (column is UInt32DataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(string))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public UInt64DataFrameColumn GetUInt64Column(string name) + { + DataFrameColumn column = this[name]; + if (column is UInt64DataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(UInt64))); + } + + /// + /// Gets the with the specified . + /// + /// The name of the column + /// . + /// A column named cannot be found, or if the column's type doesn't match. + public UInt16DataFrameColumn GetUInt16Column(string name) + { + DataFrameColumn column = this[name]; + if (column is UInt16DataFrameColumn ret) + { + return ret; + } + + throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(UInt16))); + } + } } diff --git a/src/Microsoft.Data.Analysis/strings.Designer.cs b/src/Microsoft.Data.Analysis/strings.Designer.cs index f7bf691b47..6196e234a3 100644 --- a/src/Microsoft.Data.Analysis/strings.Designer.cs +++ b/src/Microsoft.Data.Analysis/strings.Designer.cs @@ -60,6 +60,15 @@ internal Strings() { } } + /// + /// Looks up a localized string similar to Cannot cast column holding {0} values to type {1}. + /// + internal static string BadColumnCast { + get { + return ResourceManager.GetString("BadColumnCast", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cannot resize down. /// diff --git a/src/Microsoft.Data.Analysis/strings.resx b/src/Microsoft.Data.Analysis/strings.resx index 7e9d040bc6..446b3b3f37 100644 --- a/src/Microsoft.Data.Analysis/strings.resx +++ b/src/Microsoft.Data.Analysis/strings.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Cannot cast column holding {0} values to type {1} + Cannot resize down diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 0df08fb746..44636ffd72 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -2179,5 +2179,75 @@ public void TestBinaryOperationsOnExplodedNumericColumns() Assert.True(reverseInPlace.ElementwiseEquals(ints).All()); Assert.False(reverseInPlace.ElementwiseEquals(reverse).All()); } + + [Fact] + public void GetColumnTests() + { + DataFrame dataFrame = MakeDataFrameWithAllColumnTypes(10); + PrimitiveDataFrameColumn primitiveInts = dataFrame.Columns.GetPrimitiveColumn("Int"); + Assert.NotNull(primitiveInts); + Assert.Throws(() => dataFrame.Columns.GetPrimitiveColumn("Int")); + + StringDataFrameColumn strings = dataFrame.Columns.GetStringColumn("String"); + Assert.NotNull(strings); + Assert.Throws(() => dataFrame.Columns.GetStringColumn("ArrowString")); + + ArrowStringDataFrameColumn arrowStrings = dataFrame.Columns.GetArrowStringColumn("ArrowString"); + Assert.NotNull(arrowStrings); + Assert.Throws(() => dataFrame.Columns.GetArrowStringColumn("String")); + + ByteDataFrameColumn bytes = dataFrame.Columns.GetByteColumn("Byte"); + Assert.NotNull(bytes); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Byte")); + + Int32DataFrameColumn ints = dataFrame.Columns.GetInt32Column("Int"); + Assert.NotNull(ints); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Int")); + + BooleanDataFrameColumn bools = dataFrame.Columns.GetBooleanColumn("Bool"); + Assert.NotNull(bools); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Bool")); + + CharDataFrameColumn chars = dataFrame.Columns.GetCharColumn("Char"); + Assert.NotNull(chars); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Char")); + + DecimalDataFrameColumn decimals = dataFrame.Columns.GetDecimalColumn("Decimal"); + Assert.NotNull(decimals); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Decimal")); + + DoubleDataFrameColumn doubles = dataFrame.Columns.GetDoubleColumn("Double"); + Assert.NotNull(doubles); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Double")); + + SingleDataFrameColumn singles = dataFrame.Columns.GetSingleColumn("Float"); + Assert.NotNull(singles); + Assert.Throws(() => dataFrame.Columns.GetDoubleColumn("Float")); + + Int64DataFrameColumn longs = dataFrame.Columns.GetInt64Column("Long"); + Assert.NotNull(longs); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Long")); + + SByteDataFrameColumn sbytes = dataFrame.Columns.GetSByteColumn("Sbyte"); + Assert.NotNull(sbytes); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Sbyte")); + + Int16DataFrameColumn shorts = dataFrame.Columns.GetInt16Column("Short"); + Assert.NotNull(shorts); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Short")); + + UInt32DataFrameColumn uints = dataFrame.Columns.GetUInt32Column("Uint"); + Assert.NotNull(uints); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Uint")); + + UInt64DataFrameColumn ulongs = dataFrame.Columns.GetUInt64Column("Ulong"); + Assert.NotNull(ulongs); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Ulong")); + + UInt16DataFrameColumn ushorts = dataFrame.Columns.GetUInt16Column("Ushort"); + Assert.NotNull(ushorts); + Assert.Throws(() => dataFrame.Columns.GetSingleColumn("Ushort")); + + } } } From 4072f9685bc6e59fc1c7e3b97ff1b73180c3f736 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 20 Mar 2020 18:10:06 -0700 Subject: [PATCH 23/53] Enable xml docs for Data.Analysis (#2882) * Enable xml docs for Data.Analysis * Fix /// summary around inheritdoc * Minor doc changes * sq * sq * Address feedback --- .../ArrowStringDataFrameColumn.cs | 72 +++++++++++++-- .../ColumnArithmeticTemplate.ttinclude | 67 +++++++------- .../DataFrame.BinaryOperations.cs | 48 +++++----- .../DataFrame.BinaryOperators.cs | 1 + .../DataFrame.BinaryOperators.tt | 1 + src/Microsoft.Data.Analysis/DataFrame.Join.cs | 8 ++ src/Microsoft.Data.Analysis/DataFrame.cs | 35 ++++++++ .../DataFrameColumn.BinaryOperations.cs | 90 ++++++++++++++----- .../DataFrameColumn.BinaryOperations.tt | 6 ++ .../DataFrameColumn.BinaryOperators.cs | 1 + .../DataFrameColumn.BinaryOperators.tt | 1 + .../DataFrameColumn.cs | 87 +++++++++++++++++- src/Microsoft.Data.Analysis/GroupBy.cs | 6 +- .../Microsoft.Data.Analysis.csproj | 7 +- ...imitiveDataFrameColumn.BinaryOperations.cs | 30 +++++++ ...imitiveDataFrameColumn.BinaryOperations.tt | 6 ++ .../PrimitiveDataFrameColumn.Computations.cs | 20 +++++ .../PrimitiveDataFrameColumn.Computations.tt | 6 ++ ...ataFrameColumn.ReversedBinaryOperations.cs | 8 ++ ...ataFrameColumn.ReversedBinaryOperations.tt | 2 + .../PrimitiveDataFrameColumn.Sort.cs | 1 - .../PrimitiveDataFrameColumn.cs | 25 ++++-- .../StringDataFrameColumn.BinaryOperations.cs | 6 ++ 23 files changed, 430 insertions(+), 104 deletions(-) diff --git a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs index c5d825e36d..6b98285842 100644 --- a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs @@ -24,6 +24,10 @@ public partial class ArrowStringDataFrameColumn : DataFrameColumn, IEnumerable> _offsetsBuffers; private IList> _nullBitMapBuffers; + /// + /// Constructs an empty with the given . + /// + /// The name of the column. public ArrowStringDataFrameColumn(string name) : base(name, 0, typeof(string)) { _dataBuffers = new List>(); @@ -31,6 +35,15 @@ public ArrowStringDataFrameColumn(string name) : base(name, 0, typeof(string)) _nullBitMapBuffers = new List>(); } + /// + /// Constructs an with the given , and . The , and are the contents of the column in the Arrow format. + /// + /// The name of the column. + /// The Arrow formatted string values in this column. + /// The Arrow formatted offets in this column. + /// The Arrow formatted null bits in this column. + /// The length of the column. + /// The number of values in this column. public ArrowStringDataFrameColumn(string name, ReadOnlyMemory values, ReadOnlyMemory offsets, ReadOnlyMemory nullBits, int length, int nullCount) : base(name, length, typeof(string)) { ReadOnlyDataFrameBuffer dataBuffer = new ReadOnlyDataFrameBuffer(values, values.Length); @@ -53,11 +66,18 @@ public ArrowStringDataFrameColumn(string name, ReadOnlyMemory values, Read } private long _nullCount; + + /// public override long NullCount => _nullCount; + /// + /// Indicates if the value at this is . + /// + /// The index to look up. + /// A boolean value indicating the validity at this . public bool IsValid(long index) => NullCount == 0 || GetValidityBit(index); - public bool GetValidityBit(long index) + private bool GetValidityBit(long index) { if ((ulong)index > (ulong)Length) { @@ -118,11 +138,11 @@ private void SetValidityBit(long index, bool value) } /// - /// Returns an enumerable of immutable buffers representing the underlying values in the Apache Arrow format + /// Returns an enumeration of immutable buffers representing the underlying values in the Apache Arrow format /// - /// Null values are encoded in the buffers returned by GetReadOnlyNullBitmapBuffers in the Apache Arrow format + /// values are encoded in the buffers returned by GetReadOnlyNullBitmapBuffers in the Apache Arrow format /// The offsets buffers returned by GetReadOnlyOffsetBuffers can be used to delineate each value - /// IEnumerable> + /// An enumeration of whose elements are the raw data buffers for the UTF8 string values. public IEnumerable> GetReadOnlyDataBuffers() { for (int i = 0; i < _dataBuffers.Count; i++) @@ -133,10 +153,10 @@ public IEnumerable> GetReadOnlyDataBuffers() } /// - /// Returns an enumerable of immutable ReadOnlyMemory buffers representing null values in the Apache Arrow format + /// Returns an enumeration of immutable buffers representing values in the Apache Arrow format /// - /// Each ReadOnlyMemory encodes the indices of null values in its corresponding Data buffer - /// IEnumerable> + /// Each encodes the indices of values in its corresponding Data buffer + /// An enumeration of objects whose elements encode the null bit maps for the column's values public IEnumerable> GetReadOnlyNullBitMapBuffers() { for (int i = 0; i < _nullBitMapBuffers.Count; i++) @@ -147,10 +167,10 @@ public IEnumerable> GetReadOnlyNullBitMapBuffers() } /// - /// Returns an enumerable of immutable ReadOnlyMemory representing offsets into its corresponding Data buffer. + /// Returns an enumeration of immutable representing offsets into its corresponding Data buffer. /// The Apache Arrow format specifies how the offset buffer encodes the length of each value in the Data buffer /// - /// IEnumerable> + /// An enumeration of objects. public IEnumerable> GetReadOnlyOffsetsBuffers() { for (int i = 0; i < _offsetsBuffers.Count; i++) @@ -231,6 +251,7 @@ private ReadOnlySpan GetBytes(long index) return _dataBuffers[offsetsBufferIndex].ReadOnlySpan.Slice(currentOffset, numberOfBytes); } + /// protected override object GetValue(long rowIndex) => GetValueImplementation(rowIndex); private string GetValueImplementation(long rowIndex) @@ -247,6 +268,7 @@ private string GetValueImplementation(long rowIndex) } } + /// protected override IReadOnlyList GetValues(long startIndex, int length) { var ret = new List(); @@ -257,14 +279,27 @@ protected override IReadOnlyList GetValues(long startIndex, int length) return ret; } + /// protected override void SetValue(long rowIndex, object value) => throw new NotSupportedException(Strings.ImmutableColumn); + + /// + /// Indexer to get values. This is an immutable column + /// + /// Zero based row index + /// The value stored at this public new string this[long rowIndex] { get => GetValueImplementation(rowIndex); set => throw new NotSupportedException(Strings.ImmutableColumn); } + /// + /// Returns number of values starting from . + /// + /// The index of the first value to return. + /// The number of values to return starting from + /// A new list of string values public new List this[long startIndex, int length] { get @@ -278,6 +313,9 @@ protected override IReadOnlyList GetValues(long startIndex, int length) } } + /// + /// Returns an enumerator that iterates through the string values in this column. + /// public IEnumerator GetEnumerator() { for (long i = 0; i < Length; i++) @@ -286,10 +324,13 @@ public IEnumerator GetEnumerator() } } + /// protected override IEnumerator GetEnumeratorCore() => GetEnumerator(); + /// protected internal override Field GetArrowField() => new Field(Name, StringType.Default, NullCount != 0); + /// protected internal override int GetMaxRecordBatchLength(long startIndex) { if (Length == 0) @@ -310,6 +351,7 @@ private int GetNullCount(long startIndex, int numberOfRows) return nullCount; } + /// protected internal override Apache.Arrow.Array ToArrowArray(long startIndex, int numberOfRows) { if (numberOfRows == 0) @@ -326,8 +368,10 @@ protected internal override Apache.Arrow.Array ToArrowArray(long startIndex, int return new StringArray(numberOfRows, offsetsBuffer, dataBuffer, nullBuffer, nullCount, indexInBuffer); } + /// public override DataFrameColumn Sort(bool ascending = true) => throw new NotSupportedException(); + /// public override DataFrameColumn Clone(DataFrameColumn mapIndices = null, bool invertMapIndices = false, long numberOfNullsToAppend = 0) { ArrowStringDataFrameColumn clone; @@ -413,18 +457,21 @@ private ArrowStringDataFrameColumn Clone(PrimitiveDataFrameColumn mapIndice return CloneImplementation(mapIndices, invertMapIndex); } + /// public override DataFrame ValueCounts() { Dictionary> groupedValues = GroupColumnValues(); return StringDataFrameColumn.ValueCountsImplementation(groupedValues); } + /// public override GroupBy GroupBy(int columnIndex, DataFrame parent) { Dictionary> dictionary = GroupColumnValues(); return new GroupBy(parent, columnIndex, dictionary); } + /// public override Dictionary> GroupColumnValues() { if (typeof(TKey) == typeof(string)) @@ -451,17 +498,20 @@ public override Dictionary> GroupColumnValues() } } + /// public override DataFrameColumn FillNulls(object value, bool inPlace = false) => throw new NotSupportedException(); public override DataFrameColumn Clamp(U min, U max, bool inPlace = false) => throw new NotSupportedException(); public override DataFrameColumn Filter(U min, U max) => throw new NotSupportedException(); + /// protected internal override void AddDataViewColumn(DataViewSchema.Builder builder) { builder.AddColumn(Name, TextDataViewType.Instance); } + /// protected internal override Delegate GetDataViewGetter(DataViewRowCursor cursor) { return CreateValueGetterDelegate(cursor); @@ -495,6 +545,7 @@ public PrimitiveDataFrameColumn ElementwiseEquals(string value) return ret; } + /// public override PrimitiveDataFrameColumn ElementwiseEquals(T value) { if (value is DataFrameColumn column) @@ -504,6 +555,7 @@ public override PrimitiveDataFrameColumn ElementwiseEquals(T value) return ElementwiseEquals(value.ToString()); } + /// public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn column) { return StringDataFrameColumn.ElementwiseEqualsImplementation(this, column); @@ -534,6 +586,7 @@ public PrimitiveDataFrameColumn ElementwiseNotEquals(string value) return ret; } + /// public override PrimitiveDataFrameColumn ElementwiseNotEquals(T value) { if (value is DataFrameColumn column) @@ -543,6 +596,7 @@ public override PrimitiveDataFrameColumn ElementwiseNotEquals(T value) return ElementwiseNotEquals(value.ToString()); } + /// public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) { return StringDataFrameColumn.ElementwiseNotEqualsImplementation(this, column); diff --git a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude index 9fc80f4a64..4c3e9f332b 100644 --- a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude +++ b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude @@ -229,37 +229,37 @@ public MethodConfiguration[] methodConfiguration = new [] { - new MethodConfiguration("Add", MethodType.Binary, "+", isNumeric:true), - new MethodConfiguration("Add", MethodType.BinaryScalar, "+", isNumeric:true, methodComments: "Performs an element wise addition on each column"), - new MethodConfiguration("Subtract", MethodType.Binary, "-", isNumeric:true), - new MethodConfiguration("Subtract", MethodType.BinaryScalar, "-", isNumeric:true, methodComments: "Performs an element wise subtraction on each column"), - new MethodConfiguration("Multiply", MethodType.Binary, "*", isNumeric:true), // element-wise product, not matrix product - new MethodConfiguration("Multiply", MethodType.BinaryScalar, "*", isNumeric:true, methodComments: "Performs an element wise multiplication on each column"), - new MethodConfiguration("Divide", MethodType.Binary, "/", isNumeric:true), - new MethodConfiguration("Divide", MethodType.BinaryScalar, "/", isNumeric:true, methodComments: "Performs an element wise division on each column"), - new MethodConfiguration("Modulo", MethodType.Binary, "%", isNumeric:true), - new MethodConfiguration("Modulo", MethodType.BinaryScalar, "%", isNumeric:true, methodComments: "Performs an element wise modulus operation on each column"), - new MethodConfiguration("And", MethodType.Binary, "&", isBitwise: true), - new MethodConfiguration("And", MethodType.BinaryScalar, "&", isBitwise: true, methodComments: "Performs an element wise boolean And on each column"), - new MethodConfiguration("Or", MethodType.Binary, "|", isBitwise: true), - new MethodConfiguration("Or", MethodType.BinaryScalar, "|", isBitwise: true, methodComments: "Performs an element wise boolean Or on each column"), - new MethodConfiguration("Xor", MethodType.Binary, "^", isBitwise: true), - new MethodConfiguration("Xor", MethodType.BinaryScalar, "^", isBitwise: true, methodComments: "Performs an element wise boolean Xor on each column"), - new MethodConfiguration("LeftShift", MethodType.BinaryInt, "<<", isBitwise: true, methodComments: "Performs an element wise left shift on each column"), - new MethodConfiguration("RightShift", MethodType.BinaryInt, ">>", isBitwise: true, methodComments: "Performs an element wise right shift on each column"), + new MethodConfiguration("Add", MethodType.Binary, "+", isNumeric:true, methodComments: "Performs element-wise addition"), + new MethodConfiguration("Add", MethodType.BinaryScalar, "+", isNumeric:true, methodComments: "Performs an element-wise addition on each column"), + new MethodConfiguration("Subtract", MethodType.Binary, "-", isNumeric:true, methodComments: "Performs element-wise subtraction"), + new MethodConfiguration("Subtract", MethodType.BinaryScalar, "-", isNumeric:true, methodComments: "Performs an element-wise subtraction on each column"), + new MethodConfiguration("Multiply", MethodType.Binary, "*", isNumeric:true, methodComments: "Performs element-wise multiplication"), // element-wise product, not matrix product + new MethodConfiguration("Multiply", MethodType.BinaryScalar, "*", isNumeric:true, methodComments: "Performs an element-wise multiplication on each column"), + new MethodConfiguration("Divide", MethodType.Binary, "/", isNumeric:true, methodComments: "Performs element-wise division"), + new MethodConfiguration("Divide", MethodType.BinaryScalar, "/", isNumeric:true, methodComments: "Performs an element-wise division on each column"), + new MethodConfiguration("Modulo", MethodType.Binary, "%", isNumeric:true, methodComments: "Performs element-wise modulus"), + new MethodConfiguration("Modulo", MethodType.BinaryScalar, "%", isNumeric:true, methodComments: "Performs an element-wise modulus operation on each column"), + new MethodConfiguration("And", MethodType.Binary, "&", isBitwise: true, methodComments: "Performs element-wise boolean And"), + new MethodConfiguration("And", MethodType.BinaryScalar, "&", isBitwise: true, methodComments: "Performs an element-wise boolean And on each column"), + new MethodConfiguration("Or", MethodType.Binary, "|", isBitwise: true, methodComments: "Performs element-wise boolean Or"), + new MethodConfiguration("Or", MethodType.BinaryScalar, "|", isBitwise: true, methodComments: "Performs an element-wise boolean Or on each column"), + new MethodConfiguration("Xor", MethodType.Binary, "^", isBitwise: true, methodComments: "Performs element-wise boolean Xor"), + new MethodConfiguration("Xor", MethodType.BinaryScalar, "^", isBitwise: true, methodComments: "Performs an element-wise boolean Xor on each column"), + new MethodConfiguration("LeftShift", MethodType.BinaryInt, "<<", isBitwise: true, methodComments: "Performs an element-wise left shift on each column"), + new MethodConfiguration("RightShift", MethodType.BinaryInt, ">>", isBitwise: true, methodComments: "Performs an element-wise right shift on each column"), - new MethodConfiguration("ElementwiseEquals", MethodType.Comparison, "=="), - new MethodConfiguration("ElementwiseEquals", MethodType.ComparisonScalar, "==", methodComments: "Performs an element wise equals on each column"), - new MethodConfiguration("ElementwiseNotEquals", MethodType.Comparison, "!="), - new MethodConfiguration("ElementwiseNotEquals", MethodType.ComparisonScalar, "!=", methodComments: "Performs an element wise not-equals on each column"), - new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.Comparison, ">=", isNumeric:true), - new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.ComparisonScalar, ">=", isNumeric:true, methodComments: "Performs an element wise greater than or equal on each column"), - new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.Comparison, "<=", isNumeric:true), - new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.ComparisonScalar, "<=", isNumeric:true, methodComments: "Performs an element wise less than or equal on each column"), - new MethodConfiguration("ElementwiseGreaterThan", MethodType.Comparison, ">", isNumeric:true), - new MethodConfiguration("ElementwiseGreaterThan", MethodType.ComparisonScalar, ">", isNumeric:true, methodComments: "Performs an element wise greater than on each column"), - new MethodConfiguration("ElementwiseLessThan", MethodType.Comparison, "<", isNumeric:true), - new MethodConfiguration("ElementwiseLessThan", MethodType.ComparisonScalar, "<", isNumeric:true, methodComments: "Performs an element wise less than on each column"), + new MethodConfiguration("ElementwiseEquals", MethodType.Comparison, "==", methodComments: "Performs element-wise equals"), + new MethodConfiguration("ElementwiseEquals", MethodType.ComparisonScalar, "==", methodComments: "Performs an element-wise equals on each column"), + new MethodConfiguration("ElementwiseNotEquals", MethodType.Comparison, "!=", methodComments: "Performs element-wise not-equals"), + new MethodConfiguration("ElementwiseNotEquals", MethodType.ComparisonScalar, "!=", methodComments: "Performs an element-wise not-equals on each column"), + new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.Comparison, ">=", isNumeric:true, methodComments: "Performs element-wise greater than or equal"), + new MethodConfiguration("ElementwiseGreaterThanOrEqual", MethodType.ComparisonScalar, ">=", isNumeric:true, methodComments: "Performs an element-wise greater than or equal on each column"), + new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.Comparison, "<=", isNumeric:true, methodComments: "Performs element-wise less than or equal"), + new MethodConfiguration("ElementwiseLessThanOrEqual", MethodType.ComparisonScalar, "<=", isNumeric:true, methodComments: "Performs an element-wise less than or equal on each column"), + new MethodConfiguration("ElementwiseGreaterThan", MethodType.Comparison, ">", isNumeric:true, methodComments: "Performs element-wise greater than"), + new MethodConfiguration("ElementwiseGreaterThan", MethodType.ComparisonScalar, ">", isNumeric:true, methodComments: "Performs an element-wise greater than on each column"), + new MethodConfiguration("ElementwiseLessThan", MethodType.Comparison, "<", isNumeric:true, methodComments: "Performs element-wise less than"), + new MethodConfiguration("ElementwiseLessThan", MethodType.ComparisonScalar, "<", isNumeric:true, methodComments: "Performs an element-wise less than on each column"), }; public class MethodConfiguration @@ -342,6 +342,13 @@ return str.Replace(" an", " a reversed"); } + public string GetColumnSpecificBinaryMethodComments() + { + var str = MethodComments; + str = str.Replace("column", ""); + return str.Replace(" an", " "); + } + public string GetColumnSpecificReverseMethodComments() { return GetColumnSpecificMethodComments().Replace(" an", " a reversed"); diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs index fbb9314b89..4be928ea9a 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperations.cs @@ -33,7 +33,7 @@ public DataFrame Add(IReadOnlyList values, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise addition on each column + /// Performs an element-wise addition on each column /// public DataFrame Add(T value, bool inPlace = false) where T : unmanaged @@ -72,7 +72,7 @@ public DataFrame Subtract(IReadOnlyList values, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise subtraction on each column + /// Performs an element-wise subtraction on each column /// public DataFrame Subtract(T value, bool inPlace = false) where T : unmanaged @@ -111,7 +111,7 @@ public DataFrame Multiply(IReadOnlyList values, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise multiplication on each column + /// Performs an element-wise multiplication on each column /// public DataFrame Multiply(T value, bool inPlace = false) where T : unmanaged @@ -150,7 +150,7 @@ public DataFrame Divide(IReadOnlyList values, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise division on each column + /// Performs an element-wise division on each column /// public DataFrame Divide(T value, bool inPlace = false) where T : unmanaged @@ -189,7 +189,7 @@ public DataFrame Modulo(IReadOnlyList values, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise modulus operation on each column + /// Performs an element-wise modulus operation on each column /// public DataFrame Modulo(T value, bool inPlace = false) where T : unmanaged @@ -227,7 +227,7 @@ public DataFrame And(IReadOnlyList values, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise boolean And on each column + /// Performs an element-wise boolean And on each column /// public DataFrame And(bool value, bool inPlace = false) { @@ -264,7 +264,7 @@ public DataFrame Or(IReadOnlyList values, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise boolean Or on each column + /// Performs an element-wise boolean Or on each column /// public DataFrame Or(bool value, bool inPlace = false) { @@ -301,7 +301,7 @@ public DataFrame Xor(IReadOnlyList values, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise boolean Xor on each column + /// Performs an element-wise boolean Xor on each column /// public DataFrame Xor(bool value, bool inPlace = false) { @@ -319,7 +319,7 @@ public DataFrame Xor(bool value, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise left shift on each column + /// Performs an element-wise left shift on each column /// public DataFrame LeftShift(int value, bool inPlace = false) { @@ -337,7 +337,7 @@ public DataFrame LeftShift(int value, bool inPlace = false) return retDataFrame; } /// - /// Performs an element wise right shift on each column + /// Performs an element-wise right shift on each column /// public DataFrame RightShift(int value, bool inPlace = false) { @@ -372,7 +372,7 @@ public DataFrame ElementwiseEquals(IReadOnlyList values) return retDataFrame; } /// - /// Performs an element wise equals on each column + /// Performs an element-wise equals on each column /// public DataFrame ElementwiseEquals(T value) where T : unmanaged @@ -405,7 +405,7 @@ public DataFrame ElementwiseNotEquals(IReadOnlyList values) return retDataFrame; } /// - /// Performs an element wise not-equals on each column + /// Performs an element-wise not-equals on each column /// public DataFrame ElementwiseNotEquals(T value) where T : unmanaged @@ -438,7 +438,7 @@ public DataFrame ElementwiseGreaterThanOrEqual(IReadOnlyList values) return retDataFrame; } /// - /// Performs an element wise greater than or equal on each column + /// Performs an element-wise greater than or equal on each column /// public DataFrame ElementwiseGreaterThanOrEqual(T value) where T : unmanaged @@ -471,7 +471,7 @@ public DataFrame ElementwiseLessThanOrEqual(IReadOnlyList values) return retDataFrame; } /// - /// Performs an element wise less than or equal on each column + /// Performs an element-wise less than or equal on each column /// public DataFrame ElementwiseLessThanOrEqual(T value) where T : unmanaged @@ -504,7 +504,7 @@ public DataFrame ElementwiseGreaterThan(IReadOnlyList values) return retDataFrame; } /// - /// Performs an element wise greater than on each column + /// Performs an element-wise greater than on each column /// public DataFrame ElementwiseGreaterThan(T value) where T : unmanaged @@ -537,7 +537,7 @@ public DataFrame ElementwiseLessThan(IReadOnlyList values) return retDataFrame; } /// - /// Performs an element wise less than on each column + /// Performs an element-wise less than on each column /// public DataFrame ElementwiseLessThan(T value) where T : unmanaged @@ -554,7 +554,7 @@ public DataFrame ElementwiseLessThan(T value) } /// - /// Performs a reversed element wise addition on each column + /// Performs a reversed element-wise addition on each column /// public DataFrame ReverseAdd(T value, bool inPlace = false) where T : unmanaged @@ -572,7 +572,7 @@ public DataFrame ReverseAdd(T value, bool inPlace = false) return retDataFrame; } /// - /// Performs a reversed element wise subtraction on each column + /// Performs a reversed element-wise subtraction on each column /// public DataFrame ReverseSubtract(T value, bool inPlace = false) where T : unmanaged @@ -590,7 +590,7 @@ public DataFrame ReverseSubtract(T value, bool inPlace = false) return retDataFrame; } /// - /// Performs a reversed element wise multiplication on each column + /// Performs a reversed element-wise multiplication on each column /// public DataFrame ReverseMultiply(T value, bool inPlace = false) where T : unmanaged @@ -608,7 +608,7 @@ public DataFrame ReverseMultiply(T value, bool inPlace = false) return retDataFrame; } /// - /// Performs a reversed element wise division on each column + /// Performs a reversed element-wise division on each column /// public DataFrame ReverseDivide(T value, bool inPlace = false) where T : unmanaged @@ -626,7 +626,7 @@ public DataFrame ReverseDivide(T value, bool inPlace = false) return retDataFrame; } /// - /// Performs a reversed element wise modulus operation on each column + /// Performs a reversed element-wise modulus operation on each column /// public DataFrame ReverseModulo(T value, bool inPlace = false) where T : unmanaged @@ -644,7 +644,7 @@ public DataFrame ReverseModulo(T value, bool inPlace = false) return retDataFrame; } /// - /// Performs a reversed element wise boolean And on each column + /// Performs a reversed element-wise boolean And on each column /// public DataFrame ReverseAnd(bool value, bool inPlace = false) { @@ -661,7 +661,7 @@ public DataFrame ReverseAnd(bool value, bool inPlace = false) return retDataFrame; } /// - /// Performs a reversed element wise boolean Or on each column + /// Performs a reversed element-wise boolean Or on each column /// public DataFrame ReverseOr(bool value, bool inPlace = false) { @@ -678,7 +678,7 @@ public DataFrame ReverseOr(bool value, bool inPlace = false) return retDataFrame; } /// - /// Performs a reversed element wise boolean Xor on each column + /// Performs a reversed element-wise boolean Xor on each column /// public DataFrame ReverseXor(bool value, bool inPlace = false) { diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs index 6b357bba3a..395143a90b 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.cs @@ -12,6 +12,7 @@ namespace Microsoft.Data.Analysis { public partial class DataFrame { + #pragma warning disable 1591 public static DataFrame operator +(DataFrame df, byte value) { return df.Add(value); diff --git a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt index 27eb67e6ed..52cbb913a7 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt +++ b/src/Microsoft.Data.Analysis/DataFrame.BinaryOperators.tt @@ -18,6 +18,7 @@ namespace Microsoft.Data.Analysis { public partial class DataFrame { + #pragma warning disable 1591 <# foreach (MethodConfiguration method in methodConfiguration) { #> <# if (method.MethodType == MethodType.BinaryScalar) { #> <# if (method.IsBitwise == true) { #> diff --git a/src/Microsoft.Data.Analysis/DataFrame.Join.cs b/src/Microsoft.Data.Analysis/DataFrame.Join.cs index 7d51f2293b..d5a1278371 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.Join.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.Join.cs @@ -34,6 +34,14 @@ private void SetSuffixForDuplicatedColumnNames(DataFrame dataFrame, DataFrameCol } } + /// + /// Joins columns of another + /// + /// The other to join. + /// The suffix to add to this 's column if there are common column names + /// The suffix to add to the 's column if there are common column names + /// The to use. + /// A new public DataFrame Join(DataFrame other, string leftSuffix = "_left", string rightSuffix = "_right", JoinAlgorithm joinAlgorithm = JoinAlgorithm.Left) { DataFrame ret = new DataFrame(); diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index 178e3286ee..3587e0b4e2 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -34,6 +34,10 @@ public partial class DataFrame private readonly DataFrameColumnCollection _columnCollection; private readonly DataFrameRowCollection _rowCollection; + /// + /// Constructs a with . + /// + /// The columns of this . public DataFrame(IEnumerable columns) { _columnCollection = new DataFrameColumnCollection(columns, OnColumnsChanged); @@ -46,6 +50,9 @@ public DataFrame(params DataFrameColumn[] columns) _rowCollection = new DataFrameRowCollection(this); } + /// + /// Returns the columns contained in the as a + /// public DataFrameColumnCollection Columns => _columnCollection; /// @@ -56,6 +63,12 @@ public DataFrame(params DataFrameColumn[] columns) internal IReadOnlyList GetColumnNames() => _columnCollection.GetColumnNames(); #region Operators + /// + /// An Indexer to get or set values. + /// + /// Zero based row index + /// Zero based column index + /// The value stored at the intersection of and public object this[long rowIndex, int columnIndex] { get => _columnCollection[columnIndex][rowIndex]; @@ -253,6 +266,7 @@ public DataFrame OrderByDescending(string columnName) /// /// Minimum value. All values below this threshold will be set to it /// Maximum value. All values above this threshold will be set to it + /// Indicates if the operation should be performed in place public DataFrame Clamp(U min, U max, bool inPlace = false) { DataFrame ret = inPlace ? this : Clone(); @@ -313,6 +327,11 @@ public DataFrame Sample(int numberOfRows) return Clone(indices); } + /// + /// Groups the rows of the by unique values in the column. + /// + /// The column used to group unique values + /// A GroupBy object that stores the group information. public GroupBy GroupBy(string columnName) { int columnIndex = _columnCollection.IndexOf(columnName); @@ -371,6 +390,12 @@ public DataFrame DropNulls(DropNullOptions options = DropNullOptions.Any) return this[filter]; } + /// + /// Fills values with . + /// + /// The value to replace with. + /// A boolean flag to indicate if the operation should be in place + /// A new if is not set. Returns this otherwise. public DataFrame FillNulls(object value, bool inPlace = false) { DataFrame ret = inPlace ? this : Clone(); @@ -381,6 +406,12 @@ public DataFrame FillNulls(object value, bool inPlace = false) return ret; } + /// + /// Fills values in each column with values from . + /// + /// The values to replace with, one value per column. Should be equal to the number of columns in this . + /// A boolean flag to indicate if the operation should be in place + /// A new if is not set. Returns this otherwise. public DataFrame FillNulls(IList values, bool inPlace = false) { if (values.Count != Columns.Count) @@ -571,6 +602,10 @@ private DataFrame Sort(string columnName, bool isAscending) return new DataFrame(newColumns); } + /// + /// A preview of the contents of this as a string. + /// + /// A preview of the contents of this . public override string ToString() { StringBuilder sb = new StringBuilder(); diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs index c9132d19fb..8ecd052486 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.cs @@ -12,13 +12,16 @@ namespace Microsoft.Data.Analysis { public abstract partial class DataFrameColumn { + /// + /// Performs element-wise addition + /// public virtual DataFrameColumn Add(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } /// - /// Performs an element wise addition on each value in the column + /// Performs an element-wise addition on each value in the column /// public virtual DataFrameColumn Add(T value, bool inPlace = false) { @@ -26,20 +29,23 @@ public virtual DataFrameColumn Add(T value, bool inPlace = false) } /// - /// Performs a reversed element wise addition on each value in the column + /// Performs a reversed element-wise addition on each value in the column /// public virtual DataFrameColumn ReverseAdd(T value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs element-wise subtraction + /// public virtual DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } /// - /// Performs an element wise subtraction on each value in the column + /// Performs an element-wise subtraction on each value in the column /// public virtual DataFrameColumn Subtract(T value, bool inPlace = false) { @@ -47,20 +53,23 @@ public virtual DataFrameColumn Subtract(T value, bool inPlace = false) } /// - /// Performs a reversed element wise subtraction on each value in the column + /// Performs a reversed element-wise subtraction on each value in the column /// public virtual DataFrameColumn ReverseSubtract(T value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs element-wise multiplication + /// public virtual DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } /// - /// Performs an element wise multiplication on each value in the column + /// Performs an element-wise multiplication on each value in the column /// public virtual DataFrameColumn Multiply(T value, bool inPlace = false) { @@ -68,20 +77,23 @@ public virtual DataFrameColumn Multiply(T value, bool inPlace = false) } /// - /// Performs a reversed element wise multiplication on each value in the column + /// Performs a reversed element-wise multiplication on each value in the column /// public virtual DataFrameColumn ReverseMultiply(T value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs element-wise division + /// public virtual DataFrameColumn Divide(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } /// - /// Performs an element wise division on each value in the column + /// Performs an element-wise division on each value in the column /// public virtual DataFrameColumn Divide(T value, bool inPlace = false) { @@ -89,20 +101,23 @@ public virtual DataFrameColumn Divide(T value, bool inPlace = false) } /// - /// Performs a reversed element wise division on each value in the column + /// Performs a reversed element-wise division on each value in the column /// public virtual DataFrameColumn ReverseDivide(T value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs element-wise modulus + /// public virtual DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } /// - /// Performs an element wise modulus operation on each value in the column + /// Performs an element-wise modulus operation on each value in the column /// public virtual DataFrameColumn Modulo(T value, bool inPlace = false) { @@ -110,20 +125,23 @@ public virtual DataFrameColumn Modulo(T value, bool inPlace = false) } /// - /// Performs a reversed element wise modulus operation on each value in the column + /// Performs a reversed element-wise modulus operation on each value in the column /// public virtual DataFrameColumn ReverseModulo(T value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs element-wise boolean And + /// public virtual DataFrameColumn And(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } /// - /// Performs an element wise boolean And on each value in the column + /// Performs an element-wise boolean And on each value in the column /// public virtual PrimitiveDataFrameColumn And(bool value, bool inPlace = false) { @@ -131,20 +149,23 @@ public virtual PrimitiveDataFrameColumn And(bool value, bool inPlace = fal } /// - /// Performs a reversed element wise boolean And on each value in the column + /// Performs a reversed element-wise boolean And on each value in the column /// public virtual PrimitiveDataFrameColumn ReverseAnd(bool value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs element-wise boolean Or + /// public virtual DataFrameColumn Or(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } /// - /// Performs an element wise boolean Or on each value in the column + /// Performs an element-wise boolean Or on each value in the column /// public virtual PrimitiveDataFrameColumn Or(bool value, bool inPlace = false) { @@ -152,20 +173,23 @@ public virtual PrimitiveDataFrameColumn Or(bool value, bool inPlace = fals } /// - /// Performs a reversed element wise boolean Or on each value in the column + /// Performs a reversed element-wise boolean Or on each value in the column /// public virtual PrimitiveDataFrameColumn ReverseOr(bool value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs element-wise boolean Xor + /// public virtual DataFrameColumn Xor(DataFrameColumn column, bool inPlace = false) { throw new NotImplementedException(); } /// - /// Performs an element wise boolean Xor on each value in the column + /// Performs an element-wise boolean Xor on each value in the column /// public virtual PrimitiveDataFrameColumn Xor(bool value, bool inPlace = false) { @@ -173,7 +197,7 @@ public virtual PrimitiveDataFrameColumn Xor(bool value, bool inPlace = fal } /// - /// Performs a reversed element wise boolean Xor on each value in the column + /// Performs a reversed element-wise boolean Xor on each value in the column /// public virtual PrimitiveDataFrameColumn ReverseXor(bool value, bool inPlace = false) { @@ -181,7 +205,7 @@ public virtual PrimitiveDataFrameColumn ReverseXor(bool value, bool inPlac } /// - /// Performs an element wise left shift on each value in the column + /// Performs an element-wise left shift on each value in the column /// public virtual DataFrameColumn LeftShift(int value, bool inPlace = false) { @@ -189,85 +213,103 @@ public virtual DataFrameColumn LeftShift(int value, bool inPlace = false) } /// - /// Performs an element wise right shift on each value in the column + /// Performs an element-wise right shift on each value in the column /// public virtual DataFrameColumn RightShift(int value, bool inPlace = false) { throw new NotImplementedException(); } + /// + /// Performs element-wise equals + /// public virtual PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn column) { throw new NotImplementedException(); } /// - /// Performs an element wise equals on each value in the column + /// Performs an element-wise equals on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseEquals(T value) { throw new NotImplementedException(); } + /// + /// Performs element-wise not-equals + /// public virtual PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) { throw new NotImplementedException(); } /// - /// Performs an element wise not-equals on each value in the column + /// Performs an element-wise not-equals on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseNotEquals(T value) { throw new NotImplementedException(); } + /// + /// Performs element-wise greater than or equal + /// public virtual PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(DataFrameColumn column) { throw new NotImplementedException(); } /// - /// Performs an element wise greater than or equal on each value in the column + /// Performs an element-wise greater than or equal on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(T value) { throw new NotImplementedException(); } + /// + /// Performs element-wise less than or equal + /// public virtual PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFrameColumn column) { throw new NotImplementedException(); } /// - /// Performs an element wise less than or equal on each value in the column + /// Performs an element-wise less than or equal on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(T value) { throw new NotImplementedException(); } + /// + /// Performs element-wise greater than + /// public virtual PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameColumn column) { throw new NotImplementedException(); } /// - /// Performs an element wise greater than on each value in the column + /// Performs an element-wise greater than on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseGreaterThan(T value) { throw new NotImplementedException(); } + /// + /// Performs element-wise less than + /// public virtual PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColumn column) { throw new NotImplementedException(); } /// - /// Performs an element wise less than on each value in the column + /// Performs an element-wise less than on each value in the column /// public virtual PrimitiveDataFrameColumn ElementwiseLessThan(T value) { diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt index 2fcd5c04be..d2e289195c 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperations.tt @@ -39,9 +39,15 @@ namespace Microsoft.Data.Analysis public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(T value) <# } #> <# if (method.MethodType == MethodType.Binary) {#> + /// + /// <#=method.MethodComments#> + /// public virtual DataFrameColumn <#=method.MethodName#>(DataFrameColumn column, bool inPlace = false) <# } #> <# if (method.MethodType == MethodType.Comparison) {#> + /// + /// <#=method.MethodComments#> + /// public virtual PrimitiveDataFrameColumn <#=method.MethodName#>(DataFrameColumn column) <# } #> <# if (method.MethodType == MethodType.BinaryInt ) {#> diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs index 178d7a0bf4..6d1515bc5e 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.cs @@ -12,6 +12,7 @@ namespace Microsoft.Data.Analysis { public abstract partial class DataFrameColumn { + #pragma warning disable 1591 public static DataFrameColumn operator +(DataFrameColumn left, DataFrameColumn right) { return left.Add(right); diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt index 3524c77221..aa68fe0d0f 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.BinaryOperators.tt @@ -18,6 +18,7 @@ namespace Microsoft.Data.Analysis { public abstract partial class DataFrameColumn { + #pragma warning disable 1591 <# foreach (MethodConfiguration method in methodConfiguration) { #> <# if (method.MethodType == MethodType.BinaryScalar) { #> <# if (method.IsBitwise == true) { #> diff --git a/src/Microsoft.Data.Analysis/DataFrameColumn.cs b/src/Microsoft.Data.Analysis/DataFrameColumn.cs index 2be32ba6f3..c064ed8bda 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumn.cs @@ -17,7 +17,13 @@ namespace Microsoft.Data.Analysis /// public abstract partial class DataFrameColumn : IEnumerable { - public DataFrameColumn(string name, long length, Type type) + /// + /// The base constructor. + /// + /// The name of this column. + /// The length of this column. + /// The type of data this column holds. + protected DataFrameColumn(string name, long length, Type type) { Length = length; _name = name; @@ -63,6 +69,10 @@ public static StringDataFrameColumn Create(string name, IEnumerable valu } private long _length; + + /// + /// The length of this column + /// public long Length { get => _length; @@ -74,14 +84,26 @@ protected set } } + /// + /// The number of values in this column. + /// public abstract long NullCount { get; } private string _name; + + /// + /// The name of this column. + /// public string Name => _name; + /// + /// Updates the name of this column. + /// + /// The new name. + /// If passed in, update the column name in public void SetName(string newName, DataFrame dataFrame = null) { if (!(dataFrame is null)) @@ -91,19 +113,50 @@ public void SetName(string newName, DataFrame dataFrame = null) _name = newName; } + /// + /// The type of data this column holds. + /// public Type DataType { get; } + /// + /// Indexer to get/set values at + /// + /// The index to look up + /// The value at public object this[long rowIndex] { get => GetValue(rowIndex); set => SetValue(rowIndex, value); } + /// + /// Returns the value at . + /// + /// + /// The value at . protected abstract object GetValue(long rowIndex); + + /// + /// Returns number of values starting from . + /// + /// The first index to return values from. + /// The number of values to return. + /// A read only list of values protected abstract IReadOnlyList GetValues(long startIndex, int length); + /// + /// Sets the value at with + /// + /// The row index + /// The new value. protected abstract void SetValue(long rowIndex, object value); + /// + /// Returns number of values starting from . + /// + /// The first index to return values from. + /// The number of values to return. + /// A read only list of values public IReadOnlyList this[long startIndex, int length] { get => GetValues(startIndex, length); @@ -111,6 +164,9 @@ public object this[long rowIndex] IEnumerator IEnumerable.GetEnumerator() => GetEnumeratorCore(); + /// + /// Returns an enumerator that iterates this column. + /// protected abstract IEnumerator GetEnumeratorCore(); /// @@ -120,13 +176,21 @@ public object this[long rowIndex] protected internal virtual void Resize(long length) => throw new NotImplementedException(); /// - /// Clone column to produce a copy potentially changing the order by supplying mapIndices and an invert flag + /// Clone column to produce a copy potentially changing the order of values by supplying mapIndices and an invert flag /// /// /// - /// + /// + /// A new public virtual DataFrameColumn Clone(DataFrameColumn mapIndices = null, bool invertMapIndices = false, long numberOfNullsToAppend = 0) => CloneImplementation(mapIndices, invertMapIndices, numberOfNullsToAppend); + /// + /// Clone column to produce a copy potentially changing the order of values by supplying mapIndices and an invert flag + /// + /// + /// + /// + /// A new protected virtual DataFrameColumn CloneImplementation(DataFrameColumn mapIndices, bool invertMapIndices, long numberOfNullsToAppend) => throw new NotImplementedException(); /// @@ -149,10 +213,11 @@ public virtual DataFrameColumn Sort(bool ascending = true) public virtual GroupBy GroupBy(int columnIndex, DataFrame parent) => throw new NotImplementedException(); /// - /// Returns a new column with nulls replaced by value + /// Returns a new column with elements replaced by . /// /// Tries to convert value to the column's DataType /// + /// Indicates if the operation should be performed in place public virtual DataFrameColumn FillNulls(object value, bool inPlace = false) => FillNullsImplementation(value, inPlace); protected virtual DataFrameColumn FillNullsImplementation(object value, bool inPlace) => throw new NotImplementedException(); @@ -188,8 +253,16 @@ public virtual DataFrameColumn Sort(bool ascending = true) /// /// Minimum value. All values below this threshold will be set to it /// Maximum value. All values above this threshold will be set to it + /// Indicates if the operation should be performed in place public virtual DataFrameColumn Clamp(U min, U max, bool inPlace = false) => ClampImplementation(min, max, inPlace); + /// + /// Clamps values beyond the specified thresholds + /// + /// + /// Minimum value. All values below this threshold will be set to it + /// Maximum value. All values above this threshold will be set to it + /// Indicates if the operation should be performed in place protected virtual DataFrameColumn ClampImplementation(U min, U max, bool inPlace) => throw new NotImplementedException(); /// @@ -200,6 +273,12 @@ public virtual DataFrameColumn Sort(bool ascending = true) /// The maximum value in the resulting column public virtual DataFrameColumn Filter(U min, U max) => FilterImplementation(min, max); + /// + /// Returns a new column filtered by the lower and upper bounds + /// + /// + /// + /// protected virtual DataFrameColumn FilterImplementation(U min, U max) => throw new NotImplementedException(); /// diff --git a/src/Microsoft.Data.Analysis/GroupBy.cs b/src/Microsoft.Data.Analysis/GroupBy.cs index 10c02c3470..5d8013e9b6 100644 --- a/src/Microsoft.Data.Analysis/GroupBy.cs +++ b/src/Microsoft.Data.Analysis/GroupBy.cs @@ -26,16 +26,16 @@ public abstract class GroupBy public abstract DataFrame First(params string[] columnNames); /// - /// Returns the first numberOfRows rows of each group + /// Returns the first rows of each group /// /// /// public abstract DataFrame Head(int numberOfRows); /// - /// Returns the last numberOfRows rows of each group + /// Returns the last rows of each group /// - /// + /// /// public abstract DataFrame Tail(int numberOfRows); diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 1d1e345e73..d34016b3d6 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -10,6 +10,9 @@ This package contains easy-to-use and high-performance libraries for data analysis and transformation. Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration + true + + $(NoWarn);1591 @@ -71,10 +74,6 @@ TextTemplatingFileGenerator DataFrameBinaryOperators.cs - - TextTemplatingFileGenerator - ColumnArithmeticTemplate.cs - TextTemplatingFileGenerator PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs index db4fa787af..6ad8319edf 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs @@ -14,6 +14,7 @@ namespace Microsoft.Data.Analysis public partial class PrimitiveDataFrameColumn : DataFrameColumn where T : unmanaged { + /// public override DataFrameColumn Add(DataFrameColumn column, bool inPlace = false) { switch (column) @@ -48,6 +49,7 @@ public override DataFrameColumn Add(DataFrameColumn column, bool inPlace = false throw new NotSupportedException(); } } + /// public override DataFrameColumn Add(U value, bool inPlace = false) { DataFrameColumn column = value as DataFrameColumn; @@ -57,6 +59,7 @@ public override DataFrameColumn Add(U value, bool inPlace = false) } return AddImplementation(value, inPlace); } + /// public override DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = false) { switch (column) @@ -91,6 +94,7 @@ public override DataFrameColumn Subtract(DataFrameColumn column, bool inPlace = throw new NotSupportedException(); } } + /// public override DataFrameColumn Subtract(U value, bool inPlace = false) { DataFrameColumn column = value as DataFrameColumn; @@ -100,6 +104,7 @@ public override DataFrameColumn Subtract(U value, bool inPlace = false) } return SubtractImplementation(value, inPlace); } + /// public override DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = false) { switch (column) @@ -134,6 +139,7 @@ public override DataFrameColumn Multiply(DataFrameColumn column, bool inPlace = throw new NotSupportedException(); } } + /// public override DataFrameColumn Multiply(U value, bool inPlace = false) { DataFrameColumn column = value as DataFrameColumn; @@ -143,6 +149,7 @@ public override DataFrameColumn Multiply(U value, bool inPlace = false) } return MultiplyImplementation(value, inPlace); } + /// public override DataFrameColumn Divide(DataFrameColumn column, bool inPlace = false) { switch (column) @@ -177,6 +184,7 @@ public override DataFrameColumn Divide(DataFrameColumn column, bool inPlace = fa throw new NotSupportedException(); } } + /// public override DataFrameColumn Divide(U value, bool inPlace = false) { DataFrameColumn column = value as DataFrameColumn; @@ -186,6 +194,7 @@ public override DataFrameColumn Divide(U value, bool inPlace = false) } return DivideImplementation(value, inPlace); } + /// public override DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = false) { switch (column) @@ -220,6 +229,7 @@ public override DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = fa throw new NotSupportedException(); } } + /// public override DataFrameColumn Modulo(U value, bool inPlace = false) { DataFrameColumn column = value as DataFrameColumn; @@ -229,6 +239,7 @@ public override DataFrameColumn Modulo(U value, bool inPlace = false) } return ModuloImplementation(value, inPlace); } + /// public override DataFrameColumn And(DataFrameColumn column, bool inPlace = false) { switch (column) @@ -263,10 +274,12 @@ public override DataFrameColumn And(DataFrameColumn column, bool inPlace = false throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn And(bool value, bool inPlace = false) { return AndImplementation(value, inPlace); } + /// public override DataFrameColumn Or(DataFrameColumn column, bool inPlace = false) { switch (column) @@ -301,10 +314,12 @@ public override DataFrameColumn Or(DataFrameColumn column, bool inPlace = false) throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn Or(bool value, bool inPlace = false) { return OrImplementation(value, inPlace); } + /// public override DataFrameColumn Xor(DataFrameColumn column, bool inPlace = false) { switch (column) @@ -339,18 +354,22 @@ public override DataFrameColumn Xor(DataFrameColumn column, bool inPlace = false throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn Xor(bool value, bool inPlace = false) { return XorImplementation(value, inPlace); } + /// public override DataFrameColumn LeftShift(int value, bool inPlace = false) { return LeftShiftImplementation(value, inPlace); } + /// public override DataFrameColumn RightShift(int value, bool inPlace = false) { return RightShiftImplementation(value, inPlace); } + /// public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn column) { switch (column) @@ -385,6 +404,7 @@ public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn ElementwiseEquals(U value) { DataFrameColumn column = value as DataFrameColumn; @@ -394,6 +414,7 @@ public override PrimitiveDataFrameColumn ElementwiseEquals(U value) } return ElementwiseEqualsImplementation(value); } + /// public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) { switch (column) @@ -428,6 +449,7 @@ public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameCol throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn ElementwiseNotEquals(U value) { DataFrameColumn column = value as DataFrameColumn; @@ -437,6 +459,7 @@ public override PrimitiveDataFrameColumn ElementwiseNotEquals(U value) } return ElementwiseNotEqualsImplementation(value); } + /// public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(DataFrameColumn column) { switch (column) @@ -471,6 +494,7 @@ public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(Dat throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(U value) { DataFrameColumn column = value as DataFrameColumn; @@ -480,6 +504,7 @@ public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual( } return ElementwiseGreaterThanOrEqualImplementation(value); } + /// public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFrameColumn column) { switch (column) @@ -514,6 +539,7 @@ public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFr throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(U value) { DataFrameColumn column = value as DataFrameColumn; @@ -523,6 +549,7 @@ public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(U v } return ElementwiseLessThanOrEqualImplementation(value); } + /// public override PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameColumn column) { switch (column) @@ -557,6 +584,7 @@ public override PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameC throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn ElementwiseGreaterThan(U value) { DataFrameColumn column = value as DataFrameColumn; @@ -566,6 +594,7 @@ public override PrimitiveDataFrameColumn ElementwiseGreaterThan(U value } return ElementwiseGreaterThanImplementation(value); } + /// public override PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColumn column) { switch (column) @@ -600,6 +629,7 @@ public override PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColu throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn ElementwiseLessThan(U value) { DataFrameColumn column = value as DataFrameColumn; diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt index 3c7bc4d635..6809de48d1 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt @@ -23,8 +23,10 @@ namespace Microsoft.Data.Analysis <# foreach (MethodConfiguration method in methodConfiguration) { #> <# if (method.MethodType == MethodType.Binary || method.MethodType == MethodType.Comparison) {#> <# if (method.MethodType == MethodType.Binary) {#> + /// public override DataFrameColumn <#=method.MethodName#>(DataFrameColumn column, bool inPlace = false) <# } else { #> + /// public override PrimitiveDataFrameColumn <#=method.MethodName#>(DataFrameColumn column) <# } #> { @@ -46,11 +48,14 @@ namespace Microsoft.Data.Analysis <# if (method.MethodType == MethodType.BinaryScalar || method.MethodType == MethodType.ComparisonScalar) {#> <# if (method.MethodType == MethodType.BinaryScalar) {#> <# if (method.IsBitwise == true) { #> + /// public override PrimitiveDataFrameColumn <#=method.MethodName#>(bool value, bool inPlace = false) <# } else { #> + /// public override DataFrameColumn <#=method.MethodName#>(U value, bool inPlace = false) <# } #> <# } else {#> + /// public override PrimitiveDataFrameColumn <#=method.MethodName#>(U value) <# } #> { @@ -76,6 +81,7 @@ namespace Microsoft.Data.Analysis } <# } #> <# if (method.MethodType == MethodType.BinaryInt ) {#> + /// public override DataFrameColumn <#=method.MethodName#>(int value, bool inPlace = false) { return <#=method.MethodName#>Implementation(value, inPlace); diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.cs index 2907d01b62..58e6a1e7c5 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.cs @@ -15,110 +15,130 @@ namespace Microsoft.Data.Analysis public partial class PrimitiveDataFrameColumn : DataFrameColumn where T : unmanaged { + /// public override DataFrameColumn Abs(bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.Abs(ret._columnContainer); return ret; } + /// public override bool All() { PrimitiveColumnComputation.Instance.All(_columnContainer, out bool ret); return ret; } + /// public override bool Any() { PrimitiveColumnComputation.Instance.Any(_columnContainer, out bool ret); return ret; } + /// public override DataFrameColumn CumulativeMax(bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.CumulativeMax(ret._columnContainer); return ret; } + /// public override DataFrameColumn CumulativeMax(IEnumerable rowIndices, bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.CumulativeMax(ret._columnContainer, rowIndices); return ret; } + /// public override DataFrameColumn CumulativeMin(bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.CumulativeMin(ret._columnContainer); return ret; } + /// public override DataFrameColumn CumulativeMin(IEnumerable rowIndices, bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.CumulativeMin(ret._columnContainer, rowIndices); return ret; } + /// public override DataFrameColumn CumulativeProduct(bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.CumulativeProduct(ret._columnContainer); return ret; } + /// public override DataFrameColumn CumulativeProduct(IEnumerable rowIndices, bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.CumulativeProduct(ret._columnContainer, rowIndices); return ret; } + /// public override DataFrameColumn CumulativeSum(bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.CumulativeSum(ret._columnContainer); return ret; } + /// public override DataFrameColumn CumulativeSum(IEnumerable rowIndices, bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); PrimitiveColumnComputation.Instance.CumulativeSum(ret._columnContainer, rowIndices); return ret; } + /// public override object Max() { PrimitiveColumnComputation.Instance.Max(_columnContainer, out T ret); return ret; } + /// public override object Max(IEnumerable rowIndices) { PrimitiveColumnComputation.Instance.Max(_columnContainer, rowIndices, out T ret); return ret; } + /// public override object Min() { PrimitiveColumnComputation.Instance.Min(_columnContainer, out T ret); return ret; } + /// public override object Min(IEnumerable rowIndices) { PrimitiveColumnComputation.Instance.Min(_columnContainer, rowIndices, out T ret); return ret; } + /// public override object Product() { PrimitiveColumnComputation.Instance.Product(_columnContainer, out T ret); return ret; } + /// public override object Product(IEnumerable rowIndices) { PrimitiveColumnComputation.Instance.Product(_columnContainer, rowIndices, out T ret); return ret; } + /// public override object Sum() { PrimitiveColumnComputation.Instance.Sum(_columnContainer, out T ret); return ret; } + /// public override object Sum(IEnumerable rowIndices) { PrimitiveColumnComputation.Instance.Sum(_columnContainer, rowIndices, out T ret); return ret; } + /// public override DataFrameColumn Round(bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.tt index 588822e48b..0d09ea3e37 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Computations.tt @@ -23,16 +23,22 @@ namespace Microsoft.Data.Analysis { <# foreach (MethodConfiguration compMethod in computationMethodConfiguration) { #> <# if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false && compMethod.SupportsRowSubsets == true) {#> + /// public override DataFrameColumn <#=compMethod.MethodName#>(IEnumerable rowIndices, bool inPlace = false) <# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == false) {#> + /// public override DataFrameColumn <#=compMethod.MethodName#>(bool inPlace = false) <# } else if (compMethod.MethodType == MethodType.ElementwiseComputation && compMethod.HasReturnValue == true) {#> + /// public override object <#=compMethod.MethodName#>() <# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true && compMethod.SupportsRowSubsets == true) { #> + /// public override object <#=compMethod.MethodName#>(IEnumerable rowIndices) <# } else if (compMethod.MethodType == MethodType.Reduction && compMethod.IsNumeric == true) { #> + /// public override object <#=compMethod.MethodName#>() <# } else { #> + /// public override bool <#=compMethod.MethodName#>() <# } #> { diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs index d5309da3d0..ba04893e7e 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs @@ -15,6 +15,7 @@ public partial class PrimitiveDataFrameColumn : DataFrameColumn where T : unmanaged { + /// public override DataFrameColumn ReverseAdd(U value, bool inPlace = false) { switch (this) @@ -88,6 +89,7 @@ public override DataFrameColumn ReverseAdd(U value, bool inPlace = false) throw new NotSupportedException(); } } + /// public override DataFrameColumn ReverseSubtract(U value, bool inPlace = false) { switch (this) @@ -161,6 +163,7 @@ public override DataFrameColumn ReverseSubtract(U value, bool inPlace = false throw new NotSupportedException(); } } + /// public override DataFrameColumn ReverseMultiply(U value, bool inPlace = false) { switch (this) @@ -234,6 +237,7 @@ public override DataFrameColumn ReverseMultiply(U value, bool inPlace = false throw new NotSupportedException(); } } + /// public override DataFrameColumn ReverseDivide(U value, bool inPlace = false) { switch (this) @@ -307,6 +311,7 @@ public override DataFrameColumn ReverseDivide(U value, bool inPlace = false) throw new NotSupportedException(); } } + /// public override DataFrameColumn ReverseModulo(U value, bool inPlace = false) { switch (this) @@ -380,6 +385,7 @@ public override DataFrameColumn ReverseModulo(U value, bool inPlace = false) throw new NotSupportedException(); } } + /// public override PrimitiveDataFrameColumn ReverseAnd(bool value, bool inPlace = false) { switch (this) @@ -393,6 +399,7 @@ public override PrimitiveDataFrameColumn ReverseAnd(bool value, bool inPla } } + /// public override PrimitiveDataFrameColumn ReverseOr(bool value, bool inPlace = false) { switch (this) @@ -406,6 +413,7 @@ public override PrimitiveDataFrameColumn ReverseOr(bool value, bool inPlac } } + /// public override PrimitiveDataFrameColumn ReverseXor(bool value, bool inPlace = false) { switch (this) diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt index 61bdd71799..68382f5b92 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt @@ -24,8 +24,10 @@ namespace Microsoft.Data.Analysis <# foreach (MethodConfiguration method in methodConfiguration) { #> <# if (method.MethodType == MethodType.BinaryScalar) {#> <# if (method.IsBitwise == true) { #> + /// public override PrimitiveDataFrameColumn Reverse<#=method.MethodName#>(bool value, bool inPlace = false) <# } else { #> + /// public override DataFrameColumn Reverse<#=method.MethodName#>(U value, bool inPlace = false) <# } #> { diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Sort.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Sort.cs index 51b2729226..60f7e21046 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Sort.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.Sort.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs index 166d160063..613644a346 100644 --- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs @@ -54,8 +54,8 @@ public PrimitiveDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOn /// /// Returns an enumerable of immutable memory buffers representing the underlying values /// - /// Null values are encoded in the buffers returned by GetReadOnlyNullBitmapBuffers in the Apache Arrow format - /// IEnumerable> + /// values are encoded in the buffers returned by GetReadOnlyNullBitmapBuffers in the Apache Arrow format + /// IEnumerable public IEnumerable> GetReadOnlyDataBuffers() { for (int i = 0; i < _columnContainer.Buffers.Count; i++) @@ -66,10 +66,10 @@ public IEnumerable> GetReadOnlyDataBuffers() } /// - /// Returns an enumerable of immutable ReadOnlyMemory buffers representing null values in the Apache Arrow format + /// Returns an enumerable of immutable buffers representing values in the Apache Arrow format /// - /// Each ReadOnlyMemory encodes the null values for its corresponding Data buffer - /// IEnumerable> + /// Each encodes the values for its corresponding Data buffer + /// IEnumerable public IEnumerable> GetReadOnlyNullBitMapBuffers() { for (int i = 0; i < _columnContainer.NullBitMapBuffers.Count; i++) @@ -291,6 +291,7 @@ public override bool IsNumericColumn() /// Returns a new column with nulls replaced by value /// /// + /// Indicates if the operation should be performed in place public PrimitiveDataFrameColumn FillNulls(T value, bool inPlace = false) { PrimitiveDataFrameColumn column = inPlace ? this : Clone(); @@ -323,13 +324,24 @@ public override DataFrame ValueCounts() return new DataFrame(new List { keys, counts }); } + /// public override bool HasDescription() => IsNumericColumn(); + /// + /// Returns a preview of the column contents as a formatted string. + /// public override string ToString() { return $"{Name}: {_columnContainer.ToString()}"; } + /// + /// Returns a clone of this column + /// + /// A column who values are used as indices + /// + /// + /// public new PrimitiveDataFrameColumn Clone(DataFrameColumn mapIndices, bool invertMapIndices, long numberOfNullsToAppend) { PrimitiveDataFrameColumn clone; @@ -354,6 +366,7 @@ public override string ToString() return clone; } + /// protected override DataFrameColumn CloneImplementation(DataFrameColumn mapIndices, bool invertMapIndices, long numberOfNullsToAppend) { return Clone(mapIndices, invertMapIndices, numberOfNullsToAppend); @@ -504,6 +517,7 @@ internal SingleDataFrameColumn CloneAsSingleColumn() return new SingleDataFrameColumn(Name, newColumnContainer); } + /// public override GroupBy GroupBy(int columnIndex, DataFrame parent) { Dictionary> dictionary = GroupColumnValues(); @@ -562,6 +576,7 @@ public PrimitiveDataFrameColumn Apply(Func func) /// /// Minimum value. All values below this threshold will be set to it /// Maximum value. All values above this threshold will be set to it + /// Indicates if the operation should be performed in place public PrimitiveDataFrameColumn Clamp(T min, T max, bool inPlace = false) { PrimitiveDataFrameColumn ret = inPlace ? this : Clone(); diff --git a/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs index ffc387e211..f4faa20ad0 100644 --- a/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs +++ b/src/Microsoft.Data.Analysis/StringDataFrameColumn.BinaryOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Data.Analysis { public partial class StringDataFrameColumn : DataFrameColumn { + /// public override DataFrameColumn Add(DataFrameColumn column, bool inPlace = false) { if (Length != column.Length) @@ -66,6 +67,7 @@ public StringDataFrameColumn Add(string value, bool inPlace = false) return ret; } + /// public override DataFrameColumn Add(T value, bool inPlace = false) { return Add(value.ToString(), inPlace); @@ -86,6 +88,7 @@ internal static PrimitiveDataFrameColumn ElementwiseEqualsImplementation(D } + /// public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn column) { return ElementwiseEqualsImplementation(this, column); @@ -101,6 +104,7 @@ public PrimitiveDataFrameColumn ElementwiseEquals(string value) return ret; } + /// public override PrimitiveDataFrameColumn ElementwiseEquals(T value) { if (value is DataFrameColumn column) @@ -134,11 +138,13 @@ public PrimitiveDataFrameColumn ElementwiseNotEquals(string value) return ret; } + /// public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameColumn column) { return ElementwiseNotEqualsImplementation(this, column); } + /// public override PrimitiveDataFrameColumn ElementwiseNotEquals(T value) { if (value is DataFrameColumn column) From a6c34d028ca1a7a4222c804490b25a438cd03b19 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Mon, 23 Mar 2020 10:10:40 -0700 Subject: [PATCH 24/53] Add Apply to ArrowStringDataFrameColumn (#2889) --- .../ArrowStringDataFrameColumn.cs | 19 ++++++++++ .../DataFrameTests.cs | 35 ++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs index 6b98285842..465064e634 100644 --- a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs @@ -601,5 +601,24 @@ public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameCol { return StringDataFrameColumn.ElementwiseNotEqualsImplementation(this, column); } + + /// + /// Applies a function to all the values + /// + /// The function to apply + /// A containing the new string values + /// This function converts from UTF-8 to UTF-16 strings + public ArrowStringDataFrameColumn Apply(Func func) + { + ArrowStringDataFrameColumn ret = new ArrowStringDataFrameColumn(Name); + Encoding encoding = Encoding.UTF8; + for (long i = 0; i < Length; i++) + { + string cur = this[i]; + string funcResult = func(cur); + ret.Append(funcResult != null ? encoding.GetBytes(funcResult) : default(ReadOnlySpan)); + } + return ret; + } } } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 44636ffd72..5e540305a5 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -29,7 +29,7 @@ public static DataFrame MakeDataFrameWithTwoColumns(int length, bool withNulls = return dataFrame; } - public static DataFrameColumn CreateArrowStringColumn(int length, bool withNulls = true) + public static ArrowStringDataFrameColumn CreateArrowStringColumn(int length, bool withNulls = true) { byte[] dataMemory = new byte[length * 3]; byte[] nullMemory = new byte[BitUtility.ByteCount(length)]; @@ -2180,6 +2180,39 @@ public void TestBinaryOperationsOnExplodedNumericColumns() Assert.False(reverseInPlace.ElementwiseEquals(reverse).All()); } + [Fact] + public void TestArrowStringApply() + { + ArrowStringDataFrameColumn column = CreateArrowStringColumn(10); + ArrowStringDataFrameColumn ret = column.Apply((string cur) => + { + if (cur != null) + { + return cur + "123"; + } + return null; + }); + for (long i = 0; i < column.Length; i++) + { + if (column[i] != null) + { + Assert.Equal(column[i] + "123", ret[i]); + } + else + { + Assert.Null(ret[i]); + } + } + Assert.Equal(1, ret.NullCount); + + // Test null counts + ret = column.Apply((string cur) => + { + return null; + }); + Assert.Equal(column.Length, ret.NullCount); + } + [Fact] public void GetColumnTests() { From 9c806088e15fe39f6ef707d3f2cac44ab00c46fe Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Mon, 23 Mar 2020 14:29:08 -0700 Subject: [PATCH 25/53] Support for Exploded columns types in Arrow and IO scenarios (#2885) * Support for Exploded columns types in Arrow and IO scenarios * Unit tests * Address feedback --- .../DataFrame.Arrow.cs | 22 ++-- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 38 +++---- .../ArrowIntegrationTests.cs | 1 + .../DataFrame.IOTests.cs | 102 ++++++++++++++++++ 4 files changed, 133 insertions(+), 30 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs b/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs index 396f778a73..18b4c5d016 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs @@ -37,43 +37,43 @@ public static DataFrame FromArrowRecordBatch(RecordBatch recordBatch) BooleanArray arrowBooleanArray = (BooleanArray)arrowArray; ReadOnlyMemory valueBuffer = arrowBooleanArray.ValueBuffer.Memory; ReadOnlyMemory nullBitMapBuffer = arrowBooleanArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, valueBuffer, nullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new BooleanDataFrameColumn(field.Name, valueBuffer, nullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.Double: PrimitiveArray arrowDoubleArray = (PrimitiveArray)arrowArray; ReadOnlyMemory doubleValueBuffer = arrowDoubleArray.ValueBuffer.Memory; ReadOnlyMemory doubleNullBitMapBuffer = arrowDoubleArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, doubleValueBuffer, doubleNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new DoubleDataFrameColumn(field.Name, doubleValueBuffer, doubleNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.Float: PrimitiveArray arrowFloatArray = (PrimitiveArray)arrowArray; ReadOnlyMemory floatValueBuffer = arrowFloatArray.ValueBuffer.Memory; ReadOnlyMemory floatNullBitMapBuffer = arrowFloatArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, floatValueBuffer, floatNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new SingleDataFrameColumn(field.Name, floatValueBuffer, floatNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.Int8: PrimitiveArray arrowsbyteArray = (PrimitiveArray)arrowArray; ReadOnlyMemory sbyteValueBuffer = arrowsbyteArray.ValueBuffer.Memory; ReadOnlyMemory sbyteNullBitMapBuffer = arrowsbyteArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, sbyteValueBuffer, sbyteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new SByteDataFrameColumn(field.Name, sbyteValueBuffer, sbyteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.Int16: PrimitiveArray arrowshortArray = (PrimitiveArray)arrowArray; ReadOnlyMemory shortValueBuffer = arrowshortArray.ValueBuffer.Memory; ReadOnlyMemory shortNullBitMapBuffer = arrowshortArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, shortValueBuffer, shortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new Int16DataFrameColumn(field.Name, shortValueBuffer, shortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.Int32: PrimitiveArray arrowIntArray = (PrimitiveArray)arrowArray; ReadOnlyMemory intValueBuffer = arrowIntArray.ValueBuffer.Memory; ReadOnlyMemory intNullBitMapBuffer = arrowIntArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, intValueBuffer, intNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new Int32DataFrameColumn(field.Name, intValueBuffer, intNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.Int64: PrimitiveArray arrowLongArray = (PrimitiveArray)arrowArray; ReadOnlyMemory longValueBuffer = arrowLongArray.ValueBuffer.Memory; ReadOnlyMemory longNullBitMapBuffer = arrowLongArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, longValueBuffer, longNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new Int64DataFrameColumn(field.Name, longValueBuffer, longNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.String: StringArray stringArray = (StringArray)arrowArray; @@ -86,25 +86,25 @@ public static DataFrame FromArrowRecordBatch(RecordBatch recordBatch) PrimitiveArray arrowbyteArray = (PrimitiveArray)arrowArray; ReadOnlyMemory byteValueBuffer = arrowbyteArray.ValueBuffer.Memory; ReadOnlyMemory byteNullBitMapBuffer = arrowbyteArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, byteValueBuffer, byteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new ByteDataFrameColumn(field.Name, byteValueBuffer, byteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.UInt16: PrimitiveArray arrowUshortArray = (PrimitiveArray)arrowArray; ReadOnlyMemory ushortValueBuffer = arrowUshortArray.ValueBuffer.Memory; ReadOnlyMemory ushortNullBitMapBuffer = arrowUshortArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, ushortValueBuffer, ushortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new UInt16DataFrameColumn(field.Name, ushortValueBuffer, ushortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.UInt32: PrimitiveArray arrowUintArray = (PrimitiveArray)arrowArray; ReadOnlyMemory uintValueBuffer = arrowUintArray.ValueBuffer.Memory; ReadOnlyMemory uintNullBitMapBuffer = arrowUintArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, uintValueBuffer, uintNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new UInt32DataFrameColumn(field.Name, uintValueBuffer, uintNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.UInt64: PrimitiveArray arrowUlongArray = (PrimitiveArray)arrowArray; ReadOnlyMemory ulongValueBuffer = arrowUlongArray.ValueBuffer.Memory; ReadOnlyMemory ulongNullBitMapBuffer = arrowUlongArray.NullBitmapBuffer.Memory; - dataFrameColumn = new PrimitiveDataFrameColumn(field.Name, ulongValueBuffer, ulongNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + dataFrameColumn = new UInt64DataFrameColumn(field.Name, ulongValueBuffer, ulongNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); break; case ArrowTypeId.Decimal: case ArrowTypeId.Binary: diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index e3c6dd8e4c..f057ea7cff 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -106,69 +106,69 @@ public static DataFrame LoadCsv(string filename, } } + private static string GetColumnName(string[] columnNames, int columnIndex) + { + return columnNames == null ? "Column" + columnIndex.ToString() : columnNames[columnIndex]; + } + private static DataFrameColumn CreateColumn(Type kind, string[] columnNames, int columnIndex) { - PrimitiveDataFrameColumn CreatePrimitiveDataFrameColumn() - where T : unmanaged - { - return new PrimitiveDataFrameColumn(columnNames == null ? "Column" + columnIndex.ToString() : columnNames[columnIndex]); - } DataFrameColumn ret; if (kind == typeof(bool)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new BooleanDataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(int)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new Int32DataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(float)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new SingleDataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(string)) { - ret = new StringDataFrameColumn(columnNames == null ? "Column" + columnIndex.ToString() : columnNames[columnIndex], 0); + ret = new StringDataFrameColumn(GetColumnName(columnNames, columnIndex), 0); } else if (kind == typeof(long)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new Int64DataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(decimal)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new DecimalDataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(byte)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new ByteDataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(char)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new CharDataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(double)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new DoubleDataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(sbyte)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new SByteDataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(short)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new Int16DataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(uint)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new UInt32DataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(ulong)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new UInt64DataFrameColumn(GetColumnName(columnNames, columnIndex)); } else if (kind == typeof(ushort)) { - ret = CreatePrimitiveDataFrameColumn(); + ret = new UInt16DataFrameColumn(GetColumnName(columnNames, columnIndex)); } else { diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs index 513c1dade2..c830e61516 100644 --- a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs @@ -50,6 +50,7 @@ public void TestArrowIntegration() .Build(); DataFrame df = DataFrame.FromArrowRecordBatch(originalBatch); + DataFrameTests.VerifyColumnTypes(df, testArrowStringColumn: true); IEnumerable recordBatches = df.ToArrowRecordBatches(); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index 6b2634159f..0decb3ec25 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -5,12 +5,101 @@ using System; using System.IO; using System.Text; +using Apache.Arrow; using Xunit; namespace Microsoft.Data.Analysis.Tests { public partial class DataFrameTests { + internal static void VerifyColumnTypes(DataFrame df, bool testArrowStringColumn = false) + { + foreach (DataFrameColumn column in df.Columns) + { + Type dataType = column.DataType; + if (dataType == typeof(bool)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(decimal)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(byte)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(char)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(double)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(float)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(int)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(long)) + { + + Assert.IsType(column); + } + else if (dataType == typeof(sbyte)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(short)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(uint)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(ulong)) + { + + Assert.IsType(column); + } + else if (dataType == typeof(ushort)) + { + Assert.IsType(column); + + } + else if (dataType == typeof(string)) + { + if (!testArrowStringColumn) + { + Assert.IsType(column); + } + else + { + Assert.IsType(column); + } + } + else + { + throw new NotImplementedException("Unit test has to be updated"); + } + } + } + [Fact] public void TestReadCsvWithHeader() { @@ -28,11 +117,13 @@ Stream GetStream(string streamData) Assert.Equal(4, df.Rows.Count); Assert.Equal(7, df.Columns.Count); Assert.Equal("CMT", df.Columns["vendor_id"][3]); + VerifyColumnTypes(df); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); } [Fact] @@ -51,11 +142,13 @@ Stream GetStream(string streamData) Assert.Equal(4, df.Rows.Count); Assert.Equal(7, df.Columns.Count); Assert.Equal("CMT", df.Columns["Column0"][3]); + VerifyColumnTypes(df); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), header: false, numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows.Columns["Column0"][2]); + VerifyColumnTypes(df); } [Fact] @@ -83,6 +176,7 @@ Stream GetStream(string streamData) Assert.True(typeof(float) == df.Columns[4].DataType); Assert.True(typeof(string) == df.Columns[5].DataType); Assert.True(typeof(double) == df.Columns[6].DataType); + VerifyColumnTypes(df); foreach (var column in df.Columns) { @@ -124,11 +218,13 @@ Stream GetStream(string streamData) Assert.Equal(5, df.Rows.Count); Assert.Equal(7, df.Columns.Count); Assert.Equal("CMT", df.Columns["vendor_id"][4]); + VerifyColumnTypes(df); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: '|', numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); var nullRow = df.Rows[3]; Assert.Equal("", nullRow[0]); @@ -159,11 +255,13 @@ Stream GetStream(string streamData) Assert.Equal(5, df.Rows.Count); Assert.Equal(7, df.Columns.Count); Assert.Equal("CMT", df.Columns["vendor_id"][4]); + VerifyColumnTypes(df); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: ';', numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); var nullRow = df.Rows[3]; Assert.Equal("", nullRow[0]); @@ -193,11 +291,13 @@ Stream GetStream(string streamData) Assert.Equal(4, df.Rows.Count); Assert.Equal(7, df.Columns.Count); Assert.Equal("CMT", df.Columns["vendor_id"][3]); + VerifyColumnTypes(df); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(7, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); } [Fact] @@ -235,11 +335,13 @@ Stream GetStream(string streamData) Assert.Equal(4, df.Rows.Count); Assert.Equal(6, df.Columns.Count); Assert.Equal("CMT", df.Columns["vendor_id"][3]); + VerifyColumnTypes(df); DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); Assert.Equal(3, reducedRows.Rows.Count); Assert.Equal(6, reducedRows.Columns.Count); Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); } } From d1209823c5026f8254c6b10e29e2cc3b472e3066 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Mon, 23 Mar 2020 17:03:34 -0700 Subject: [PATCH 26/53] Bump version (#2890) --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index d34016b3d6..58f13b9525 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -4,7 +4,7 @@ netstandard2.0 7.3 true - 0.2.0 + 0.3.0 true false This package contains easy-to-use and high-performance libraries for data analysis and transformation. From 59df417de5a8387e4ca9dd90549f09f7d8cea43c Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Tue, 24 Mar 2020 16:20:00 -0700 Subject: [PATCH 27/53] Fix versioning to allow for individual stable packages (#2891) * Fix versioning to allow for individual stable packages * sq --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 58f13b9525..10f3afa9ef 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -4,6 +4,7 @@ netstandard2.0 7.3 true + false 0.3.0 true false From d79dd2f7c4fe8747975b163c72a88558c928ff91 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Wed, 25 Mar 2020 12:17:59 -0500 Subject: [PATCH 28/53] Bump Microsoft.Data.Analysis version to 0.4.0 (#2892) * Bump Microsoft.Data.Analysis version to 0.4.0 --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 10f3afa9ef..44e398bbff 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -5,8 +5,7 @@ 7.3 true false - 0.3.0 - true + 0.4.0 false This package contains easy-to-use and high-performance libraries for data analysis and transformation. Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. From 28140bd21ea4157c1ef35251928f9b1599d3e299 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 30 Apr 2020 11:51:00 -0700 Subject: [PATCH 29/53] Fix https://github.com/dotnet/corefxlab/issues/2906 (#2907) * Fix https://github.com/dotnet/corefxlab/issues/2906 * Improvements and unit tests * sq * Better fix * sq --- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 54 ++++++---- .../strings.Designer.cs | 9 ++ src/Microsoft.Data.Analysis/strings.resx | 3 + .../DataFrame.IOTests.cs | 101 ++++++++++++++++++ 4 files changed, 144 insertions(+), 23 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index f057ea7cff..dd0752a0ae 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -198,14 +198,23 @@ public static DataFrame LoadCsv(Stream csvStream, Encoding encoding = null) { if (!csvStream.CanSeek) + { throw new ArgumentException(Strings.NonSeekableStream, nameof(csvStream)); + } + + if (dataTypes == null && guessRows <= 0) + { + throw new ArgumentException(string.Format(Strings.ExpectedEitherGuessRowsOrDataTypes, nameof(guessRows), nameof(dataTypes))); + } var linesForGuessType = new List(); long rowline = 0; int numberOfColumns = dataTypes?.Length ?? 0; if (header == true && numberOfRowsToRead != -1) + { numberOfRowsToRead++; + } List columns; long streamStart = csvStream.Position; @@ -213,40 +222,39 @@ public static DataFrame LoadCsv(Stream csvStream, using (var streamReader = new StreamReader(csvStream, encoding ?? Encoding.UTF8, detectEncodingFromByteOrderMarks: true, DefaultStreamReaderBufferSize, leaveOpen: true)) { string line = null; - if (dataTypes == null) + line = streamReader.ReadLine(); + while (line != null) { - line = streamReader.ReadLine(); - while (line != null) + if ((numberOfRowsToRead == -1) || rowline < numberOfRowsToRead) { - if ((numberOfRowsToRead == -1) || rowline < numberOfRowsToRead) + if (linesForGuessType.Count < guessRows || (header && rowline == 0)) { - if (linesForGuessType.Count < guessRows) + var spl = line.Split(separator); + if (header && rowline == 0) { - var spl = line.Split(separator); - if (header && rowline == 0) - { - if (columnNames == null) - columnNames = spl; - } - else + if (columnNames == null) { - linesForGuessType.Add(spl); - numberOfColumns = Math.Max(numberOfColumns, spl.Length); + columnNames = spl; } } + else + { + linesForGuessType.Add(spl); + numberOfColumns = Math.Max(numberOfColumns, spl.Length); + } } - ++rowline; - if (rowline == guessRows) - { - break; - } - line = streamReader.ReadLine(); } - - if (linesForGuessType.Count == 0) + ++rowline; + if (rowline == guessRows || guessRows == 0) { - throw new FormatException(Strings.EmptyFile); + break; } + line = streamReader.ReadLine(); + } + + if (rowline == 0) + { + throw new FormatException(Strings.EmptyFile); } columns = new List(numberOfColumns); diff --git a/src/Microsoft.Data.Analysis/strings.Designer.cs b/src/Microsoft.Data.Analysis/strings.Designer.cs index 6196e234a3..92d9a8771b 100644 --- a/src/Microsoft.Data.Analysis/strings.Designer.cs +++ b/src/Microsoft.Data.Analysis/strings.Designer.cs @@ -132,6 +132,15 @@ internal static string ExceedsNumberOfColumns { } } + /// + /// Looks up a localized string similar to Expected either {0} or {1} to be provided. + /// + internal static string ExpectedEitherGuessRowsOrDataTypes { + get { + return ResourceManager.GetString("ExpectedEitherGuessRowsOrDataTypes", resourceCulture); + } + } + /// /// Looks up a localized string similar to Column is immutable. /// diff --git a/src/Microsoft.Data.Analysis/strings.resx b/src/Microsoft.Data.Analysis/strings.resx index 446b3b3f37..ba2e3e0b52 100644 --- a/src/Microsoft.Data.Analysis/strings.resx +++ b/src/Microsoft.Data.Analysis/strings.resx @@ -141,6 +141,9 @@ Parameter.Count exceeds the number of columns({0}) in the DataFrame + + Expected either {0} or {1} to be provided + Column is immutable diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index 0decb3ec25..cd49f02b68 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -151,6 +151,99 @@ Stream GetStream(string streamData) VerifyColumnTypes(df); } + void VerifyDataFrameWithNamedColumnsAndDataTypes(DataFrame df, bool verifyColumnDataType, bool verifyNames) + { + Assert.Equal(4, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + + if (verifyColumnDataType) + { + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(short) == df.Columns[1].DataType); + Assert.True(typeof(int) == df.Columns[2].DataType); + Assert.True(typeof(long) == df.Columns[3].DataType); + Assert.True(typeof(float) == df.Columns[4].DataType); + Assert.True(typeof(string) == df.Columns[5].DataType); + Assert.True(typeof(double) == df.Columns[6].DataType); + } + + if (verifyNames) + { + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + Assert.Equal("trip_distance", df.Columns[4].Name); + Assert.Equal("payment_type", df.Columns[5].Name); + Assert.Equal("fare_amount", df.Columns[6].Name); + } + + VerifyColumnTypes(df); + + foreach (var column in df.Columns) + { + Assert.Equal(0, column.NullCount); + } + } + + [Theory] + [InlineData(true, 0)] + [InlineData(false, 0)] + [InlineData(true, 10)] + [InlineData(false, 10)] + public void TestReadCsvWithTypesAndGuessRows(bool header, int guessRows) + { + /* Tests this matrix + * + header GuessRows DataTypes + True 0 NotNull + False 0 NotNull + True 10 NotNull + False 10 NotNull + True 0 Null -----> Throws an exception + False 0 Null -----> Throws an exception + True 10 Null + False 10 Null + * + */ + string headerLine = @"vendor_id,rate_code,passenger_count,trip_time_in_secs,trip_distance,payment_type,fare_amount +"; + string dataLines = +@"CMT,1,1,1271,3.8,CRD,17.5 +CMT,1,1,474,1.5,CRD,8 +CMT,1,1,637,1.4,CRD,8.5 +CMT,1,1,181,0.6,CSH,4.5"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + + string data = header ? headerLine + dataLines : dataLines; + DataFrame df = DataFrame.LoadCsv(GetStream(data), + header: header, + guessRows: guessRows, + dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) } + ); + VerifyDataFrameWithNamedColumnsAndDataTypes(df, verifyColumnDataType: true, verifyNames: header); + + if (guessRows == 10) + { + df = DataFrame.LoadCsv(GetStream(data), + header: header, + guessRows: guessRows + ); + VerifyDataFrameWithNamedColumnsAndDataTypes(df, verifyColumnDataType: false, verifyNames: header); + } + else + { + Assert.ThrowsAny(() => DataFrame.LoadCsv(GetStream(data), + header: header, + guessRows: guessRows + )); + } + } + [Fact] public void TestReadCsvWithTypes() { @@ -176,6 +269,14 @@ Stream GetStream(string streamData) Assert.True(typeof(float) == df.Columns[4].DataType); Assert.True(typeof(string) == df.Columns[5].DataType); Assert.True(typeof(double) == df.Columns[6].DataType); + + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + Assert.Equal("trip_distance", df.Columns[4].Name); + Assert.Equal("payment_type", df.Columns[5].Name); + Assert.Equal("fare_amount", df.Columns[6].Name); VerifyColumnTypes(df); foreach (var column in df.Columns) From 5c3ac8b375b9bfd0a2844534c3232f701c5d6230 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Tue, 19 May 2020 10:59:53 -0700 Subject: [PATCH 30/53] Improve LoadCsv to handle null values when deducing the column types (#2916) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Unit test to repro * Fix https://github.com/dotnet/corefxlab/issues/2915 Append a null value to a column when encountering it instead of changing the column type to a StringDataFrameColumn * Update src/Microsoft.Data.Analysis/DataFrame.IO.cs Co-authored-by: Günther Foidl * Update src/Microsoft.Data.Analysis/DataFrame.cs Co-authored-by: Günther Foidl * Feedback Co-authored-by: Günther Foidl --- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 6 + src/Microsoft.Data.Analysis/DataFrame.cs | 47 +++--- .../DataFrame.IOTests.cs | 158 ++++++++++++++++++ 3 files changed, 191 insertions(+), 20 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index dd0752a0ae..084b66379d 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -23,6 +23,12 @@ private static Type GuessKind(int col, List read) throw new FormatException(string.Format(Strings.LessColumnsThatExpected, nbline + 1)); string val = line[col]; + + if (string.Equals(val, "null", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + bool boolParse = bool.TryParse(val, out bool boolResult); if (boolParse) { diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index 3587e0b4e2..e62f49a2e4 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -463,35 +463,42 @@ public DataFrame Append(IEnumerable row = null, bool inPlace = false) bool columnMoveNext = columnEnumerator.MoveNext(); if (row != null) { - // Go through row first to make sure there are no data type incompatibilities - IEnumerator rowEnumerator = row.GetEnumerator(); - bool rowMoveNext = rowEnumerator.MoveNext(); - List cachedObjectConversions = new List(); - while (columnMoveNext && rowMoveNext) + // Go through row first to make sure there are no data type incompatibilities + IEnumerator rowEnumerator = row.GetEnumerator(); + bool rowMoveNext = rowEnumerator.MoveNext(); + List cachedObjectConversions = new List(); + while (columnMoveNext && rowMoveNext) + { + DataFrameColumn column = columnEnumerator.Current; + object value = rowEnumerator.Current; + // StringDataFrameColumn can accept empty strings. The other columns interpret empty values as nulls + if (value is string stringValue) { - DataFrameColumn column = columnEnumerator.Current; - object value = rowEnumerator.Current; - // StringDataFrameColumn can accept empty strings. The other columns interpret empty values as nulls - if (value is string stringValue && string.IsNullOrEmpty(stringValue) && column.DataType != typeof(string)) + if (stringValue.Length == 0 && column.DataType != typeof(string)) { value = null; } - if (value != null) + else if (stringValue.Equals("null", StringComparison.OrdinalIgnoreCase)) { - value = Convert.ChangeType(value, column.DataType); - if (value is null) - { - throw new ArgumentException(string.Format(Strings.MismatchedValueType, column.DataType), value.GetType().ToString()); - } + value = null; } - cachedObjectConversions.Add(value); - columnMoveNext = columnEnumerator.MoveNext(); - rowMoveNext = rowEnumerator.MoveNext(); } - if (rowMoveNext) + if (value != null) { - throw new ArgumentException(string.Format(Strings.ExceedsNumberOfColumns, Columns.Count), nameof(row)); + value = Convert.ChangeType(value, column.DataType); + if (value is null) + { + throw new ArgumentException(string.Format(Strings.MismatchedValueType, column.DataType), value.GetType().ToString()); + } } + cachedObjectConversions.Add(value); + columnMoveNext = columnEnumerator.MoveNext(); + rowMoveNext = rowEnumerator.MoveNext(); + } + if (rowMoveNext) + { + throw new ArgumentException(string.Format(Strings.ExceedsNumberOfColumns, Columns.Count), nameof(row)); + } // Reset the enumerators columnEnumerator = ret.Columns.GetEnumerator(); columnMoveNext = columnEnumerator.MoveNext(); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index cd49f02b68..9bed04638c 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -445,5 +445,163 @@ Stream GetStream(string streamData) VerifyColumnTypes(df); } + + [Fact] + public void TestReadCsvWithAllNulls() + { + string data = @"vendor_id,rate_code,passenger_count,trip_time_in_secs +null,null,null,null +Null,Null,Null,Null +null,null,null,null +Null,Null,Null,Null +null,null,null,null +null,null,null,null"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Assert.Equal(6, df.Rows.Count); + Assert.Equal(4, df.Columns.Count); + + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(string) == df.Columns[1].DataType); + Assert.True(typeof(string) == df.Columns[2].DataType); + Assert.True(typeof(string) == df.Columns[3].DataType); + + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + VerifyColumnTypes(df); + + foreach (var column in df.Columns) + { + Assert.Equal(6, column.NullCount); + foreach (var value in column) + { + Assert.Null(value); + } + } + } + + [Fact] + public void TestReadCsvWithNullsAndDataTypes() + { + string data = @"vendor_id,rate_code,passenger_count,trip_time_in_secs +null,1,1,1271 +CMT,Null,1,474 +CMT,1,null,637 +Null,,, +,,, +CMT,1,1,null"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long) }); + Assert.Equal(6, df.Rows.Count); + Assert.Equal(4, df.Columns.Count); + + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(short) == df.Columns[1].DataType); + Assert.True(typeof(int) == df.Columns[2].DataType); + Assert.True(typeof(long) == df.Columns[3].DataType); + + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + VerifyColumnTypes(df); + + foreach (var column in df.Columns) + { + if (column.DataType != typeof(string)) + { + Assert.Equal(3, column.NullCount); + } + else + { + Assert.Equal(2, column.NullCount); + } + } + var nullRow = df.Rows[3]; + Assert.Null(nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + + nullRow = df.Rows[4]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + + Assert.Null(df[0, 0]); + Assert.Null(df[1, 1]); + Assert.Null(df[2, 2]); + Assert.Null(df[5, 3]); + } + + [Fact] + public void TestReadCsvWithNulls() + { + string data = @"vendor_id,rate_code,passenger_count,trip_time_in_secs +null,1,1,1271 +CMT,Null,1,474 +CMT,1,null,637 +Null,,, +,,, +CMT,1,1,null"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Assert.Equal(6, df.Rows.Count); + Assert.Equal(4, df.Columns.Count); + + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(float) == df.Columns[1].DataType); + Assert.True(typeof(float) == df.Columns[2].DataType); + Assert.True(typeof(float) == df.Columns[3].DataType); + + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + VerifyColumnTypes(df); + + foreach (var column in df.Columns) + { + if (column.DataType != typeof(string)) + { + Assert.Equal(3, column.NullCount); + } + else + { + Assert.Equal(2, column.NullCount); + } + } + var nullRow = df.Rows[3]; + Assert.Null(nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + + nullRow = df.Rows[4]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + + Assert.Null(df[0, 0]); + Assert.Null(df[1, 1]); + Assert.Null(df[2, 2]); + Assert.Null(df[5, 3]); + } } } From 0bef531289744274ab97e8bbb9e5694b0d855689 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Tue, 19 May 2020 17:20:24 -0700 Subject: [PATCH 31/53] Create a 0.4.0 package (#2918) --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 44e398bbff..7d43a8c959 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -4,7 +4,7 @@ netstandard2.0 7.3 true - false + true 0.4.0 false This package contains easy-to-use and high-performance libraries for data analysis and transformation. From b215eb46f96b8b68e652386bacb02bae0ce6ae1f Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 20 May 2020 13:29:53 -0700 Subject: [PATCH 32/53] Revert "Create a 0.4.0 package (#2918)" (#2919) This reverts commit 0bef531289744274ab97e8bbb9e5694b0d855689. --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 7d43a8c959..44e398bbff 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -4,7 +4,7 @@ netstandard2.0 7.3 true - true + false 0.4.0 false This package contains easy-to-use and high-performance libraries for data analysis and transformation. From 3b4aafaf8ec700d9005a667316904e4b48eab6a3 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 20 May 2020 13:34:41 -0700 Subject: [PATCH 33/53] Produce a 0.4.0 build (#2920) --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 44e398bbff..e1e688a634 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -5,6 +5,7 @@ 7.3 true false + release 0.4.0 false This package contains easy-to-use and high-performance libraries for data analysis and transformation. From 8d08434afa3dd2cb6ce08117ce95227e66474d31 Mon Sep 17 00:00:00 2001 From: Rhys Parry Date: Mon, 25 May 2020 17:35:15 +0000 Subject: [PATCH 34/53] Default Length for StringDataFrameColumn (#2921) (#2923) --- src/Microsoft.Data.Analysis/StringDataFrameColumn.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs index 180555eb08..92f2be029e 100644 --- a/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/StringDataFrameColumn.cs @@ -19,7 +19,7 @@ public partial class StringDataFrameColumn : DataFrameColumn, IEnumerable> _stringBuffers = new List>(); // To store more than intMax number of strings - public StringDataFrameColumn(string name, long length) : base(name, length, typeof(string)) + public StringDataFrameColumn(string name, long length = 0) : base(name, length, typeof(string)) { int numberOfBuffersRequired = Math.Max((int)(length / int.MaxValue), 1); for (int i = 0; i < numberOfBuffersRequired; i++) From 7dcf18495aaeaccdfe4139976da5eca7f3aaf51a Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Tue, 26 May 2020 06:53:37 -0700 Subject: [PATCH 35/53] Increment version and stop producing stable packages (#2922) * Increment version and stop producing stable packages --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index e1e688a634..65c8d8ffac 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -5,8 +5,7 @@ 7.3 true false - release - 0.4.0 + 0.5.0 false This package contains easy-to-use and high-performance libraries for data analysis and transformation. Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. From 881886b334273833bd747ba9b1d75be1db45cb9f Mon Sep 17 00:00:00 2001 From: daniel costea Date: Thu, 11 Jun 2020 21:19:03 +0200 Subject: [PATCH 36/53] Add DataFrame object formatter. (#2931) * Add DataFrame object formatter. * Update nuget dependencies. * Apply CR fixes. --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 65c8d8ffac..2fb580e7cb 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -230,5 +230,4 @@ Microsoft.Data - From 6e60307168e9cad35e6aeda3ecb7cb7804f81851 Mon Sep 17 00:00:00 2001 From: Ramon <56896136+RamonWill@users.noreply.github.com> Date: Wed, 24 Jun 2020 23:47:27 +0100 Subject: [PATCH 37/53] Fix a bug in InsertColumn --- .../DataFrameColumnCollection.cs | 6 ++++++ .../Microsoft.Data.Analysis.Tests/DataFrameTests.cs | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs index 2f73c4d547..90779cb85c 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs @@ -66,6 +66,12 @@ protected override void InsertItem(int columnIndex, DataFrameColumn column) { throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); } + + if (Count >= 1 && RowCount == 0 && column.Length != RowCount) + { + throw new ArgumentException(Strings.MismatchedColumnLengths, nameof(column)); + } + if (_columnNameToIndexDictionary.ContainsKey(column.Name)) { throw new ArgumentException(string.Format(Strings.DuplicateColumnName, column.Name), nameof(column)); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 5e540305a5..d40b13f233 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -1715,6 +1715,18 @@ public void TestDropNulls() Assert.Equal(19, allNulls.Rows.Count); } + [Fact] + public void TestInsertMismatchedColumnToEmptyDataFrame() + { + DataFrame df = new DataFrame(); + DataFrameColumn dataFrameColumn1 = new Int32DataFrameColumn("Int1"); + df.Columns.Insert(0, dataFrameColumn1); + + // should throw exception as column sizes are mismatched. + + Assert.Throws(() => df.Columns.Insert(1, new Int32DataFrameColumn("Int2", Enumerable.Range(0, 5).Select(x => x)))); + } + [Fact] public void TestFillNulls() { From 6c2d800d97a583280fe918f78b2bc3219f484581 Mon Sep 17 00:00:00 2001 From: Daniel Costea Date: Tue, 28 Jul 2020 01:29:08 +0200 Subject: [PATCH 38/53] Add Microsoft.Data.Analysis.nuget project (#2933) * Add DataFrame object formatter. * Update nuget dependencies. * Apply CR fixes. * Remove ReferenceOutputAssembly added to from Microsoft.Data.Analysys.csproj. * Add Microsoft.Data.Analysis.nuget project. * Move project to src. Fix nuget project settings. * Remove NoBuild property from project. * Remove IncludeBuildOutput and IncludeSymbols from project. * Add VersionPrefix to project. * Add IncludeBuildOutput property. * Add unit tests. * Downgrade from netcoreapp3.1 to netcoreapp3.0 * Upgrade from netcoreapp3.0 to netcoreapp3.1 (dotnet interactive is not compatible with 3.0) * Add netcoreapp3.1 to global settings * Add dotnet 3.1.5 runtime to global settings * Build fixes * Moving MDAI into interactive-extensions folder of the package * Minor refactoring * Respond to PR feedback Co-authored-by: Prashanth Govindarajan Co-authored-by: Jose Perez Rodriguez Co-authored-by: Eric Erhardt --- .../DataFrameKernelExtension.cs | 155 ++++++++++++++++++ ...Microsoft.Data.Analysis.Interactive.csproj | 21 +++ .../Microsoft.Data.Analysis.csproj | 26 ++- .../DataFrameInteractiveTests.cs | 64 ++++++++ ...oft.Data.Analysis.Interactive.Tests.csproj | 14 ++ 5 files changed, 276 insertions(+), 4 deletions(-) create mode 100644 src/Microsoft.Data.Analysis.Interactive/DataFrameKernelExtension.cs create mode 100644 src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj create mode 100644 tests/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs create mode 100644 tests/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj diff --git a/src/Microsoft.Data.Analysis.Interactive/DataFrameKernelExtension.cs b/src/Microsoft.Data.Analysis.Interactive/DataFrameKernelExtension.cs new file mode 100644 index 0000000000..595c71e5a6 --- /dev/null +++ b/src/Microsoft.Data.Analysis.Interactive/DataFrameKernelExtension.cs @@ -0,0 +1,155 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Html; +using Microsoft.DotNet.Interactive; +using Microsoft.DotNet.Interactive.Formatting; +using static Microsoft.DotNet.Interactive.Formatting.PocketViewTags; + +namespace Microsoft.Data.Analysis.Interactive +{ + public class DataFrameKernelExtension : IKernelExtension + { + public Task OnLoadAsync(Kernel kernel) + { + RegisterDataFrame(); + + return Task.CompletedTask; + } + + public static void RegisterDataFrame() + { + Formatter.Register((df, writer) => + { + const int MAX = 10000; + const int SIZE = 10; + + var uniqueId = DateTime.Now.Ticks; + + var header = new List + { + th(i("index")) + }; + header.AddRange(df.Columns.Select(c => (IHtmlContent)th(c.Name))); + + if (df.Rows.Count > SIZE) + { + var maxMessage = df.Rows.Count > MAX ? $" (showing a max of {MAX} rows)" : string.Empty; + var title = h3[style: "text-align: center;"]($"DataFrame - {df.Rows.Count} rows {maxMessage}"); + + // table body + var maxRows = Math.Min(MAX, df.Rows.Count); + var rows = new List>(); + for (var index = 0; index < maxRows; index++) + { + var cells = new List + { + td(i((index))) + }; + foreach (var obj in df.Rows[index]) + { + cells.Add(td(obj)); + } + rows.Add(cells); + } + + //navigator + var footer = new List(); + BuildHideRowsScript(uniqueId); + + var paginateScriptFirst = BuildHideRowsScript(uniqueId) + GotoPageIndex(uniqueId, 0) + BuildPageScript(uniqueId, SIZE); + footer.Add(button[style: "margin: 2px;", onclick: paginateScriptFirst]("⏮")); + + var paginateScriptPrevTen = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, -10, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE); + footer.Add(button[style: "margin: 2px;", onclick: paginateScriptPrevTen]("⏪")); + + var paginateScriptPrev = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, -1, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE); + footer.Add(button[style: "margin: 2px;", onclick: paginateScriptPrev]("◀️")); + + footer.Add(b[style: "margin: 2px;"]("Page")); + footer.Add(b[id: $"page_{uniqueId}", style: "margin: 2px;"]("1")); + + var paginateScriptNext = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, 1, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE); + footer.Add(button[style: "margin: 2px;", onclick: paginateScriptNext]("▶️")); + + var paginateScriptNextTen = BuildHideRowsScript(uniqueId) + UpdatePageIndex(uniqueId, 10, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE); + footer.Add(button[style: "margin: 2px;", onclick: paginateScriptNextTen]("⏩")); + + var paginateScriptLast = BuildHideRowsScript(uniqueId) + GotoPageIndex(uniqueId, (maxRows - 1) / SIZE) + BuildPageScript(uniqueId, SIZE); + footer.Add(button[style: "margin: 2px;", onclick: paginateScriptLast]("⏭️")); + + //table + var t = table[id: $"table_{uniqueId}"]( + caption(title), + thead(tr(header)), + tbody(rows.Select(r => tr[style: "display: none"](r))), + tfoot(tr(td[colspan: df.Columns.Count + 1, style: "text-align: center;"](footer))) + ); + writer.Write(t); + + //show first page + writer.Write($""); + } + else + { + var rows = new List>(); + for (var index = 0; index < df.Rows.Count; index++) + { + var cells = new List + { + td(i((index))) + }; + foreach (var obj in df.Rows[index]) + { + cells.Add(td(obj)); + } + rows.Add(cells); + } + + //table + var t = table[id: $"table_{uniqueId}"]( + thead(tr(header)), + tbody(rows.Select(r => tr(r))) + ); + writer.Write(t); + } + }, "text/html"); + } + + private static string BuildHideRowsScript(long uniqueId) + { + var script = $"var allRows = document.querySelectorAll('#table_{uniqueId} tbody tr:nth-child(n)'); "; + script += "for (let i = 0; i < allRows.length; i++) { allRows[i].style.display='none'; } "; + return script; + } + + private static string BuildPageScript(long uniqueId, int size) + { + var script = $"var page = parseInt(document.querySelector('#page_{uniqueId}').innerHTML) - 1; "; + script += $"var pageRows = document.querySelectorAll(`#table_{uniqueId} tbody tr:nth-child(n + ${{page * {size} + 1 }})`); "; + script += $"for (let j = 0; j < {size}; j++) {{ pageRows[j].style.display='table-row'; }} "; + return script; + } + + private static string GotoPageIndex(long uniqueId, long page) + { + var script = $"document.querySelector('#page_{uniqueId}').innerHTML = {page + 1}; "; + return script; + } + + private static string UpdatePageIndex(long uniqueId, int step, long maxPage) + { + var script = $"var page = parseInt(document.querySelector('#page_{uniqueId}').innerHTML) - 1; "; + script += $"page = parseInt(page) + parseInt({step}); "; + script += $"page = page < 0 ? 0 : page; "; + script += $"page = page > {maxPage} ? {maxPage} : page; "; + script += $"document.querySelector('#page_{uniqueId}').innerHTML = page + 1; "; + return script; + } + } +} diff --git a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj new file mode 100644 index 0000000000..274e35229e --- /dev/null +++ b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj @@ -0,0 +1,21 @@ + + + + netcoreapp3.1 + false + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 2fb580e7cb..31cb3a435b 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -11,10 +11,28 @@ Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration true - - $(NoWarn);1591 + + $(NoWarn);1591;NU5100 + $(TargetsForTfmSpecificContentInPackage);AddMDAIToInteractiveExtensionsFolder - + + + + + + + + + <_ItemsToIncludeForInteractive Update="@(_ItemsToIncludeForInteractive)" PackagePath="interactive-extensions/dotnet" /> + + + + True @@ -30,7 +48,7 @@ - + diff --git a/tests/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs b/tests/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs new file mode 100644 index 0000000000..7a6c2f61c3 --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Linq; +using Xunit; +using Microsoft.DotNet.Interactive.Formatting; + +namespace Microsoft.Data.Analysis.Interactive.Tests +{ + public partial class DataFrameInteractiveTests + { + private const string BUTTON_HTML_PART = "button onclick"; + private const string TABLE_HTML_PART = ""; + + public static DataFrame MakeDataFrameWithTwoColumns(int length, bool withNulls = true) + { + DataFrameColumn dataFrameColumn1 = new Int32DataFrameColumn("Int1", Enumerable.Range(0, length).Select(x => x)); + DataFrameColumn dataFrameColumn2 = new Int32DataFrameColumn("Int2", Enumerable.Range(10, length).Select(x => x)); + if (withNulls) + { + dataFrameColumn1[length / 2] = null; + dataFrameColumn2[length / 2] = null; + } + DataFrame dataFrame = new DataFrame(); + dataFrame.Columns.Insert(0, dataFrameColumn1); + dataFrame.Columns.Insert(1, dataFrameColumn2); + return dataFrame; + } + + [Fact] + public void LessThanTenRowsDataFrameTest() + { + DataFrame dataFrame = MakeDataFrameWithTwoColumns(length: 5); + DataFrameKernelExtension.RegisterDataFrame(); + var html = dataFrame.ToDisplayString("text/html"); + + Assert.Contains(TABLE_HTML_PART, html); + Assert.DoesNotContain(BUTTON_HTML_PART, html); + } + + [Fact] + public void MoreThanTenRowsDataFrameTest() + { + DataFrame dataFrame = MakeDataFrameWithTwoColumns(length: 21); + DataFrameKernelExtension.RegisterDataFrame(); + var html = dataFrame.ToDisplayString("text/html"); + + Assert.Contains(TABLE_HTML_PART, html); + Assert.Contains(BUTTON_HTML_PART, html); + } + + [Fact] + public void DataFrameInfoTest() + { + DataFrame dataFrame = MakeDataFrameWithTwoColumns(length: 5); + DataFrameKernelExtension.RegisterDataFrame(); + var html = dataFrame.Info().ToDisplayString("text/html"); + + Assert.Contains(TABLE_HTML_PART, html); + Assert.DoesNotContain(BUTTON_HTML_PART, html); + } + } +} diff --git a/tests/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj b/tests/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj new file mode 100644 index 0000000000..d40e6f713c --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj @@ -0,0 +1,14 @@ + + + netcoreapp3.1 + + + + + + + + + + + From 7ebe8bcf5508cad60d5f66841edc6a4744b23758 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 2 Sep 2020 15:35:58 -0700 Subject: [PATCH 39/53] ColumnName indexer on DataFrame (#2959) * ColumnName indexer on DataFrame Fixes https://github.com/dotnet/corefxlab/issues/2934 * Unit tests * Null column name --- src/Microsoft.Data.Analysis/DataFrame.cs | 12 ++++++++++++ .../DataFrameColumnCollection.cs | 2 +- .../Microsoft.Data.Analysis.Tests/DataFrameTests.cs | 9 +++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index e62f49a2e4..3f7d0dd130 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -147,6 +147,18 @@ public DataFrame this[IEnumerable rowFilter] } } + /// + /// An indexer based on + /// + /// The name of a + /// A if it exists. + /// Throws if is not present in this + public DataFrameColumn this[string columnName] + { + get => Columns[columnName]; + set => Columns[columnName] = value; + } + /// /// Returns the first rows /// diff --git a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs index 90779cb85c..2c3b72b28f 100644 --- a/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs +++ b/src/Microsoft.Data.Analysis/DataFrameColumnCollection.cs @@ -133,7 +133,7 @@ public void Remove(string columnName) /// public int IndexOf(string columnName) { - if (_columnNameToIndexDictionary.TryGetValue(columnName, out int columnIndex)) + if (columnName != null && _columnNameToIndexDictionary.TryGetValue(columnName, out int columnIndex)) { return columnIndex; } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index d40b13f233..f32edd64da 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -200,10 +200,11 @@ public void TestIndexer() var row = dataFrame.Rows[4]; Assert.Equal(14, (int)row[1]); - var column = dataFrame.Columns["Int2"] as Int32DataFrameColumn; + var column = dataFrame["Int2"] as Int32DataFrameColumn; Assert.Equal(1000, (int)column[2]); - Assert.Throws(() => dataFrame.Columns["Int5"]); + Assert.Throws(() => dataFrame["Int5"]); + Assert.Throws(() => dataFrame[(string)null]); } [Fact] @@ -645,7 +646,7 @@ public void TestProjectionAndAppend() { DataFrame df = MakeDataFrameWithTwoColumns(10); - df.Columns["Int3"] = df.Columns["Int1"] * 2 + df.Columns["Int2"]; + df["Int3"] = df.Columns["Int1"] * 2 + df.Columns["Int2"]; Assert.Equal(16, df.Columns["Int3"][2]); } @@ -653,7 +654,7 @@ public void TestProjectionAndAppend() public void TestComputations() { DataFrame df = MakeDataFrameWithAllMutableColumnTypes(10); - df.Columns["Int"][0] = -10; + df["Int"][0] = -10; Assert.Equal(-10, df.Columns["Int"][0]); DataFrameColumn absColumn = df.Columns["Int"].Abs(); From 54633a2fe96824d152e0689213732680ad9a4a05 Mon Sep 17 00:00:00 2001 From: Ramon Williams <56896136+RamonWill@users.noreply.github.com> Date: Thu, 3 Sep 2020 00:46:18 +0100 Subject: [PATCH 40/53] Implement FillNulls() for ArrowStringDataFrameColumn with inPlace: false (#2956) * implement FillNulls method for ArrowStringDataFrameColumn * additional asserts for testcase --- .../ArrowStringDataFrameColumn.cs | 34 ++++++++++++++++++- .../DataFrameTests.cs | 14 ++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs index 465064e634..a80e85c173 100644 --- a/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs +++ b/src/Microsoft.Data.Analysis/ArrowStringDataFrameColumn.cs @@ -499,7 +499,39 @@ public override Dictionary> GroupColumnValues() } /// - public override DataFrameColumn FillNulls(object value, bool inPlace = false) => throw new NotSupportedException(); + public ArrowStringDataFrameColumn FillNulls(string value, bool inPlace = false) + { + if (value == null) + { + throw new ArgumentException(nameof(value)); + } + if (inPlace) + { + /* For now throw an exception if inPlace = true. Need to investigate if Apache Arrow + * format supports filling nulls for variable length arrays + */ + throw new NotSupportedException(); + } + + ArrowStringDataFrameColumn ret = new ArrowStringDataFrameColumn(Name); + for (long i = 0; i < Length; i++) + { + ret.Append(IsValid(i) ? GetBytes(i) : Encoding.UTF8.GetBytes(value)); + } + return ret; + } + + protected override DataFrameColumn FillNullsImplementation(object value, bool inPlace) + { + if (value is string valueString) + { + return FillNulls(valueString, inPlace); + } + else + { + throw new ArgumentException(String.Format(Strings.MismatchedValueType, typeof(string)), nameof(value)); + } + } public override DataFrameColumn Clamp(U min, U max, bool inPlace = false) => throw new NotSupportedException(); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index f32edd64da..bb2a201842 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -1760,6 +1760,20 @@ public void TestFillNulls() Assert.Equal(0, strColumn.NullCount); Assert.Equal("foo", strColumn[0]); Assert.Equal("foo", strColumn[1]); + + // ArrowStringColumn (not inplace) + ArrowStringDataFrameColumn arrowColumn = CreateArrowStringColumn(3); + Assert.Equal(3, arrowColumn.Length); + Assert.Equal(1, arrowColumn.NullCount); + Assert.Equal(null, arrowColumn[1]); + ArrowStringDataFrameColumn arrowColumnFilled = arrowColumn.FillNulls("foo"); + Assert.Equal(3, arrowColumn.Length); + Assert.Equal(1, arrowColumn.NullCount); + Assert.Equal(3, arrowColumnFilled.Length); + Assert.Equal(0, arrowColumnFilled.NullCount); + Assert.Equal("foo", arrowColumnFilled[1]); + Assert.Equal(arrowColumn[0], arrowColumnFilled[0]); + Assert.Equal(arrowColumn[2], arrowColumnFilled[2]); } [Fact] From 4e6d8012b962b0afa07724ec3c8423e3262d0e6f Mon Sep 17 00:00:00 2001 From: Ramon Williams <56896136+RamonWill@users.noreply.github.com> Date: Thu, 10 Sep 2020 01:00:59 +0100 Subject: [PATCH 41/53] Prevent DataFrame.Sample() method from returning duplicated rows (#2939) * resolves #2806 * replace forloop with ArraySegment * reduce shuffle loop operations from O(Rows.Count) to O(numberOfRows) --- src/Microsoft.Data.Analysis/DataFrame.cs | 22 +++++++++++++++---- .../strings.Designer.cs | 9 ++++++++ src/Microsoft.Data.Analysis/strings.resx | 5 ++++- .../DataFrameTests.cs | 15 +++++++++++-- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.cs b/src/Microsoft.Data.Analysis/DataFrame.cs index 3f7d0dd130..39f4865b4d 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.cs @@ -328,14 +328,28 @@ public DataFrame AddSuffix(string suffix, bool inPlace = false) /// Number of rows in the returned DataFrame public DataFrame Sample(int numberOfRows) { + if (numberOfRows > Rows.Count) + { + throw new ArgumentException(string.Format(Strings.ExceedsNumberOfRows, Rows.Count), nameof(numberOfRows)); + } + + int shuffleLowerLimit = 0; + int shuffleUpperLimit = (int)Math.Min(Int32.MaxValue, Rows.Count); + + int[] shuffleArray = Enumerable.Range(0, shuffleUpperLimit).ToArray(); Random rand = new Random(); - PrimitiveDataFrameColumn indices = new PrimitiveDataFrameColumn("Indices", numberOfRows); - int randMaxValue = (int)Math.Min(Int32.MaxValue, Rows.Count); - for (long i = 0; i < numberOfRows; i++) + while (shuffleLowerLimit < numberOfRows) { - indices[i] = rand.Next(randMaxValue); + int randomIndex = rand.Next(shuffleLowerLimit, shuffleUpperLimit); + int temp = shuffleArray[shuffleLowerLimit]; + shuffleArray[shuffleLowerLimit] = shuffleArray[randomIndex]; + shuffleArray[randomIndex] = temp; + shuffleLowerLimit++; } + ArraySegment segment = new ArraySegment(shuffleArray, 0, shuffleLowerLimit); + PrimitiveDataFrameColumn indices = new PrimitiveDataFrameColumn("indices", segment); + return Clone(indices); } diff --git a/src/Microsoft.Data.Analysis/strings.Designer.cs b/src/Microsoft.Data.Analysis/strings.Designer.cs index 92d9a8771b..030a79a8a3 100644 --- a/src/Microsoft.Data.Analysis/strings.Designer.cs +++ b/src/Microsoft.Data.Analysis/strings.Designer.cs @@ -132,6 +132,15 @@ internal static string ExceedsNumberOfColumns { } } + /// + /// Looks up a localized string similar to Parameter.Count exceeds the number of rows({0}) in the DataFrame . + /// + internal static string ExceedsNumberOfRows { + get { + return ResourceManager.GetString("ExceedsNumberOfRows", resourceCulture); + } + } + /// /// Looks up a localized string similar to Expected either {0} or {1} to be provided. /// diff --git a/src/Microsoft.Data.Analysis/strings.resx b/src/Microsoft.Data.Analysis/strings.resx index ba2e3e0b52..267140834a 100644 --- a/src/Microsoft.Data.Analysis/strings.resx +++ b/src/Microsoft.Data.Analysis/strings.resx @@ -141,6 +141,9 @@ Parameter.Count exceeds the number of columns({0}) in the DataFrame + + Parameter.Count exceeds the number of rows({0}) in the DataFrame + Expected either {0} or {1} to be provided @@ -186,4 +189,4 @@ Cannot span multiple buffers - \ No newline at end of file + diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index bb2a201842..1c8493fc71 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -1561,9 +1561,20 @@ public void TestPrefixAndSuffix() public void TestSample() { DataFrame df = MakeDataFrameWithAllColumnTypes(10); - DataFrame sampled = df.Sample(3); - Assert.Equal(3, sampled.Rows.Count); + DataFrame sampled = df.Sample(7); + Assert.Equal(7, sampled.Rows.Count); Assert.Equal(df.Columns.Count, sampled.Columns.Count); + + // all sampled rows should be unique. + HashSet uniqueRowValues = new HashSet(); + foreach(int? value in sampled.Columns["Int"]) + { + uniqueRowValues.Add(value); + } + Assert.Equal(uniqueRowValues.Count, sampled.Rows.Count); + + // should throw exception as sample size is greater than dataframe rows + Assert.Throws(()=> df.Sample(13)); } [Fact] From 81d0ba58394207d68f71689ea7e7f1ca48a55996 Mon Sep 17 00:00:00 2001 From: Daniel Costea Date: Thu, 1 Oct 2020 21:43:58 +0200 Subject: [PATCH 42/53] Add WriteCsv plus unit tests. (#2947) * Add WriteCsv plus unit tests. * Add CultureInfo to WriteCsv. Remove index column param. Update unit tests. * Add CR changes. CultureInfo. Separator. * Format decimal types individually. Fix culture info. Fix unit tests. * Format decimal types individually. Fix culture info. Fix unit tests. --- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 117 +++++++++++++ .../DataFrame.IOTests.cs | 157 ++++++++++++++++++ 2 files changed, 274 insertions(+) diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index 084b66379d..54268172a0 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -4,8 +4,11 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; +using System.Linq; using System.Text; +using Microsoft.ML; namespace Microsoft.Data.Analysis { @@ -306,5 +309,119 @@ public static DataFrame LoadCsv(Stream csvStream, return ret; } } + + /// + /// Writes a DataFrame into a CSV. + /// + /// + /// CSV file path + /// column separator + /// has a header or not + /// The character encoding. Defaults to UTF8 if not specified + /// culture info for formatting values + public static void WriteCsv(DataFrame dataFrame, string path, + char separator = ',', bool header = true, + Encoding encoding = null, CultureInfo cultureInfo = null) + { + using (FileStream csvStream = new FileStream(path, FileMode.Create)) + { + WriteCsv(dataFrame: dataFrame, csvStream: csvStream, + separator: separator, header: header, + encoding: encoding, cultureInfo: cultureInfo); + } + } + + /// + /// Writes a DataFrame into a CSV. + /// + /// + /// stream of CSV data to be write out + /// column separator + /// has a header or not + /// the character encoding. Defaults to UTF8 if not specified + /// culture info for formatting values + public static void WriteCsv(DataFrame dataFrame, Stream csvStream, + char separator = ',', bool header = true, + Encoding encoding = null, CultureInfo cultureInfo = null) + { + if (cultureInfo is null) + { + cultureInfo = CultureInfo.CurrentCulture; + } + + if (cultureInfo.NumberFormat.NumberDecimalSeparator.Equals(separator.ToString())) + { + throw new ArgumentException("Decimal separator cannot match the column separator"); + } + + if (encoding is null) + { + encoding = Encoding.ASCII; + } + + using (StreamWriter csvFile = new StreamWriter(csvStream, encoding, bufferSize: DefaultStreamReaderBufferSize, leaveOpen: true)) + { + if (dataFrame != null) + { + var columnNames = dataFrame.Columns.GetColumnNames(); + + if (header) + { + var headerColumns = string.Join(separator.ToString(), columnNames); + csvFile.WriteLine(headerColumns); + } + + var record = new StringBuilder(); + + foreach (var row in dataFrame.Rows) + { + bool firstRow = true; + foreach (var cell in row) + { + if (!firstRow) + { + record.Append(separator); + } + else + { + firstRow = false; + } + + Type t = cell?.GetType(); + + if (t == typeof(bool)) + { + record.AppendFormat(cultureInfo, "{0}", cell); + continue; + } + + if (t == typeof(float)) + { + record.AppendFormat(cultureInfo, "{0:G9}", cell); + continue; + } + + if (t == typeof(double)) + { + record.AppendFormat(cultureInfo, "{0:G17}", cell); + continue; + } + + if (t == typeof(decimal)) + { + record.AppendFormat(cultureInfo, "{0:G31}", cell); + continue; + } + + record.Append(cell); + } + + csvFile.WriteLine(record); + + record.Clear(); + } + } + } + } } } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index 9bed04638c..b463068044 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -3,7 +3,9 @@ // See the LICENSE file in the project root for more information. using System; +using System.Globalization; using System.IO; +using System.Linq; using System.Text; using Apache.Arrow; using Xunit; @@ -603,5 +605,160 @@ Stream GetStream(string streamData) Assert.Null(df[2, 2]); Assert.Null(df[5, 3]); } + + [Fact] + public void TestWriteCsvWithHeader() + { + using MemoryStream csvStream = new MemoryStream(); + DataFrame dataFrame = MakeDataFrameWithAllColumnTypes(10, true); + + DataFrame.WriteCsv(dataFrame, csvStream); + + csvStream.Seek(0, SeekOrigin.Begin); + DataFrame readIn = DataFrame.LoadCsv(csvStream); + + Assert.Equal(dataFrame.Rows.Count, readIn.Rows.Count); + Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); + Assert.Equal(1F, readIn[1, 0]); + Assert.Equal(1F, readIn[1, 1]); + Assert.Equal(1F, readIn[1, 2]); + Assert.Equal(1F, readIn[1, 3]); + Assert.Equal(1F, readIn[1, 4]); + Assert.Equal(1F, readIn[1, 5]); + Assert.Equal(1F, readIn[1, 6]); + Assert.Equal(1F, readIn[1, 7]); + Assert.Equal(1F, readIn[1, 8]); + Assert.Equal(1F, readIn[1, 9]); + Assert.Equal(1F, readIn[1, 10]); + } + + [Fact] + public void TestWriteCsvWithCultureInfoRomanianAndSemiColon() + { + DataFrame dataFrame = MakeDataFrameWithNumericColumns(10, true); + dataFrame[1, 1] = 1.1M; + dataFrame[1, 2] = 1.2D; + dataFrame[1, 3] = 1.3F; + + using MemoryStream csvStream = new MemoryStream(); + var cultureInfo = new CultureInfo("ro-RO"); + var separator = ';'; + DataFrame.WriteCsv(dataFrame, csvStream, separator: separator, cultureInfo: cultureInfo); + + csvStream.Seek(0, SeekOrigin.Begin); + DataFrame readIn = DataFrame.LoadCsv(csvStream, separator: separator); + + Assert.Equal(dataFrame.Rows.Count, readIn.Rows.Count); + Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); + Assert.Equal(1F, readIn[1, 0]); + + // LoadCsv does not support culture info, therefore decimal point comma (,) is seen as thousand separator and is ignored when read + Assert.Equal(11F, readIn[1, 1]); + Assert.Equal(12F, readIn[1, 2]); + Assert.Equal(129999992F, readIn[1, 3]); + + Assert.Equal(1F, readIn[1, 4]); + Assert.Equal(1F, readIn[1, 5]); + Assert.Equal(1F, readIn[1, 6]); + Assert.Equal(1F, readIn[1, 7]); + Assert.Equal(1F, readIn[1, 8]); + Assert.Equal(1F, readIn[1, 9]); + Assert.Equal(1F, readIn[1, 10]); + } + + [Fact] + public void TestWriteCsvWithCultureInfo() + { + using MemoryStream csvStream = new MemoryStream(); + DataFrame dataFrame = MakeDataFrameWithNumericColumns(10, true); + dataFrame[1, 1] = 1.1M; + dataFrame[1, 2] = 1.2D; + dataFrame[1, 3] = 1.3F; + + var cultureInfo = new CultureInfo("en-US"); + DataFrame.WriteCsv(dataFrame, csvStream, cultureInfo: cultureInfo); + + csvStream.Seek(0, SeekOrigin.Begin); + DataFrame readIn = DataFrame.LoadCsv(csvStream); + + Assert.Equal(dataFrame.Rows.Count, readIn.Rows.Count); + Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); + Assert.Equal(1F, readIn[1, 0]); + Assert.Equal(1.1F, readIn[1, 1]); + Assert.Equal(1.2F, readIn[1, 2]); + Assert.Equal(1.3F, readIn[1, 3]); + Assert.Equal(1F, readIn[1, 4]); + Assert.Equal(1F, readIn[1, 5]); + Assert.Equal(1F, readIn[1, 6]); + Assert.Equal(1F, readIn[1, 7]); + Assert.Equal(1F, readIn[1, 8]); + Assert.Equal(1F, readIn[1, 9]); + Assert.Equal(1F, readIn[1, 10]); + } + + [Fact] + public void TestWriteCsvWithCultureInfoRomanianAndComma() + { + using MemoryStream csvStream = new MemoryStream(); + DataFrame dataFrame = MakeDataFrameWithNumericColumns(10, true); + + var cultureInfo = new CultureInfo("ro-RO"); + var separator = cultureInfo.NumberFormat.NumberDecimalSeparator.First(); + + Assert.Throws(() => DataFrame.WriteCsv(dataFrame, csvStream, separator: separator, cultureInfo: cultureInfo)); + } + + [Fact] + public void TestWriteCsvWithNoHeader() + { + using MemoryStream csvStream = new MemoryStream(); + DataFrame dataFrame = MakeDataFrameWithAllColumnTypes(10, true); + + DataFrame.WriteCsv(dataFrame, csvStream, header: false); + + csvStream.Seek(0, SeekOrigin.Begin); + DataFrame readIn = DataFrame.LoadCsv(csvStream, header: false); + + Assert.Equal(dataFrame.Rows.Count, readIn.Rows.Count); + Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); + Assert.Equal(1F, readIn[1, 0]); + Assert.Equal(1F, readIn[1, 1]); + Assert.Equal(1F, readIn[1, 2]); + Assert.Equal(1F, readIn[1, 3]); + Assert.Equal(1F, readIn[1, 4]); + Assert.Equal(1F, readIn[1, 5]); + Assert.Equal(1F, readIn[1, 6]); + Assert.Equal(1F, readIn[1, 7]); + Assert.Equal(1F, readIn[1, 8]); + Assert.Equal(1F, readIn[1, 9]); + Assert.Equal(1F, readIn[1, 10]); + } + + [Fact] + public void TestWriteCsvWithSemicolonSeparator() + { + using MemoryStream csvStream = new MemoryStream(); + DataFrame dataFrame = MakeDataFrameWithAllColumnTypes(10, true); + + var separator = ';'; + DataFrame.WriteCsv(dataFrame, csvStream, separator: separator); + + csvStream.Seek(0, SeekOrigin.Begin); + DataFrame readIn = DataFrame.LoadCsv(csvStream, separator: separator); + + Assert.Equal(dataFrame.Rows.Count, readIn.Rows.Count); + Assert.Equal(dataFrame.Columns.Count, readIn.Columns.Count); + Assert.Equal(1F, readIn[1, 0]); + Assert.Equal(1F, readIn[1, 1]); + Assert.Equal(1F, readIn[1, 2]); + Assert.Equal(1F, readIn[1, 3]); + Assert.Equal(1F, readIn[1, 4]); + Assert.Equal(1F, readIn[1, 5]); + Assert.Equal(1F, readIn[1, 6]); + Assert.Equal(1F, readIn[1, 7]); + Assert.Equal(1F, readIn[1, 8]); + Assert.Equal(1F, readIn[1, 9]); + Assert.Equal(1F, readIn[1, 10]); + } } } From db5c49e9d1f3eb690de3fe855b614768475345a4 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Tue, 20 Oct 2020 11:07:05 -0700 Subject: [PATCH 43/53] Missing values default to a `StringDataFrameColumn` (#2982) * Make LoadCsv more robust * Test empty string column * Retain prev guess where possible --- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 32 +++++--------- .../DataFrame.IOTests.cs | 44 +++++++++++++++++++ 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index 54268172a0..798d62ddf2 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -32,38 +32,26 @@ private static Type GuessKind(int col, List read) continue; } - bool boolParse = bool.TryParse(val, out bool boolResult); - if (boolParse) + if (!string.IsNullOrEmpty(val)) { - res = DetermineType(nbline == 0, typeof(bool), res); - ++nbline; - continue; - } - else - { - if (string.IsNullOrEmpty(val)) + bool boolParse = bool.TryParse(val, out bool boolResult); + if (boolParse) { res = DetermineType(nbline == 0, typeof(bool), res); + ++nbline; continue; } - } - bool floatParse = float.TryParse(val, out float floatResult); - if (floatParse) - { - res = DetermineType(nbline == 0, typeof(float), res); - ++nbline; - continue; - } - else - { - if (string.IsNullOrEmpty(val)) + bool floatParse = float.TryParse(val, out float floatResult); + if (floatParse) { res = DetermineType(nbline == 0, typeof(float), res); + ++nbline; continue; } + + res = DetermineType(nbline == 0, typeof(string), res); + ++nbline; } - res = DetermineType(nbline == 0, typeof(string), res); - ++nbline; } return res; } diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index b463068044..d74e85dc69 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -760,5 +760,49 @@ public void TestWriteCsvWithSemicolonSeparator() Assert.Equal(1F, readIn[1, 9]); Assert.Equal(1F, readIn[1, 10]); } + + [Fact] + public void TestMixedDataTypesInCsv() + { + string data = @"vendor_id,empty +null, +1, +true, +Null, +, +CMT,"; + + Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Assert.Equal(6, df.Rows.Count); + Assert.Equal(2, df.Columns.Count); + + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(string) == df.Columns[1].DataType); + + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("empty", df.Columns[1].Name); + VerifyColumnTypes(df); + Assert.Equal(2, df.Columns[0].NullCount); + Assert.Equal(0, df.Columns[1].NullCount); + + var nullRow = df.Rows[3]; + Assert.Null(nullRow[0]); + + nullRow = df.Rows[4]; + Assert.Equal("", nullRow[0]); + + Assert.Null(df[0, 0]); + Assert.Null(df[3, 0]); + + StringDataFrameColumn emptyColumn = (StringDataFrameColumn)df.Columns[1]; + for (long i = 0; i < emptyColumn.Length; i++) + { + Assert.Equal("", emptyColumn[i]); + } + } } } From cb7ab004c903d24e0a30c3f4880556dbb820ca25 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 23 Oct 2020 10:34:41 -0700 Subject: [PATCH 44/53] Update FromArrowRecordBatches for dotnet-spark (#2978) * Support for RecordBatches with StructArrays * Sq * Address comments * Nits * Nits --- .../DataFrame.Arrow.cs | 213 ++++++++++-------- .../Microsoft.Data.Analysis.csproj | 2 +- .../ArrayComparer.cs | 36 ++- .../ArrowIntegrationTests.cs | 66 ++++++ 4 files changed, 208 insertions(+), 109 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs b/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs index 18b4c5d016..cb08176197 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.Arrow.cs @@ -3,11 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections; using System.Collections.Generic; -using System.Diagnostics; -using System.Text; -using System.Threading.Tasks; using Apache.Arrow; using Apache.Arrow.Types; @@ -15,6 +11,119 @@ namespace Microsoft.Data.Analysis { public partial class DataFrame { + private static void AppendDataFrameColumnFromArrowArray(Field field, IArrowArray arrowArray, DataFrame ret, string fieldNamePrefix = "") + { + IArrowType fieldType = field.DataType; + DataFrameColumn dataFrameColumn = null; + string fieldName = fieldNamePrefix + field.Name; + switch (fieldType.TypeId) + { + case ArrowTypeId.Boolean: + BooleanArray arrowBooleanArray = (BooleanArray)arrowArray; + ReadOnlyMemory valueBuffer = arrowBooleanArray.ValueBuffer.Memory; + ReadOnlyMemory nullBitMapBuffer = arrowBooleanArray.NullBitmapBuffer.Memory; + dataFrameColumn = new BooleanDataFrameColumn(fieldName, valueBuffer, nullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Double: + PrimitiveArray arrowDoubleArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory doubleValueBuffer = arrowDoubleArray.ValueBuffer.Memory; + ReadOnlyMemory doubleNullBitMapBuffer = arrowDoubleArray.NullBitmapBuffer.Memory; + dataFrameColumn = new DoubleDataFrameColumn(fieldName, doubleValueBuffer, doubleNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Float: + PrimitiveArray arrowFloatArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory floatValueBuffer = arrowFloatArray.ValueBuffer.Memory; + ReadOnlyMemory floatNullBitMapBuffer = arrowFloatArray.NullBitmapBuffer.Memory; + dataFrameColumn = new SingleDataFrameColumn(fieldName, floatValueBuffer, floatNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Int8: + PrimitiveArray arrowsbyteArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory sbyteValueBuffer = arrowsbyteArray.ValueBuffer.Memory; + ReadOnlyMemory sbyteNullBitMapBuffer = arrowsbyteArray.NullBitmapBuffer.Memory; + dataFrameColumn = new SByteDataFrameColumn(fieldName, sbyteValueBuffer, sbyteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Int16: + PrimitiveArray arrowshortArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory shortValueBuffer = arrowshortArray.ValueBuffer.Memory; + ReadOnlyMemory shortNullBitMapBuffer = arrowshortArray.NullBitmapBuffer.Memory; + dataFrameColumn = new Int16DataFrameColumn(fieldName, shortValueBuffer, shortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Int32: + PrimitiveArray arrowIntArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory intValueBuffer = arrowIntArray.ValueBuffer.Memory; + ReadOnlyMemory intNullBitMapBuffer = arrowIntArray.NullBitmapBuffer.Memory; + dataFrameColumn = new Int32DataFrameColumn(fieldName, intValueBuffer, intNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Int64: + PrimitiveArray arrowLongArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory longValueBuffer = arrowLongArray.ValueBuffer.Memory; + ReadOnlyMemory longNullBitMapBuffer = arrowLongArray.NullBitmapBuffer.Memory; + dataFrameColumn = new Int64DataFrameColumn(fieldName, longValueBuffer, longNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.String: + StringArray stringArray = (StringArray)arrowArray; + ReadOnlyMemory dataMemory = stringArray.ValueBuffer.Memory; + ReadOnlyMemory offsetsMemory = stringArray.ValueOffsetsBuffer.Memory; + ReadOnlyMemory nullMemory = stringArray.NullBitmapBuffer.Memory; + dataFrameColumn = new ArrowStringDataFrameColumn(fieldName, dataMemory, offsetsMemory, nullMemory, stringArray.Length, stringArray.NullCount); + break; + case ArrowTypeId.UInt8: + PrimitiveArray arrowbyteArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory byteValueBuffer = arrowbyteArray.ValueBuffer.Memory; + ReadOnlyMemory byteNullBitMapBuffer = arrowbyteArray.NullBitmapBuffer.Memory; + dataFrameColumn = new ByteDataFrameColumn(fieldName, byteValueBuffer, byteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.UInt16: + PrimitiveArray arrowUshortArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory ushortValueBuffer = arrowUshortArray.ValueBuffer.Memory; + ReadOnlyMemory ushortNullBitMapBuffer = arrowUshortArray.NullBitmapBuffer.Memory; + dataFrameColumn = new UInt16DataFrameColumn(fieldName, ushortValueBuffer, ushortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.UInt32: + PrimitiveArray arrowUintArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory uintValueBuffer = arrowUintArray.ValueBuffer.Memory; + ReadOnlyMemory uintNullBitMapBuffer = arrowUintArray.NullBitmapBuffer.Memory; + dataFrameColumn = new UInt32DataFrameColumn(fieldName, uintValueBuffer, uintNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.UInt64: + PrimitiveArray arrowUlongArray = (PrimitiveArray)arrowArray; + ReadOnlyMemory ulongValueBuffer = arrowUlongArray.ValueBuffer.Memory; + ReadOnlyMemory ulongNullBitMapBuffer = arrowUlongArray.NullBitmapBuffer.Memory; + dataFrameColumn = new UInt64DataFrameColumn(fieldName, ulongValueBuffer, ulongNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); + break; + case ArrowTypeId.Struct: + StructArray structArray = (StructArray)arrowArray; + StructType structType = (StructType)field.DataType; + IEnumerator fieldsEnumerator = structType.Fields.GetEnumerator(); + IEnumerator structArrayEnumerator = structArray.Fields.GetEnumerator(); + while (fieldsEnumerator.MoveNext() && structArrayEnumerator.MoveNext()) + { + AppendDataFrameColumnFromArrowArray(fieldsEnumerator.Current, structArrayEnumerator.Current, ret, field.Name + "_"); + } + break; + case ArrowTypeId.Decimal: + case ArrowTypeId.Binary: + case ArrowTypeId.Date32: + case ArrowTypeId.Date64: + case ArrowTypeId.Dictionary: + case ArrowTypeId.FixedSizedBinary: + case ArrowTypeId.HalfFloat: + case ArrowTypeId.Interval: + case ArrowTypeId.List: + case ArrowTypeId.Map: + case ArrowTypeId.Null: + case ArrowTypeId.Time32: + case ArrowTypeId.Time64: + default: + throw new NotImplementedException(nameof(fieldType.Name)); + } + + if (dataFrameColumn != null) + { + ret.Columns.Insert(ret.Columns.Count, dataFrameColumn); + } + } + /// /// Wraps a around an Arrow without copying data /// @@ -29,101 +138,7 @@ public static DataFrame FromArrowRecordBatch(RecordBatch recordBatch) foreach (IArrowArray arrowArray in arrowArrays) { Field field = arrowSchema.GetFieldByIndex(fieldIndex); - IArrowType fieldType = field.DataType; - DataFrameColumn dataFrameColumn = null; - switch (fieldType.TypeId) - { - case ArrowTypeId.Boolean: - BooleanArray arrowBooleanArray = (BooleanArray)arrowArray; - ReadOnlyMemory valueBuffer = arrowBooleanArray.ValueBuffer.Memory; - ReadOnlyMemory nullBitMapBuffer = arrowBooleanArray.NullBitmapBuffer.Memory; - dataFrameColumn = new BooleanDataFrameColumn(field.Name, valueBuffer, nullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.Double: - PrimitiveArray arrowDoubleArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory doubleValueBuffer = arrowDoubleArray.ValueBuffer.Memory; - ReadOnlyMemory doubleNullBitMapBuffer = arrowDoubleArray.NullBitmapBuffer.Memory; - dataFrameColumn = new DoubleDataFrameColumn(field.Name, doubleValueBuffer, doubleNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.Float: - PrimitiveArray arrowFloatArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory floatValueBuffer = arrowFloatArray.ValueBuffer.Memory; - ReadOnlyMemory floatNullBitMapBuffer = arrowFloatArray.NullBitmapBuffer.Memory; - dataFrameColumn = new SingleDataFrameColumn(field.Name, floatValueBuffer, floatNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.Int8: - PrimitiveArray arrowsbyteArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory sbyteValueBuffer = arrowsbyteArray.ValueBuffer.Memory; - ReadOnlyMemory sbyteNullBitMapBuffer = arrowsbyteArray.NullBitmapBuffer.Memory; - dataFrameColumn = new SByteDataFrameColumn(field.Name, sbyteValueBuffer, sbyteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.Int16: - PrimitiveArray arrowshortArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory shortValueBuffer = arrowshortArray.ValueBuffer.Memory; - ReadOnlyMemory shortNullBitMapBuffer = arrowshortArray.NullBitmapBuffer.Memory; - dataFrameColumn = new Int16DataFrameColumn(field.Name, shortValueBuffer, shortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.Int32: - PrimitiveArray arrowIntArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory intValueBuffer = arrowIntArray.ValueBuffer.Memory; - ReadOnlyMemory intNullBitMapBuffer = arrowIntArray.NullBitmapBuffer.Memory; - dataFrameColumn = new Int32DataFrameColumn(field.Name, intValueBuffer, intNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.Int64: - PrimitiveArray arrowLongArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory longValueBuffer = arrowLongArray.ValueBuffer.Memory; - ReadOnlyMemory longNullBitMapBuffer = arrowLongArray.NullBitmapBuffer.Memory; - dataFrameColumn = new Int64DataFrameColumn(field.Name, longValueBuffer, longNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.String: - StringArray stringArray = (StringArray)arrowArray; - ReadOnlyMemory dataMemory = stringArray.ValueBuffer.Memory; - ReadOnlyMemory offsetsMemory = stringArray.ValueOffsetsBuffer.Memory; - ReadOnlyMemory nullMemory = stringArray.NullBitmapBuffer.Memory; - dataFrameColumn = new ArrowStringDataFrameColumn(field.Name, dataMemory, offsetsMemory, nullMemory, stringArray.Length, stringArray.NullCount); - break; - case ArrowTypeId.UInt8: - PrimitiveArray arrowbyteArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory byteValueBuffer = arrowbyteArray.ValueBuffer.Memory; - ReadOnlyMemory byteNullBitMapBuffer = arrowbyteArray.NullBitmapBuffer.Memory; - dataFrameColumn = new ByteDataFrameColumn(field.Name, byteValueBuffer, byteNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.UInt16: - PrimitiveArray arrowUshortArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory ushortValueBuffer = arrowUshortArray.ValueBuffer.Memory; - ReadOnlyMemory ushortNullBitMapBuffer = arrowUshortArray.NullBitmapBuffer.Memory; - dataFrameColumn = new UInt16DataFrameColumn(field.Name, ushortValueBuffer, ushortNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.UInt32: - PrimitiveArray arrowUintArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory uintValueBuffer = arrowUintArray.ValueBuffer.Memory; - ReadOnlyMemory uintNullBitMapBuffer = arrowUintArray.NullBitmapBuffer.Memory; - dataFrameColumn = new UInt32DataFrameColumn(field.Name, uintValueBuffer, uintNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.UInt64: - PrimitiveArray arrowUlongArray = (PrimitiveArray)arrowArray; - ReadOnlyMemory ulongValueBuffer = arrowUlongArray.ValueBuffer.Memory; - ReadOnlyMemory ulongNullBitMapBuffer = arrowUlongArray.NullBitmapBuffer.Memory; - dataFrameColumn = new UInt64DataFrameColumn(field.Name, ulongValueBuffer, ulongNullBitMapBuffer, arrowArray.Length, arrowArray.NullCount); - break; - case ArrowTypeId.Decimal: - case ArrowTypeId.Binary: - case ArrowTypeId.Date32: - case ArrowTypeId.Date64: - case ArrowTypeId.Dictionary: - case ArrowTypeId.FixedSizedBinary: - case ArrowTypeId.HalfFloat: - case ArrowTypeId.Interval: - case ArrowTypeId.List: - case ArrowTypeId.Map: - case ArrowTypeId.Null: - case ArrowTypeId.Struct: - case ArrowTypeId.Time32: - case ArrowTypeId.Time64: - default: - throw new NotImplementedException(nameof(fieldType.Name)); - } - ret.Columns.Insert(ret.Columns.Count, dataFrameColumn); + AppendDataFrameColumnFromArrowArray(field, arrowArray, ret); fieldIndex++; } return ret; diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 31cb3a435b..80459a2eb7 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -47,7 +47,7 @@ - + diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs b/tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs index 05bda8b18f..1a5db939b2 100644 --- a/tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs +++ b/tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs @@ -26,7 +26,8 @@ public class ArrayComparer : IArrowArrayVisitor, IArrowArrayVisitor, IArrowArrayVisitor, - IArrowArrayVisitor + IArrowArrayVisitor, + IArrowArrayVisitor { private readonly IArrowArray _expectedArray; @@ -54,6 +55,23 @@ public ArrayComparer(IArrowArray expectedArray) public void Visit(BinaryArray array) => throw new NotImplementedException(); public void Visit(IArrowArray array) => throw new NotImplementedException(); + public void Visit(StructArray array) + { + Assert.IsAssignableFrom(_expectedArray); + StructArray expectedArray = (StructArray)_expectedArray; + + Assert.Equal(expectedArray.Length, array.Length); + Assert.Equal(expectedArray.NullCount, array.NullCount); + Assert.Equal(expectedArray.Offset, array.Offset); + Assert.Equal(expectedArray.Data.Children.Length, array.Data.Children.Length); + Assert.Equal(expectedArray.Fields.Count, array.Fields.Count); + + for (int i = 0; i < array.Fields.Count; i++) + { + array.Fields[i].Accept(new ArrayComparer(expectedArray.Fields[i])); + } + } + private void CompareArrays(PrimitiveArray actualArray) where T : struct, IEquatable { @@ -68,15 +86,15 @@ private void CompareArrays(PrimitiveArray actualArray) { Assert.True(expectedArray.NullBitmapBuffer.Span.SequenceEqual(actualArray.NullBitmapBuffer.Span)); } - else - { + else + { // expectedArray may have passed in a null bitmap. DataFrame might have populated it with Length set bits - Assert.Equal(0, expectedArray.NullCount); - Assert.Equal(0, actualArray.NullCount); - for (int i = 0; i < actualArray.Length; i++) - { - Assert.True(actualArray.IsValid(i)); - } + Assert.Equal(0, expectedArray.NullCount); + Assert.Equal(0, actualArray.NullCount); + for (int i = 0; i < actualArray.Length; i++) + { + Assert.True(actualArray.IsValid(i)); + } } Assert.True(expectedArray.Values.Slice(0, expectedArray.Length).SequenceEqual(actualArray.Values.Slice(0, actualArray.Length))); } diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs index c830e61516..7b4b4a9628 100644 --- a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs @@ -8,6 +8,7 @@ using System.Linq; using Apache.Arrow; using Apache.Arrow.Ipc; +using Apache.Arrow.Types; using Xunit; namespace Microsoft.Data.Analysis.Tests @@ -60,6 +61,71 @@ public void TestArrowIntegration() } } + [Fact] + public void TestRecordBatchWithStructArrays() + { + RecordBatch CreateRecordBatch(string prependColumnNamesWith = "") + { + RecordBatch ret = new RecordBatch.Builder() + .Append(prependColumnNamesWith + "Column1", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))) + .Append(prependColumnNamesWith + "Column2", true, new Int32Array( + valueBuffer: new ArrowBuffer.Builder().AppendRange(Enumerable.Range(0, 10)).Build(), + nullBitmapBuffer: new ArrowBuffer.Builder().Append(0xfd).Append(0xff).Build(), + length: 10, + nullCount: 1, + offset: 0)) + .Append(prependColumnNamesWith + "Column3", true, new Int32Array( + valueBuffer: new ArrowBuffer.Builder().AppendRange(Enumerable.Range(0, 10)).Build(), + nullBitmapBuffer: new ArrowBuffer.Builder().Append(0x00).Append(0x00).Build(), + length: 10, + nullCount: 10, + offset: 0)) + .Append(prependColumnNamesWith + "NullableBooleanColumn", true, new BooleanArray( + valueBuffer: new ArrowBuffer.Builder().Append(0xfd).Append(0xff).Build(), + nullBitmapBuffer: new ArrowBuffer.Builder().Append(0xed).Append(0xff).Build(), + length: 10, + nullCount: 2, + offset: 0)) + .Append(prependColumnNamesWith + "StringDataFrameColumn", false, new StringArray.Builder().AppendRange(Enumerable.Range(0, 10).Select(x => x.ToString())).Build()) + .Append(prependColumnNamesWith + "DoubleColumn", false, new DoubleArray.Builder().AppendRange(Enumerable.Repeat(1.0, 10)).Build()) + .Append(prependColumnNamesWith + "FloatColumn", false, new FloatArray.Builder().AppendRange(Enumerable.Repeat(1.0f, 10)).Build()) + .Append(prependColumnNamesWith + "ShortColumn", false, new Int16Array.Builder().AppendRange(Enumerable.Repeat((short)1, 10)).Build()) + .Append(prependColumnNamesWith + "LongColumn", false, new Int64Array.Builder().AppendRange(Enumerable.Repeat((long)1, 10)).Build()) + .Append(prependColumnNamesWith + "UIntColumn", false, new UInt32Array.Builder().AppendRange(Enumerable.Repeat((uint)1, 10)).Build()) + .Append(prependColumnNamesWith + "UShortColumn", false, new UInt16Array.Builder().AppendRange(Enumerable.Repeat((ushort)1, 10)).Build()) + .Append(prependColumnNamesWith + "ULongColumn", false, new UInt64Array.Builder().AppendRange(Enumerable.Repeat((ulong)1, 10)).Build()) + .Append(prependColumnNamesWith + "ByteColumn", false, new Int8Array.Builder().AppendRange(Enumerable.Repeat((sbyte)1, 10)).Build()) + .Append(prependColumnNamesWith + "UByteColumn", false, new UInt8Array.Builder().AppendRange(Enumerable.Repeat((byte)1, 10)).Build()) + .Build(); + + return ret; + } + + RecordBatch originalBatch = CreateRecordBatch(); + ArrowBuffer.BitmapBuilder validityBitmapBuilder = new ArrowBuffer.BitmapBuilder(); + for (int i = 0; i < originalBatch.Length; i++) + { + validityBitmapBuilder.Append(true); + } + ArrowBuffer validityBitmap = validityBitmapBuilder.Build(); + + StructType structType = new StructType(originalBatch.Schema.Fields.Select((KeyValuePair pair) => pair.Value).ToList()); + StructArray structArray = new StructArray(structType, originalBatch.Length, originalBatch.Arrays.Cast(), validityBitmap); + Schema schema = new Schema.Builder().Field(new Field("Struct", structType, false)).Build(); + RecordBatch recordBatch = new RecordBatch(schema, new[] { structArray }, originalBatch.Length); + + DataFrame df = DataFrame.FromArrowRecordBatch(recordBatch); + DataFrameTests.VerifyColumnTypes(df, testArrowStringColumn: true); + + IEnumerable recordBatches = df.ToArrowRecordBatches(); + + RecordBatch expected = CreateRecordBatch("Struct_"); + foreach (RecordBatch batch in recordBatches) + { + RecordBatchComparer.CompareBatches(expected, batch); + } + } + [Fact] public void TestEmptyDataFrameRecordBatch() { From cff30e36ce7c3ea32cde5db85c4de8bb66b5eea6 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 30 Oct 2020 12:06:02 -0700 Subject: [PATCH 45/53] Implement DataFrame.LoadCsvFromString (#2988) * Implement DataFrame.LoadCsvFromString * Address comments --- src/Microsoft.Data.Analysis/DataFrame.IO.cs | 251 ++++++--- .../ArrowIntegrationTests.cs | 4 +- .../DataFrame.IOTests.cs | 509 +++++++++++------- 3 files changed, 469 insertions(+), 295 deletions(-) diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs index 798d62ddf2..eff4c3a90b 100644 --- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs +++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs @@ -3,12 +3,11 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Text; -using Microsoft.ML; namespace Microsoft.Data.Analysis { @@ -77,7 +76,6 @@ private static Type MaxKind(Type a, Type b) /// /// Reads a text file as a DataFrame. - /// Follows pandas API. /// /// filename /// column separator @@ -174,31 +172,12 @@ private static DataFrameColumn CreateColumn(Type kind, string[] columnNames, int return ret; } - /// - /// Reads a seekable stream of CSV data into a DataFrame. - /// Follows pandas API. - /// - /// stream of CSV data to be read in - /// column separator - /// has a header or not - /// column names (can be empty) - /// column types (can be empty) - /// number of rows to read not including the header(if present) - /// number of rows used to guess types - /// add one column with the row index - /// The character encoding. Defaults to UTF8 if not specified - /// - public static DataFrame LoadCsv(Stream csvStream, + private static DataFrame ReadCsvLinesIntoDataFrame(IEnumerable lines, char separator = ',', bool header = true, string[] columnNames = null, Type[] dataTypes = null, - long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false, - Encoding encoding = null) + long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false + ) { - if (!csvStream.CanSeek) - { - throw new ArgumentException(Strings.NonSeekableStream, nameof(csvStream)); - } - if (dataTypes == null && guessRows <= 0) { throw new ArgumentException(string.Format(Strings.ExpectedEitherGuessRowsOrDataTypes, nameof(guessRows), nameof(dataTypes))); @@ -214,87 +193,187 @@ public static DataFrame LoadCsv(Stream csvStream, } List columns; - long streamStart = csvStream.Position; // First pass: schema and number of rows. - using (var streamReader = new StreamReader(csvStream, encoding ?? Encoding.UTF8, detectEncodingFromByteOrderMarks: true, DefaultStreamReaderBufferSize, leaveOpen: true)) + string line = null; + + var enumerator = lines.GetEnumerator(); + while (enumerator.MoveNext()) { - string line = null; - line = streamReader.ReadLine(); - while (line != null) + line = enumerator.Current; + if ((numberOfRowsToRead == -1) || rowline < numberOfRowsToRead) { - if ((numberOfRowsToRead == -1) || rowline < numberOfRowsToRead) + if (linesForGuessType.Count < guessRows || (header && rowline == 0)) { - if (linesForGuessType.Count < guessRows || (header && rowline == 0)) + var spl = line.Split(separator); + if (header && rowline == 0) { - var spl = line.Split(separator); - if (header && rowline == 0) - { - if (columnNames == null) - { - columnNames = spl; - } - } - else + if (columnNames == null) { - linesForGuessType.Add(spl); - numberOfColumns = Math.Max(numberOfColumns, spl.Length); + columnNames = spl; } } + else + { + linesForGuessType.Add(spl); + numberOfColumns = Math.Max(numberOfColumns, spl.Length); + } } - ++rowline; - if (rowline == guessRows || guessRows == 0) - { - break; - } - line = streamReader.ReadLine(); } - - if (rowline == 0) + ++rowline; + if (rowline == guessRows || guessRows == 0) { - throw new FormatException(Strings.EmptyFile); + break; } + } - columns = new List(numberOfColumns); - // Guesses types or looks up dataTypes and adds columns. - for (int i = 0; i < numberOfColumns; ++i) - { - Type kind = dataTypes == null ? GuessKind(i, linesForGuessType) : dataTypes[i]; - columns.Add(CreateColumn(kind, columnNames, i)); - } + if (rowline == 0) + { + throw new FormatException(Strings.EmptyFile); + } - DataFrame ret = new DataFrame(columns); - line = null; - streamReader.DiscardBufferedData(); - streamReader.BaseStream.Seek(streamStart, SeekOrigin.Begin); + columns = new List(numberOfColumns); + // Guesses types or looks up dataTypes and adds columns. + for (int i = 0; i < numberOfColumns; ++i) + { + Type kind = dataTypes == null ? GuessKind(i, linesForGuessType) : dataTypes[i]; + columns.Add(CreateColumn(kind, columnNames, i)); + } + + DataFrame ret = new DataFrame(columns); + line = null; - // Fills values. - line = streamReader.ReadLine(); - rowline = 0; - while (line != null && (numberOfRowsToRead == -1 || rowline < numberOfRowsToRead)) + // Fill values. + enumerator.Reset(); + rowline = 0; + while (enumerator.MoveNext() && (numberOfRowsToRead == -1 || rowline < numberOfRowsToRead)) + { + line = enumerator.Current; + var spl = line.Split(separator); + if (header && rowline == 0) { - var spl = line.Split(separator); - if (header && rowline == 0) - { - // Skips. - } - else - { - ret.Append(spl, inPlace: true); - } - ++rowline; - line = streamReader.ReadLine(); + // Skips. + } + else + { + ret.Append(spl, inPlace: true); } + ++rowline; + } - if (addIndexColumn) + if (addIndexColumn) + { + PrimitiveDataFrameColumn indexColumn = new PrimitiveDataFrameColumn("IndexColumn", columns[0].Length); + for (int i = 0; i < columns[0].Length; i++) { - PrimitiveDataFrameColumn indexColumn = new PrimitiveDataFrameColumn("IndexColumn", columns[0].Length); - for (int i = 0; i < columns[0].Length; i++) - { - indexColumn[i] = i; - } - columns.Insert(0, indexColumn); + indexColumn[i] = i; } - return ret; + columns.Insert(0, indexColumn); + } + return ret; + } + + private class CsvLines : IEnumerable + { + private CsvLineEnumerator enumerator; + public CsvLines(CsvLineEnumerator csvLineEnumerator) + { + enumerator = csvLineEnumerator; + } + + public IEnumerator GetEnumerator() => enumerator; + + IEnumerator IEnumerable.GetEnumerator() => enumerator; + } + + private class CsvLineEnumerator : IEnumerator + { + private StreamReader streamReader; + private string currentLine; + private long streamStartPosition; + public CsvLineEnumerator(StreamReader csvStream) + { + streamStartPosition = csvStream.BaseStream.Position; + streamReader = csvStream; + currentLine = null; + } + + public string Current => currentLine; + + object IEnumerator.Current => currentLine; + + public void Dispose() + { + throw new NotImplementedException(); + } + + public bool MoveNext() + { + currentLine = streamReader.ReadLine(); + return currentLine != null; + } + + public void Reset() + { + streamReader.DiscardBufferedData(); + streamReader.BaseStream.Seek(streamStartPosition, SeekOrigin.Begin); + } + } + + /// + /// Reads CSV data passed in as a string into a DataFrame. + /// + /// csv data passed in as a string + /// column separator + /// has a header or not + /// column names (can be empty) + /// column types (can be empty) + /// number of rows to read not including the header(if present) + /// number of rows used to guess types + /// add one column with the row index + /// + public static DataFrame LoadCsvFromString(string csvString, + char separator = ',', bool header = true, + string[] columnNames = null, Type[] dataTypes = null, + long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false) + { + string[] lines = csvString.Split(new[] { Environment.NewLine }, StringSplitOptions.None); + return ReadCsvLinesIntoDataFrame(lines, separator, header, columnNames, dataTypes, numberOfRowsToRead, guessRows, addIndexColumn); + } + + /// + /// Reads a seekable stream of CSV data into a DataFrame. + /// + /// stream of CSV data to be read in + /// column separator + /// has a header or not + /// column names (can be empty) + /// column types (can be empty) + /// number of rows to read not including the header(if present) + /// number of rows used to guess types + /// add one column with the row index + /// The character encoding. Defaults to UTF8 if not specified + /// + public static DataFrame LoadCsv(Stream csvStream, + char separator = ',', bool header = true, + string[] columnNames = null, Type[] dataTypes = null, + long numberOfRowsToRead = -1, int guessRows = 10, bool addIndexColumn = false, + Encoding encoding = null) + { + if (!csvStream.CanSeek) + { + throw new ArgumentException(Strings.NonSeekableStream, nameof(csvStream)); + } + + if (dataTypes == null && guessRows <= 0) + { + throw new ArgumentException(string.Format(Strings.ExpectedEitherGuessRowsOrDataTypes, nameof(guessRows), nameof(dataTypes))); + } + + using (var streamReader = new StreamReader(csvStream, encoding ?? Encoding.UTF8, detectEncodingFromByteOrderMarks: true, DefaultStreamReaderBufferSize, leaveOpen: true)) + { + CsvLineEnumerator linesEnumerator = new CsvLineEnumerator(streamReader); + IEnumerable lines = new CsvLines(linesEnumerator); + return ReadCsvLinesIntoDataFrame(lines, separator, header, columnNames, dataTypes, numberOfRowsToRead, guessRows, addIndexColumn); } } diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs index 7b4b4a9628..dacf43a8db 100644 --- a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs @@ -51,7 +51,7 @@ public void TestArrowIntegration() .Build(); DataFrame df = DataFrame.FromArrowRecordBatch(originalBatch); - DataFrameTests.VerifyColumnTypes(df, testArrowStringColumn: true); + DataFrameIOTests.VerifyColumnTypes(df, testArrowStringColumn: true); IEnumerable recordBatches = df.ToArrowRecordBatches(); @@ -115,7 +115,7 @@ RecordBatch CreateRecordBatch(string prependColumnNamesWith = "") RecordBatch recordBatch = new RecordBatch(schema, new[] { structArray }, originalBatch.Length); DataFrame df = DataFrame.FromArrowRecordBatch(recordBatch); - DataFrameTests.VerifyColumnTypes(df, testArrowStringColumn: true); + DataFrameIOTests.VerifyColumnTypes(df, testArrowStringColumn: true); IEnumerable recordBatches = df.ToArrowRecordBatches(); diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs index d74e85dc69..9e8ccb6903 100644 --- a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs +++ b/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs @@ -7,12 +7,11 @@ using System.IO; using System.Linq; using System.Text; -using Apache.Arrow; using Xunit; namespace Microsoft.Data.Analysis.Tests { - public partial class DataFrameTests + public class DataFrameIOTests { internal static void VerifyColumnTypes(DataFrame df, bool testArrowStringColumn = false) { @@ -115,17 +114,29 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } + void RegularTest(DataFrame df) + { + Assert.Equal(4, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df.Columns["vendor_id"][3]); + VerifyColumnTypes(df); + } DataFrame df = DataFrame.LoadCsv(GetStream(data)); - Assert.Equal(4, df.Rows.Count); - Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df.Columns["vendor_id"][3]); - VerifyColumnTypes(df); + RegularTest(df); + DataFrame csvDf = DataFrame.LoadCsvFromString(data); + RegularTest(csvDf); + void ReducedRowsTest(DataFrame reducedRows) + { + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); + } DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); - Assert.Equal(3, reducedRows.Rows.Count); - Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); - VerifyColumnTypes(df); + ReducedRowsTest(reducedRows); + csvDf = DataFrame.LoadCsvFromString(data, numberOfRowsToRead: 3); + ReducedRowsTest(csvDf); } [Fact] @@ -140,17 +151,31 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } + void RegularTest(DataFrame df) + { + Assert.Equal(4, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df.Columns["Column0"][3]); + VerifyColumnTypes(df); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data), header: false); - Assert.Equal(4, df.Rows.Count); - Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df.Columns["Column0"][3]); - VerifyColumnTypes(df); + RegularTest(df); + DataFrame csvDf = DataFrame.LoadCsvFromString(data, header: false); + RegularTest(csvDf); + + void ReducedRowsTest(DataFrame reducedRows) + { + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows.Columns["Column0"][2]); + VerifyColumnTypes(df); + } DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), header: false, numberOfRowsToRead: 3); - Assert.Equal(3, reducedRows.Rows.Count); - Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows.Columns["Column0"][2]); - VerifyColumnTypes(df); + ReducedRowsTest(reducedRows); + csvDf = DataFrame.LoadCsvFromString(data, header: false, numberOfRowsToRead: 3); + ReducedRowsTest(csvDf); } void VerifyDataFrameWithNamedColumnsAndDataTypes(DataFrame df, bool verifyColumnDataType, bool verifyNames) @@ -228,6 +253,12 @@ Stream GetStream(string streamData) dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) } ); VerifyDataFrameWithNamedColumnsAndDataTypes(df, verifyColumnDataType: true, verifyNames: header); + DataFrame csvDf = DataFrame.LoadCsvFromString(data, + header: header, + guessRows: guessRows, + dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) } + ); + VerifyDataFrameWithNamedColumnsAndDataTypes(csvDf, verifyColumnDataType: true, verifyNames: header); if (guessRows == 10) { @@ -236,6 +267,10 @@ Stream GetStream(string streamData) guessRows: guessRows ); VerifyDataFrameWithNamedColumnsAndDataTypes(df, verifyColumnDataType: false, verifyNames: header); + csvDf = DataFrame.LoadCsvFromString(data, + header: header, + guessRows: guessRows); + VerifyDataFrameWithNamedColumnsAndDataTypes(csvDf, verifyColumnDataType: false, verifyNames: header); } else { @@ -243,6 +278,10 @@ Stream GetStream(string streamData) header: header, guessRows: guessRows )); + Assert.ThrowsAny(() => DataFrame.LoadCsvFromString(data, + header: header, + guessRows: guessRows + )); } } @@ -260,46 +299,53 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } - DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) }); - Assert.Equal(5, df.Rows.Count); - Assert.Equal(7, df.Columns.Count); + void Verify(DataFrame df) + { + Assert.Equal(5, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); - Assert.True(typeof(string) == df.Columns[0].DataType); - Assert.True(typeof(short) == df.Columns[1].DataType); - Assert.True(typeof(int) == df.Columns[2].DataType); - Assert.True(typeof(long) == df.Columns[3].DataType); - Assert.True(typeof(float) == df.Columns[4].DataType); - Assert.True(typeof(string) == df.Columns[5].DataType); - Assert.True(typeof(double) == df.Columns[6].DataType); + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(short) == df.Columns[1].DataType); + Assert.True(typeof(int) == df.Columns[2].DataType); + Assert.True(typeof(long) == df.Columns[3].DataType); + Assert.True(typeof(float) == df.Columns[4].DataType); + Assert.True(typeof(string) == df.Columns[5].DataType); + Assert.True(typeof(double) == df.Columns[6].DataType); - Assert.Equal("vendor_id", df.Columns[0].Name); - Assert.Equal("rate_code", df.Columns[1].Name); - Assert.Equal("passenger_count", df.Columns[2].Name); - Assert.Equal("trip_time_in_secs", df.Columns[3].Name); - Assert.Equal("trip_distance", df.Columns[4].Name); - Assert.Equal("payment_type", df.Columns[5].Name); - Assert.Equal("fare_amount", df.Columns[6].Name); - VerifyColumnTypes(df); + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + Assert.Equal("trip_distance", df.Columns[4].Name); + Assert.Equal("payment_type", df.Columns[5].Name); + Assert.Equal("fare_amount", df.Columns[6].Name); + VerifyColumnTypes(df); - foreach (var column in df.Columns) - { - if (column.DataType != typeof(string)) - { - Assert.Equal(1, column.NullCount); - } - else + foreach (var column in df.Columns) { - Assert.Equal(0, column.NullCount); + if (column.DataType != typeof(string)) + { + Assert.Equal(1, column.NullCount); + } + else + { + Assert.Equal(0, column.NullCount); + } } + var nullRow = df.Rows[3]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + Assert.Null(nullRow[4]); + Assert.Equal("", nullRow[5]); + Assert.Null(nullRow[6]); } - var nullRow = df.Rows[3]; - Assert.Equal("", nullRow[0]); - Assert.Null(nullRow[1]); - Assert.Null(nullRow[2]); - Assert.Null(nullRow[3]); - Assert.Null(nullRow[4]); - Assert.Equal("", nullRow[5]); - Assert.Null(nullRow[6]); + + DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) }); + Verify(df); + df = DataFrame.LoadCsvFromString(data, dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) }); + Verify(df); } [Fact] @@ -316,27 +362,33 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } - DataFrame df = DataFrame.LoadCsv(GetStream(data), separator: '|'); - - Assert.Equal(5, df.Rows.Count); - Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df.Columns["vendor_id"][4]); - VerifyColumnTypes(df); - - DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: '|', numberOfRowsToRead: 3); - Assert.Equal(3, reducedRows.Rows.Count); - Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); - VerifyColumnTypes(df); + void Verify(DataFrame df) + { + Assert.Equal(5, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df.Columns["vendor_id"][4]); + VerifyColumnTypes(df); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: '|', numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); + + var nullRow = df.Rows[3]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + Assert.Null(nullRow[4]); + Assert.Equal("", nullRow[5]); + Assert.Null(nullRow[6]); + } - var nullRow = df.Rows[3]; - Assert.Equal("", nullRow[0]); - Assert.Null(nullRow[1]); - Assert.Null(nullRow[2]); - Assert.Null(nullRow[3]); - Assert.Null(nullRow[4]); - Assert.Equal("", nullRow[5]); - Assert.Null(nullRow[6]); + DataFrame df = DataFrame.LoadCsv(GetStream(data), separator: '|'); + Verify(df); + df = DataFrame.LoadCsvFromString(data, separator: '|'); + Verify(df); } [Fact] @@ -353,27 +405,33 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } - DataFrame df = DataFrame.LoadCsv(GetStream(data), separator: ';'); - - Assert.Equal(5, df.Rows.Count); - Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df.Columns["vendor_id"][4]); - VerifyColumnTypes(df); - - DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: ';', numberOfRowsToRead: 3); - Assert.Equal(3, reducedRows.Rows.Count); - Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); - VerifyColumnTypes(df); + void Verify(DataFrame df) + { + Assert.Equal(5, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df.Columns["vendor_id"][4]); + VerifyColumnTypes(df); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), separator: ';', numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); + + var nullRow = df.Rows[3]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + Assert.Null(nullRow[4]); + Assert.Equal("", nullRow[5]); + Assert.Null(nullRow[6]); + } - var nullRow = df.Rows[3]; - Assert.Equal("", nullRow[0]); - Assert.Null(nullRow[1]); - Assert.Null(nullRow[2]); - Assert.Null(nullRow[3]); - Assert.Null(nullRow[4]); - Assert.Equal("", nullRow[5]); - Assert.Null(nullRow[6]); + DataFrame df = DataFrame.LoadCsv(GetStream(data), separator: ';'); + Verify(df); + df = DataFrame.LoadCsvFromString(data, separator: ';'); + Verify(df); } [Fact] @@ -389,18 +447,24 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } - DataFrame df = DataFrame.LoadCsv(GetStream(data)); - - Assert.Equal(4, df.Rows.Count); - Assert.Equal(7, df.Columns.Count); - Assert.Equal("CMT", df.Columns["vendor_id"][3]); - VerifyColumnTypes(df); + void Verify(DataFrame df) + { + Assert.Equal(4, df.Rows.Count); + Assert.Equal(7, df.Columns.Count); + Assert.Equal("CMT", df.Columns["vendor_id"][3]); + VerifyColumnTypes(df); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(7, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); + } - DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); - Assert.Equal(3, reducedRows.Rows.Count); - Assert.Equal(7, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); - VerifyColumnTypes(df); + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Verify(df); + df = DataFrame.LoadCsvFromString(data); + Verify(df); } [Fact] @@ -418,6 +482,7 @@ Stream GetStream(string streamData) } Assert.Throws(() => DataFrame.LoadCsv(GetStream(data))); + Assert.Throws(() => DataFrame.LoadCsvFromString(data)); } [Fact] @@ -434,18 +499,24 @@ Stream GetStream(string streamData) return new MemoryStream(Encoding.Default.GetBytes(streamData)); } - DataFrame df = DataFrame.LoadCsv(GetStream(data)); - Assert.Equal(4, df.Rows.Count); - Assert.Equal(6, df.Columns.Count); - Assert.Equal("CMT", df.Columns["vendor_id"][3]); - VerifyColumnTypes(df); - - DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); - Assert.Equal(3, reducedRows.Rows.Count); - Assert.Equal(6, reducedRows.Columns.Count); - Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); - VerifyColumnTypes(df); + void Verify(DataFrame df) + { + Assert.Equal(4, df.Rows.Count); + Assert.Equal(6, df.Columns.Count); + Assert.Equal("CMT", df.Columns["vendor_id"][3]); + VerifyColumnTypes(df); + + DataFrame reducedRows = DataFrame.LoadCsv(GetStream(data), numberOfRowsToRead: 3); + Assert.Equal(3, reducedRows.Rows.Count); + Assert.Equal(6, reducedRows.Columns.Count); + Assert.Equal("CMT", reducedRows.Columns["vendor_id"][2]); + VerifyColumnTypes(df); + } + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Verify(df); + df = DataFrame.LoadCsvFromString(data); + Verify(df); } [Fact] @@ -463,29 +534,37 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } - DataFrame df = DataFrame.LoadCsv(GetStream(data)); - Assert.Equal(6, df.Rows.Count); - Assert.Equal(4, df.Columns.Count); - Assert.True(typeof(string) == df.Columns[0].DataType); - Assert.True(typeof(string) == df.Columns[1].DataType); - Assert.True(typeof(string) == df.Columns[2].DataType); - Assert.True(typeof(string) == df.Columns[3].DataType); + void Verify(DataFrame df) + { + Assert.Equal(6, df.Rows.Count); + Assert.Equal(4, df.Columns.Count); - Assert.Equal("vendor_id", df.Columns[0].Name); - Assert.Equal("rate_code", df.Columns[1].Name); - Assert.Equal("passenger_count", df.Columns[2].Name); - Assert.Equal("trip_time_in_secs", df.Columns[3].Name); - VerifyColumnTypes(df); + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(string) == df.Columns[1].DataType); + Assert.True(typeof(string) == df.Columns[2].DataType); + Assert.True(typeof(string) == df.Columns[3].DataType); - foreach (var column in df.Columns) - { - Assert.Equal(6, column.NullCount); - foreach (var value in column) + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + VerifyColumnTypes(df); + + foreach (var column in df.Columns) { - Assert.Null(value); + Assert.Equal(6, column.NullCount); + foreach (var value in column) + { + Assert.Null(value); + } } } + + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Verify(df); + df = DataFrame.LoadCsvFromString(data); + Verify(df); } [Fact] @@ -503,48 +582,56 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } - DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long) }); - Assert.Equal(6, df.Rows.Count); - Assert.Equal(4, df.Columns.Count); - Assert.True(typeof(string) == df.Columns[0].DataType); - Assert.True(typeof(short) == df.Columns[1].DataType); - Assert.True(typeof(int) == df.Columns[2].DataType); - Assert.True(typeof(long) == df.Columns[3].DataType); + void Verify(DataFrame df) + { + Assert.Equal(6, df.Rows.Count); + Assert.Equal(4, df.Columns.Count); - Assert.Equal("vendor_id", df.Columns[0].Name); - Assert.Equal("rate_code", df.Columns[1].Name); - Assert.Equal("passenger_count", df.Columns[2].Name); - Assert.Equal("trip_time_in_secs", df.Columns[3].Name); - VerifyColumnTypes(df); + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(short) == df.Columns[1].DataType); + Assert.True(typeof(int) == df.Columns[2].DataType); + Assert.True(typeof(long) == df.Columns[3].DataType); - foreach (var column in df.Columns) - { - if (column.DataType != typeof(string)) - { - Assert.Equal(3, column.NullCount); - } - else + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + VerifyColumnTypes(df); + + foreach (var column in df.Columns) { - Assert.Equal(2, column.NullCount); + if (column.DataType != typeof(string)) + { + Assert.Equal(3, column.NullCount); + } + else + { + Assert.Equal(2, column.NullCount); + } } + var nullRow = df.Rows[3]; + Assert.Null(nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + + nullRow = df.Rows[4]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + + Assert.Null(df[0, 0]); + Assert.Null(df[1, 1]); + Assert.Null(df[2, 2]); + Assert.Null(df[5, 3]); } - var nullRow = df.Rows[3]; - Assert.Null(nullRow[0]); - Assert.Null(nullRow[1]); - Assert.Null(nullRow[2]); - Assert.Null(nullRow[3]); - nullRow = df.Rows[4]; - Assert.Equal("", nullRow[0]); - Assert.Null(nullRow[1]); - Assert.Null(nullRow[2]); - Assert.Null(nullRow[3]); - - Assert.Null(df[0, 0]); - Assert.Null(df[1, 1]); - Assert.Null(df[2, 2]); - Assert.Null(df[5, 3]); + DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long) }); + Verify(df); + df = DataFrame.LoadCsvFromString(data, dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long) }); + Verify(df); } [Fact] @@ -562,55 +649,63 @@ Stream GetStream(string streamData) { return new MemoryStream(Encoding.Default.GetBytes(streamData)); } - DataFrame df = DataFrame.LoadCsv(GetStream(data)); - Assert.Equal(6, df.Rows.Count); - Assert.Equal(4, df.Columns.Count); - Assert.True(typeof(string) == df.Columns[0].DataType); - Assert.True(typeof(float) == df.Columns[1].DataType); - Assert.True(typeof(float) == df.Columns[2].DataType); - Assert.True(typeof(float) == df.Columns[3].DataType); + void Verify(DataFrame df) + { + Assert.Equal(6, df.Rows.Count); + Assert.Equal(4, df.Columns.Count); - Assert.Equal("vendor_id", df.Columns[0].Name); - Assert.Equal("rate_code", df.Columns[1].Name); - Assert.Equal("passenger_count", df.Columns[2].Name); - Assert.Equal("trip_time_in_secs", df.Columns[3].Name); - VerifyColumnTypes(df); + Assert.True(typeof(string) == df.Columns[0].DataType); + Assert.True(typeof(float) == df.Columns[1].DataType); + Assert.True(typeof(float) == df.Columns[2].DataType); + Assert.True(typeof(float) == df.Columns[3].DataType); - foreach (var column in df.Columns) - { - if (column.DataType != typeof(string)) - { - Assert.Equal(3, column.NullCount); - } - else + Assert.Equal("vendor_id", df.Columns[0].Name); + Assert.Equal("rate_code", df.Columns[1].Name); + Assert.Equal("passenger_count", df.Columns[2].Name); + Assert.Equal("trip_time_in_secs", df.Columns[3].Name); + VerifyColumnTypes(df); + + foreach (var column in df.Columns) { - Assert.Equal(2, column.NullCount); + if (column.DataType != typeof(string)) + { + Assert.Equal(3, column.NullCount); + } + else + { + Assert.Equal(2, column.NullCount); + } } + var nullRow = df.Rows[3]; + Assert.Null(nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + + nullRow = df.Rows[4]; + Assert.Equal("", nullRow[0]); + Assert.Null(nullRow[1]); + Assert.Null(nullRow[2]); + Assert.Null(nullRow[3]); + + Assert.Null(df[0, 0]); + Assert.Null(df[1, 1]); + Assert.Null(df[2, 2]); + Assert.Null(df[5, 3]); } - var nullRow = df.Rows[3]; - Assert.Null(nullRow[0]); - Assert.Null(nullRow[1]); - Assert.Null(nullRow[2]); - Assert.Null(nullRow[3]); - nullRow = df.Rows[4]; - Assert.Equal("", nullRow[0]); - Assert.Null(nullRow[1]); - Assert.Null(nullRow[2]); - Assert.Null(nullRow[3]); - - Assert.Null(df[0, 0]); - Assert.Null(df[1, 1]); - Assert.Null(df[2, 2]); - Assert.Null(df[5, 3]); + DataFrame df = DataFrame.LoadCsv(GetStream(data)); + Verify(df); + df = DataFrame.LoadCsvFromString(data); + Verify(df); } [Fact] public void TestWriteCsvWithHeader() { using MemoryStream csvStream = new MemoryStream(); - DataFrame dataFrame = MakeDataFrameWithAllColumnTypes(10, true); + DataFrame dataFrame = DataFrameTests.MakeDataFrameWithAllColumnTypes(10, true); DataFrame.WriteCsv(dataFrame, csvStream); @@ -635,7 +730,7 @@ public void TestWriteCsvWithHeader() [Fact] public void TestWriteCsvWithCultureInfoRomanianAndSemiColon() { - DataFrame dataFrame = MakeDataFrameWithNumericColumns(10, true); + DataFrame dataFrame = DataFrameTests.MakeDataFrameWithNumericColumns(10, true); dataFrame[1, 1] = 1.1M; dataFrame[1, 2] = 1.2D; dataFrame[1, 3] = 1.3F; @@ -670,7 +765,7 @@ public void TestWriteCsvWithCultureInfoRomanianAndSemiColon() public void TestWriteCsvWithCultureInfo() { using MemoryStream csvStream = new MemoryStream(); - DataFrame dataFrame = MakeDataFrameWithNumericColumns(10, true); + DataFrame dataFrame = DataFrameTests.MakeDataFrameWithNumericColumns(10, true); dataFrame[1, 1] = 1.1M; dataFrame[1, 2] = 1.2D; dataFrame[1, 3] = 1.3F; @@ -700,7 +795,7 @@ public void TestWriteCsvWithCultureInfo() public void TestWriteCsvWithCultureInfoRomanianAndComma() { using MemoryStream csvStream = new MemoryStream(); - DataFrame dataFrame = MakeDataFrameWithNumericColumns(10, true); + DataFrame dataFrame = DataFrameTests.MakeDataFrameWithNumericColumns(10, true); var cultureInfo = new CultureInfo("ro-RO"); var separator = cultureInfo.NumberFormat.NumberDecimalSeparator.First(); @@ -712,7 +807,7 @@ public void TestWriteCsvWithCultureInfoRomanianAndComma() public void TestWriteCsvWithNoHeader() { using MemoryStream csvStream = new MemoryStream(); - DataFrame dataFrame = MakeDataFrameWithAllColumnTypes(10, true); + DataFrame dataFrame = DataFrameTests.MakeDataFrameWithAllColumnTypes(10, true); DataFrame.WriteCsv(dataFrame, csvStream, header: false); @@ -738,7 +833,7 @@ public void TestWriteCsvWithNoHeader() public void TestWriteCsvWithSemicolonSeparator() { using MemoryStream csvStream = new MemoryStream(); - DataFrame dataFrame = MakeDataFrameWithAllColumnTypes(10, true); + DataFrame dataFrame = DataFrameTests.MakeDataFrameWithAllColumnTypes(10, true); var separator = ';'; DataFrame.WriteCsv(dataFrame, csvStream, separator: separator); From e7a9c42f2c36ee25924d8b47187881f4399ab11f Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Thu, 3 Dec 2020 14:21:57 -0800 Subject: [PATCH 46/53] Part 1 of porting the csv reader (#2997) --- .../TextFieldParser.cs | 614 ++++++++++++++++++ .../TextFieldParserTests.cs | 168 +++++ 2 files changed, 782 insertions(+) create mode 100644 src/Microsoft.Data.Analysis/TextFieldParser.cs create mode 100644 tests/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs diff --git a/src/Microsoft.Data.Analysis/TextFieldParser.cs b/src/Microsoft.Data.Analysis/TextFieldParser.cs new file mode 100644 index 0000000000..33d7851b21 --- /dev/null +++ b/src/Microsoft.Data.Analysis/TextFieldParser.cs @@ -0,0 +1,614 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Runtime.CompilerServices; +using System.Text; +using System.Text.RegularExpressions; + +[assembly: InternalsVisibleTo("Microsoft.Data.Analysis.Tests, PublicKey= 0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] + +namespace Microsoft.Data.Analysis +{ + internal enum FieldType + { + Delimited, + FixedWidth + } + + internal class TextFieldParser : IDisposable + { + private delegate int ChangeBufferFunction(); + + private bool _disposed; + + private TextReader _reader; + + private string[] _commentTokens = null; + + private long _lineNumber = 1; + + private bool _endOfData; + + private string _errorLine = ""; + + private long _errorLineNumber = -1; + + private FieldType _textFieldType = FieldType.Delimited; + + private int[] _fieldWidths; + + private int[] _fieldWidthsCopy; + + private string[] _delimiters; + + private string[] _delimitersCopy; + + private Regex _whiteSpaceRegEx = new Regex("\\s", RegexOptions.CultureInvariant); + + private bool _trimWhiteSpace = true; + + private int _position; + + private int _peekPosition; + + private int _charsRead; + + private const int DEFAULT_BUFFER_LENGTH = 4096; + + private char[] _buffer = new char[DEFAULT_BUFFER_LENGTH]; + + private bool _hasFieldsEnclosedInQuotes = true; + + private int _maxBufferSize = 10000000; + + private bool _leaveOpen; + + private char[] newLineChars = Environment.NewLine.ToCharArray(); + + public string[] CommentTokens + { + get => _commentTokens; + set + { + CheckCommentTokensForWhitespace(value); + _commentTokens = value; + } + } + + public bool EndOfData + { + get + { + if (_endOfData) + { + return _endOfData; + } + if ((_reader == null) | (_buffer == null)) + { + _endOfData = true; + return true; + } + if (PeekNextDataLine() != null) + { + return false; + } + _endOfData = true; + return true; + } + } + + public long LineNumber + { + get + { + if (_lineNumber != -1 && ((_reader.Peek() == -1) & (_position == _charsRead))) + { + // Side effect of a property. Not great. Just leaving it in for now. + CloseReader(); + } + return _lineNumber; + } + } + + public string ErrorLine => _errorLine; + + public long ErrorLineNumber => _errorLineNumber; + + public FieldType TextFieldType + { + get =>_textFieldType; + set + { + ValidateFieldTypeEnumValue(value, "value"); + _textFieldType = value; + } + } + + public int[] FieldWidths + { + get =>_fieldWidths; + private set + { + if (value != null) + { + ValidateFieldWidthsOnInput(value); + _fieldWidthsCopy = (int[])value.Clone(); + } + else + { + _fieldWidthsCopy = null; + } + _fieldWidths = value; + } + } + + public string[] Delimiters + { + get => _delimiters; + private set + { + if (value != null) + { + ValidateDelimiters(value); + _delimitersCopy = (string[])value.Clone(); + } + else + { + _delimitersCopy = null; + } + _delimiters = value; + } + } + + public bool TrimWhiteSpace + { + get =>_trimWhiteSpace; + set + { + _trimWhiteSpace = value; + } + } + + public bool HasFieldsEnclosedInQuotes + { + get =>_hasFieldsEnclosedInQuotes; + set + { + _hasFieldsEnclosedInQuotes = value; + } + } + + public TextFieldParser(string path) + { + InitializeFromPath(path, Encoding.ASCII, detectEncoding: true); + } + + public TextFieldParser(string path, Encoding defaultEncoding) + { + InitializeFromPath(path, defaultEncoding, detectEncoding: true); + } + + public TextFieldParser(string path, Encoding defaultEncoding, bool detectEncoding) + { + InitializeFromPath(path, defaultEncoding, detectEncoding); + } + + public TextFieldParser(Stream stream) + { + InitializeFromStream(stream, Encoding.ASCII, detectEncoding: true); + } + + public TextFieldParser(Stream stream, Encoding defaultEncoding) + { + InitializeFromStream(stream, defaultEncoding, detectEncoding: true); + } + + public TextFieldParser(Stream stream, Encoding defaultEncoding, bool detectEncoding) + { + InitializeFromStream(stream, defaultEncoding, detectEncoding); + } + + public TextFieldParser(Stream stream, Encoding defaultEncoding, bool detectEncoding, bool leaveOpen) + { + _leaveOpen = leaveOpen; + InitializeFromStream(stream, defaultEncoding, detectEncoding); + } + + public TextFieldParser(TextReader reader) + { + _reader = reader ?? throw new ArgumentNullException(nameof(reader)); + ReadToBuffer(); + } + + public void SetDelimiters(params string[] delimiters) + { + Delimiters = delimiters; + } + + public void SetFieldWidths(params int[] fieldWidths) + { + FieldWidths = fieldWidths; + } + + + public string ReadLine() + { + if ((_reader == null) | (_buffer == null)) + { + return null; + } + + ChangeBufferFunction BufferFunction = ReadToBuffer; + string line = ReadNextLine(ref _position, BufferFunction); + if (line == null) + { + FinishReading(); + return null; + } + + _lineNumber++; + return line.TrimEnd(newLineChars); + } + + /// + /// Peek at characters of the next data line without reading the line + /// + ///The number of characters to look at in the next data line. + ///A string consisting of the first characters of the next line. >If numberOfChars is greater than the next line, only the next line is returned + public string PeekChars(int numberOfChars) + { + if (numberOfChars <= 0) + { + throw new ArgumentException($"{nameof(numberOfChars)} must be greater than 0"); + } + + if ((_reader == null) | (_buffer == null)) + { + return null; + } + + if (_endOfData) + { + return null; + } + + string line = PeekNextDataLine(); + if (line == null) + { + _endOfData = true; + return null; + } + + line = line.TrimEnd(newLineChars); + if (line.Length < numberOfChars) + { + return line; + } + + return line.Substring(0, numberOfChars); + } + + + public string ReadToEnd() + { + if ((_reader == null) | (_buffer == null)) + { + return null; + } + StringBuilder builder = new StringBuilder(_buffer.Length); + builder.Append(_buffer, _position, _charsRead - _position); + builder.Append(_reader.ReadToEnd()); + FinishReading(); + return builder.ToString(); + } + + public void Close() + { + CloseReader(); + } + + public void Dispose() + { + Dispose(disposing: true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + if (!_disposed) + { + Close(); + } + _disposed = true; + } + } + + private void ValidateFieldTypeEnumValue(FieldType value, string paramName) + { + if (value < FieldType.Delimited || value > FieldType.FixedWidth) + { + throw new InvalidEnumArgumentException(paramName, (int)value, typeof(FieldType)); + } + } + + private void CloseReader() + { + FinishReading(); + if (_reader != null) + { + if (!_leaveOpen) + { + _reader.Close(); + } + _reader = null; + } + } + + private void FinishReading() + { + _lineNumber = -1L; + _endOfData = true; + _buffer = null; + } + + private void InitializeFromPath(string path, Encoding defaultEncoding, bool detectEncoding) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + if (defaultEncoding == null) + { + throw new ArgumentNullException(nameof(defaultEncoding)); + } + string fullPath = ValidatePath(path); + FileStream fileStreamTemp = new FileStream(fullPath, (FileMode.Open), (FileAccess.Read), (FileShare.ReadWrite)); + _reader = new StreamReader(fileStreamTemp, defaultEncoding, detectEncoding); + ReadToBuffer(); + } + + private void InitializeFromStream(Stream stream, Encoding defaultEncoding, bool detectEncoding) + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + if (!stream.CanRead) + { + throw new ArgumentException("stream can't read"); + } + if (defaultEncoding == null) + { + throw new ArgumentNullException(nameof(defaultEncoding)); + } + _reader = new StreamReader(stream, defaultEncoding, detectEncoding); + ReadToBuffer(); + } + + private string ValidatePath(string path) + { + if (!File.Exists(path)) + { + throw new FileNotFoundException($"{path} not found."); + } + return path; + } + + private bool IgnoreLine(string line) + { + if (line == null) + { + return false; + } + string trimmedLine = line.Trim(); + if (trimmedLine.Length == 0) + { + return true; + } + if (_commentTokens != null) + { + string[] commentTokens = _commentTokens; + foreach (string Token in commentTokens) + { + if (Token == string.Empty) + { + continue; + } + if (trimmedLine.StartsWith(Token, StringComparison.Ordinal)) + { + return true; + } + if (line.StartsWith(Token, StringComparison.Ordinal)) + { + return true; + } + } + } + return false; + } + + private int ReadToBuffer() + { + Debug.Assert(_buffer != null, "There's no buffer"); + Debug.Assert(_reader != null, "There's no StreamReader"); + _position = 0; + int BufferLength = _buffer.Length; + Debug.Assert(BufferLength >= DEFAULT_BUFFER_LENGTH, "Buffer shrunk to below default"); + if (BufferLength > DEFAULT_BUFFER_LENGTH) + { + BufferLength = DEFAULT_BUFFER_LENGTH; + _buffer = new char[BufferLength]; + } + _charsRead = _reader.Read(_buffer, 0, BufferLength); + return _charsRead; + } + + private int SlideCursorToStartOfBuffer() + { + Debug.Assert(_buffer != null, "There's no buffer"); + Debug.Assert(_reader != null, "There's no StreamReader"); + Debug.Assert((_position >= 0) & (_position <= _buffer.Length), "The cursor is out of range"); + if (_position > 0) + { + int bufferLength = _buffer.Length; + char[] tempArray = new char[bufferLength]; + Array.Copy(_buffer, _position, tempArray, 0, bufferLength - _position); + int charsRead = _reader.Read(tempArray, bufferLength - _position, _position); + _charsRead = _charsRead - _position + charsRead; + _position = 0; + _buffer = tempArray; + return charsRead; + } + return 0; + } + + private int IncreaseBufferSize() + { + Debug.Assert(_buffer != null, "There's no buffer"); + Debug.Assert(_reader != null, "There's no StreamReader"); + _peekPosition = _charsRead; + int bufferSize = _buffer.Length + DEFAULT_BUFFER_LENGTH; + if (bufferSize > _maxBufferSize) + { + throw new Exception("Exceeded maximum buffer size"); + } + char[] tempArray = new char[bufferSize]; + Array.Copy(_buffer, tempArray, _buffer.Length); + int charsRead = _reader.Read(tempArray, _buffer.Length, DEFAULT_BUFFER_LENGTH); + _buffer = tempArray; + _charsRead += charsRead; + Debug.Assert(_charsRead <= bufferSize, "We've read more chars than we have space for"); + return charsRead; + } + + private string PeekNextDataLine() + { + ChangeBufferFunction BufferFunction = IncreaseBufferSize; + SlideCursorToStartOfBuffer(); + _peekPosition = 0; + string line; + do + { + line = ReadNextLine(ref _peekPosition, BufferFunction); + } + while (IgnoreLine(line)); + return line; + } + + private string ReadNextLine(ref int cursor, ChangeBufferFunction changeBuffer) + { + Debug.Assert(_buffer != null, "There's no buffer"); + Debug.Assert((cursor >= 0) & (cursor <= _charsRead), "The cursor is out of range"); + if (cursor == _charsRead && changeBuffer() == 0) + { + return null; + } + StringBuilder Builder = null; + // Consider replacing this do-while with a string search to take advantage of vectorization + do + { + for (int i = cursor; i <= _charsRead - 1; i++) + { + char Character = _buffer[i]; + if (!(Character.Equals('\r') | Character.Equals('\n'))) + { + continue; + } + if (Builder != null) + { + Builder.Append(_buffer, cursor, i - cursor + 1); + } + else + { + Builder = new StringBuilder(i + 1); + Builder.Append(_buffer, cursor, i - cursor + 1); + } + cursor = i + 1; + if (Character.Equals('\r')) + { + if (cursor < _charsRead) + { + if (_buffer[cursor].Equals('\n')) + { + cursor++; + Builder.Append("\n"); + } + } + else if (changeBuffer() > 0 && _buffer[cursor].Equals('\n')) + { + cursor++; + Builder.Append("\n"); + } + } + return Builder.ToString(); + } + + // Searched the whole buffer and haven't found an end of line. Save what we have and read more to the buffer + int Size = _charsRead - cursor; + if (Builder == null) + { + Builder = new StringBuilder(Size + 10); + } + Builder.Append(_buffer, cursor, Size); + } + while (changeBuffer() > 0); + + return Builder.ToString(); + } + + private void ValidateFieldWidthsOnInput(int[] widths) + { + Debug.Assert(widths != null, "There are no field widths"); + int bound = widths.Length - 1; + for (int i = 0; i <= bound - 1; i++) + { + if (widths[i] < 1) + { + throw new ArgumentException("All field widths, except the last element, must be greater than zero. A field width less than or equal to zero in the last element indicates the last field is of variable length."); + } + } + } + + private void ValidateDelimiters(string[] delimiterArray) + { + if (delimiterArray == null) + { + return; + } + foreach (string delimiter in delimiterArray) + { + if (delimiter == string.Empty) + { + throw new Exception("Delimiter cannot be empty"); + } + if (delimiter.IndexOfAny(newLineChars) > -1) + { + throw new Exception("Delimiter cannot be new line characters"); + } + } + } + + private void CheckCommentTokensForWhitespace(string[] tokens) + { + if (tokens == null) + { + return; + } + foreach (string token in tokens) + { + if (token.Length == 1 && char.IsWhiteSpace(token[0])) + { + throw new Exception("Comment token cannot contain whitespace"); + } + } + } + } +} diff --git a/tests/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs b/tests/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs new file mode 100644 index 0000000000..96ac2d4787 --- /dev/null +++ b/tests/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs @@ -0,0 +1,168 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.IO; +using System.Text; +using Xunit; + +namespace Microsoft.Data.Analysis.Tests +{ + public class TextFieldParserTests + { + private Stream GetStream(string streamData) + { + return new MemoryStream(Encoding.Default.GetBytes(streamData)); + } + + [Fact] + public void Constructors() + { + string data = @"abc123"; + + // public TextFieldParser(System.IO.Stream stream) + using (var stream = GetStream(data)) + { + using (var parser = new TextFieldParser(stream)) + { + } + Assert.Throws(() => stream.ReadByte()); + } + + // public TextFieldParser(System.IO.Stream stream, System.Text.Encoding defaultEncoding, bool detectEncoding, bool leaveOpen); + using (var stream = GetStream(data)) + { + using (var parser = new TextFieldParser(stream, defaultEncoding: Encoding.Unicode, detectEncoding: true, leaveOpen: true)) + { + } + _ = stream.ReadByte(); + } + + // public TextFieldParser(System.IO.TextReader reader) + using (var reader = new StreamReader(GetStream(data))) + { + using (var parser = new TextFieldParser(reader)) + { + } + Assert.Throws(() => reader.ReadToEnd()); + } + } + + [Fact] + public void Close() + { + string data = @"abc123"; + using (var stream = GetStream(data)) + { + using (var parser = new TextFieldParser(stream)) + { + parser.Close(); + } + } + + using (var parser = new TextFieldParser(GetStream(data))) + { + parser.Close(); + } + + { + var parser = new TextFieldParser(GetStream(data)); + parser.Close(); + parser.Close(); + } + + { + TextFieldParser parser; + using (parser = new TextFieldParser(GetStream(data))) + { + } + parser.Close(); + } + } + + [Fact] + public void Properties() + { + + string data = @"abc123"; + + using (var parser = new TextFieldParser(GetStream(data))) + { + Assert.Null(parser.CommentTokens); + parser.CommentTokens = new[] { "[", "]" }; + Assert.Equal(new[] { "[", "]" }, parser.CommentTokens); + + Assert.Null(parser.Delimiters); + parser.SetDelimiters(new[] { "A", "123" }); + Assert.Equal(new[] { "A", "123" }, parser.Delimiters); + parser.SetDelimiters(new[] { "123", "B" }); + Assert.Equal(new[] { "123", "B" }, parser.Delimiters); + + Assert.Null(parser.FieldWidths); + parser.SetFieldWidths(new[] { 1, 2, int.MaxValue }); + Assert.Equal(new[] { 1, 2, int.MaxValue }, parser.FieldWidths); + parser.SetFieldWidths(new[] { int.MaxValue, 3 }); + Assert.Equal(new[] { int.MaxValue, 3 }, parser.FieldWidths); + Assert.Throws(() => parser.SetFieldWidths(new[] { -1, -1 })); + + Assert.True(parser.HasFieldsEnclosedInQuotes); + parser.HasFieldsEnclosedInQuotes = false; + Assert.False(parser.HasFieldsEnclosedInQuotes); + + Assert.Equal(FieldType.Delimited, parser.TextFieldType); + parser.TextFieldType = FieldType.FixedWidth; + Assert.Equal(FieldType.FixedWidth, parser.TextFieldType); + + Assert.True(parser.TrimWhiteSpace); + parser.TrimWhiteSpace = false; + Assert.False(parser.TrimWhiteSpace); + } + } + + [Fact] + public void ReadLine_ReadToEnd() + { + string data = @"abc +123"; + + using (var parser = new TextFieldParser(GetStream(data))) + { + Assert.False(parser.EndOfData); + + Assert.Equal( +@"abc +123", + parser.ReadToEnd()); + Assert.Equal(-1, parser.LineNumber); + Assert.True(parser.EndOfData); + } + + using (var parser = new TextFieldParser(GetStream(data))) + { + Assert.Equal("abc", parser.ReadLine()); + Assert.Equal(2, parser.LineNumber); + Assert.False(parser.EndOfData); + + Assert.Equal("123", parser.ReadToEnd()); + Assert.Equal(-1, parser.LineNumber); + Assert.True(parser.EndOfData); + } + + using (var parser = new TextFieldParser(GetStream(data))) + { + Assert.Equal("abc", parser.ReadLine()); + Assert.Equal(2, parser.LineNumber); + Assert.False(parser.EndOfData); + + Assert.Equal("123", parser.ReadLine()); + Assert.Equal(-1, parser.LineNumber); + Assert.True(parser.EndOfData); + + Assert.Null(parser.ReadToEnd()); + Assert.Equal(-1, parser.LineNumber); + Assert.True(parser.EndOfData); + } + } + } +} From 1c1c3a86ece35eb5c571551e29d5c49ae08ceece Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Tue, 2 Mar 2021 17:56:05 -0800 Subject: [PATCH 47/53] Move to the test folder --- .../DataFrameInteractiveTests.cs | 0 .../Microsoft.Data.Analysis.Interactive.Tests.csproj | 0 {tests => test}/Microsoft.Data.Analysis.Tests/ArrayComparer.cs | 0 .../Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs | 0 {tests => test}/Microsoft.Data.Analysis.Tests/BufferTests.cs | 0 .../Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs | 0 .../DataFrameColumn.BinaryOperationTests.cs | 0 .../DataFrameColumn.BinaryOperationTests.tt | 0 .../Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs | 0 {tests => test}/Microsoft.Data.Analysis.Tests/DataFrameTests.cs | 0 .../Microsoft.Data.Analysis.Tests.csproj | 0 .../Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {tests => test}/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs (100%) rename {tests => test}/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/ArrayComparer.cs (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/BufferTests.cs (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/DataFrameTests.cs (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj (100%) rename {tests => test}/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs (100%) diff --git a/tests/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs b/test/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs rename to test/Microsoft.Data.Analysis.Interactive.Tests/DataFrameInteractiveTests.cs diff --git a/tests/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj b/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj similarity index 100% rename from tests/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj rename to test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs b/test/Microsoft.Data.Analysis.Tests/ArrayComparer.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/ArrayComparer.cs rename to test/Microsoft.Data.Analysis.Tests/ArrayComparer.cs diff --git a/tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs b/test/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs rename to test/Microsoft.Data.Analysis.Tests/ArrowIntegrationTests.cs diff --git a/tests/Microsoft.Data.Analysis.Tests/BufferTests.cs b/test/Microsoft.Data.Analysis.Tests/BufferTests.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/BufferTests.cs rename to test/Microsoft.Data.Analysis.Tests/BufferTests.cs diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs b/test/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs rename to test/Microsoft.Data.Analysis.Tests/DataFrame.IOTests.cs diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs b/test/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs rename to test/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.cs diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt b/test/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt rename to test/Microsoft.Data.Analysis.Tests/DataFrameColumn.BinaryOperationTests.tt diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs b/test/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs rename to test/Microsoft.Data.Analysis.Tests/DataFrameTests.IDataView.cs diff --git a/tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/test/Microsoft.Data.Analysis.Tests/DataFrameTests.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/DataFrameTests.cs rename to test/Microsoft.Data.Analysis.Tests/DataFrameTests.cs diff --git a/tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj rename to test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj diff --git a/tests/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs b/test/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs similarity index 100% rename from tests/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs rename to test/Microsoft.Data.Analysis.Tests/TextFieldParserTests.cs From fea6bd2104a4cbd9ece54fb87f0523fff13751f8 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 3 Mar 2021 12:00:53 -0800 Subject: [PATCH 48/53] Suppress warnings --- Microsoft.ML.sln | 108 ++++ ...Microsoft.Data.Analysis.Interactive.csproj | 33 +- .../Microsoft.Data.Analysis.csproj | 479 +++++++++--------- .../TextFieldParser.cs | 2 - ...oft.Data.Analysis.Interactive.Tests.csproj | 24 +- .../DataFrameTests.cs | 2 +- .../Microsoft.Data.Analysis.Tests.csproj | 56 +- 7 files changed, 408 insertions(+), 296 deletions(-) diff --git a/Microsoft.ML.sln b/Microsoft.ML.sln index cc03c5583c..e52f9d2014 100644 --- a/Microsoft.ML.sln +++ b/Microsoft.ML.sln @@ -141,6 +141,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML", "src\Microso EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Mkl.Redist", "src\Microsoft.ML.Mkl.Redist\Microsoft.ML.Mkl.Redist.csproj", "{4584326B-C5B3-4CAE-B98A-34C5F5AA16F3}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Data.Analysis", "src\Microsoft.Data.Analysis\Microsoft.Data.Analysis.csproj", "{84150C22-0627-4A11-81C9-F214762855EA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Data.Analysis.Interactive", "src\Microsoft.Data.Analysis.Interactive\Microsoft.Data.Analysis.Interactive.csproj", "{D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Data.Analysis.Tests", "test\Microsoft.Data.Analysis.Tests\Microsoft.Data.Analysis.Tests.csproj", "{0B765344-11A4-4738-9759-5060599DC134}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Data.Analysis.Interactive.Tests", "test\Microsoft.Data.Analysis.Interactive.Tests\Microsoft.Data.Analysis.Interactive.Tests.csproj", "{8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1680,6 +1688,102 @@ Global {4584326B-C5B3-4CAE-B98A-34C5F5AA16F3}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU {4584326B-C5B3-4CAE-B98A-34C5F5AA16F3}.Release-netfx|x64.ActiveCfg = Release-netfx|Any CPU {4584326B-C5B3-4CAE-B98A-34C5F5AA16F3}.Release-netfx|x64.Build.0 = Release-netfx|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug|x64.ActiveCfg = Debug|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug|x64.Build.0 = Debug|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug-netcoreapp3_1|Any CPU.ActiveCfg = Debug-netcoreapp3_1|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug-netcoreapp3_1|Any CPU.Build.0 = Debug-netcoreapp3_1|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug-netcoreapp3_1|x64.ActiveCfg = Debug-netcoreapp3_1|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug-netcoreapp3_1|x64.Build.0 = Debug-netcoreapp3_1|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug-netfx|Any CPU.ActiveCfg = Debug-netfx|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug-netfx|Any CPU.Build.0 = Debug-netfx|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug-netfx|x64.ActiveCfg = Debug-netfx|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Debug-netfx|x64.Build.0 = Debug-netfx|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release|Any CPU.Build.0 = Release|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release|x64.ActiveCfg = Release|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release|x64.Build.0 = Release|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release-netcoreapp3_1|Any CPU.ActiveCfg = Release-netcoreapp3_1|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release-netcoreapp3_1|Any CPU.Build.0 = Release-netcoreapp3_1|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release-netcoreapp3_1|x64.ActiveCfg = Release-netcoreapp3_1|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release-netcoreapp3_1|x64.Build.0 = Release-netcoreapp3_1|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release-netfx|Any CPU.ActiveCfg = Release-netfx|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release-netfx|x64.ActiveCfg = Release-netfx|Any CPU + {84150C22-0627-4A11-81C9-F214762855EA}.Release-netfx|x64.Build.0 = Release-netfx|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug|x64.ActiveCfg = Debug|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug|x64.Build.0 = Debug|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug-netcoreapp3_1|Any CPU.ActiveCfg = Debug-netcoreapp3_1|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug-netcoreapp3_1|Any CPU.Build.0 = Debug-netcoreapp3_1|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug-netcoreapp3_1|x64.ActiveCfg = Debug-netcoreapp3_1|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug-netcoreapp3_1|x64.Build.0 = Debug-netcoreapp3_1|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug-netfx|Any CPU.ActiveCfg = Debug-netfx|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug-netfx|Any CPU.Build.0 = Debug-netfx|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug-netfx|x64.ActiveCfg = Debug-netfx|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Debug-netfx|x64.Build.0 = Debug-netfx|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release|Any CPU.Build.0 = Release|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release|x64.ActiveCfg = Release|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release|x64.Build.0 = Release|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release-netcoreapp3_1|Any CPU.ActiveCfg = Release-netcoreapp3_1|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release-netcoreapp3_1|Any CPU.Build.0 = Release-netcoreapp3_1|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release-netcoreapp3_1|x64.ActiveCfg = Release-netcoreapp3_1|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release-netcoreapp3_1|x64.Build.0 = Release-netcoreapp3_1|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release-netfx|Any CPU.ActiveCfg = Release-netfx|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release-netfx|x64.ActiveCfg = Release-netfx|Any CPU + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923}.Release-netfx|x64.Build.0 = Release-netfx|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug|x64.ActiveCfg = Debug|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug|x64.Build.0 = Debug|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug-netcoreapp3_1|Any CPU.ActiveCfg = Debug-netcoreapp3_1|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug-netcoreapp3_1|Any CPU.Build.0 = Debug-netcoreapp3_1|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug-netcoreapp3_1|x64.ActiveCfg = Debug-netcoreapp3_1|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug-netcoreapp3_1|x64.Build.0 = Debug-netcoreapp3_1|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug-netfx|Any CPU.ActiveCfg = Debug-netfx|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug-netfx|Any CPU.Build.0 = Debug-netfx|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug-netfx|x64.ActiveCfg = Debug-netfx|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Debug-netfx|x64.Build.0 = Debug-netfx|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release|Any CPU.Build.0 = Release|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release|x64.ActiveCfg = Release|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release|x64.Build.0 = Release|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release-netcoreapp3_1|Any CPU.ActiveCfg = Release-netcoreapp3_1|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release-netcoreapp3_1|Any CPU.Build.0 = Release-netcoreapp3_1|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release-netcoreapp3_1|x64.ActiveCfg = Release-netcoreapp3_1|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release-netcoreapp3_1|x64.Build.0 = Release-netcoreapp3_1|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release-netfx|Any CPU.ActiveCfg = Release-netfx|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release-netfx|x64.ActiveCfg = Release-netfx|Any CPU + {0B765344-11A4-4738-9759-5060599DC134}.Release-netfx|x64.Build.0 = Release-netfx|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug|x64.ActiveCfg = Debug|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug|x64.Build.0 = Debug|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug-netcoreapp3_1|Any CPU.ActiveCfg = Debug-netcoreapp3_1|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug-netcoreapp3_1|Any CPU.Build.0 = Debug-netcoreapp3_1|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug-netcoreapp3_1|x64.ActiveCfg = Debug-netcoreapp3_1|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug-netcoreapp3_1|x64.Build.0 = Debug-netcoreapp3_1|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug-netfx|Any CPU.ActiveCfg = Debug-netfx|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug-netfx|Any CPU.Build.0 = Debug-netfx|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug-netfx|x64.ActiveCfg = Debug-netfx|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Debug-netfx|x64.Build.0 = Debug-netfx|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release|Any CPU.Build.0 = Release|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release|x64.ActiveCfg = Release|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release|x64.Build.0 = Release|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release-netcoreapp3_1|Any CPU.ActiveCfg = Release-netcoreapp3_1|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release-netcoreapp3_1|Any CPU.Build.0 = Release-netcoreapp3_1|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release-netcoreapp3_1|x64.ActiveCfg = Release-netcoreapp3_1|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release-netcoreapp3_1|x64.Build.0 = Release-netcoreapp3_1|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release-netfx|Any CPU.ActiveCfg = Release-netfx|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release-netfx|x64.ActiveCfg = Release-netfx|Any CPU + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25}.Release-netfx|x64.Build.0 = Release-netfx|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1749,6 +1853,10 @@ Global {C8DB58DC-6434-4431-A81F-263D86E2A5F3} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4} {6CF88209-69DB-4B36-9604-3ECD9F163E96} = {09EADF06-BE25-4228-AB53-95AE3E15B530} {4584326B-C5B3-4CAE-B98A-34C5F5AA16F3} = {09EADF06-BE25-4228-AB53-95AE3E15B530} + {84150C22-0627-4A11-81C9-F214762855EA} = {09EADF06-BE25-4228-AB53-95AE3E15B530} + {D9FDD2D5-BFFC-4A4D-8589-7F63AA3EA923} = {09EADF06-BE25-4228-AB53-95AE3E15B530} + {0B765344-11A4-4738-9759-5060599DC134} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4} + {8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {41165AF1-35BB-4832-A189-73060F82B01D} diff --git a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj index 274e35229e..dae403c2d8 100644 --- a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj +++ b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj @@ -1,21 +1,22 @@  - - netcoreapp3.1 - false - + + netcoreapp3.1 + false + $(NoWarn);MSML_ParameterLocalVarName;SA1028 + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + - - - - diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 80459a2eb7..72a06d5014 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -1,251 +1,252 @@  - - - netstandard2.0 - 7.3 - true - false - 0.5.0 - false - This package contains easy-to-use and high-performance libraries for data analysis and transformation. - Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. - ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration - true - - $(NoWarn);1591;NU5100 - $(TargetsForTfmSpecificContentInPackage);AddMDAIToInteractiveExtensionsFolder - + $(NoWarn);1591;NU5100;MSML_GeneralName;MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_TypeParamName;SA1028;SA1507;SX1101 + $(TargetsForTfmSpecificContentInPackage);AddMDAIToInteractiveExtensionsFolder + + + + + + + + - - - - - + + <_ItemsToIncludeForInteractive Update="@(_ItemsToIncludeForInteractive)" PackagePath="interactive-extensions/dotnet" /> + + + - - <_ItemsToIncludeForInteractive Update="@(_ItemsToIncludeForInteractive)" PackagePath="interactive-extensions/dotnet" /> - - - + + + True + True + Converters.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperators.tt + + - - - True - True - Converters.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperators.tt - - + + + + + + + + - - - - - - - - - - - - TextTemplatingFileGenerator - Converters.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs - - - TextTemplatingFileGenerator - DataFrameColumn.BinaryOperations.cs - - - TextTemplatingFileGenerator - DataFrameColumn.BinaryOperators.cs - - - TextTemplatingFileGenerator - DataFrameColumn.Computations.cs - - - TextTemplatingFileGenerator - DataFrame.BinaryOperations.cs - - - TextTemplatingFileGenerator - DataFrame.BinaryOperators.cs - - - TextTemplatingFileGenerator - DataFrameBinaryOperators.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude - - - True - True - PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperations.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperators.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.Computations.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.ReversedBinaryOperations.cs - - - TextTemplatingFileGenerator - PrimitiveColumnArithmetic.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumnComputations.cs - - - TextTemplatingFileGenerator - PrimitiveColumnContainer.BinaryOperations.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumnArithmetic.cs - - - TextTemplatingFileGenerator - PrimitiveColumnContainer.BinaryOperations.cs - - + + + TextTemplatingFileGenerator + Converters.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperations.cs + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperators.cs + + + TextTemplatingFileGenerator + DataFrameColumn.Computations.cs + + + TextTemplatingFileGenerator + DataFrame.BinaryOperations.cs + + + TextTemplatingFileGenerator + DataFrame.BinaryOperators.cs + + + TextTemplatingFileGenerator + DataFrameBinaryOperators.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude + + + True + True + PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperations.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperators.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.Computations.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.ReversedBinaryOperations.cs + + + TextTemplatingFileGenerator + PrimitiveColumnArithmetic.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumnComputations.cs + + + TextTemplatingFileGenerator + PrimitiveColumnContainer.BinaryOperations.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumnArithmetic.cs + + + TextTemplatingFileGenerator + PrimitiveColumnContainer.BinaryOperations.cs + + - - - + + + - - - True - True - Converters.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt - - - True - True - DataFrameColumn.BinaryOperations.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt - - - True - True - DataFrameColumn.BinaryOperators.tt - - - True - True - DataFrameColumn.Computations.tt - - - True - True - DataFrame.BinaryOperations.tt - - - True - True - DataFrame.BinaryOperators.tt - - - True - True - DataFrameBinaryOperators.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperations.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperators.tt - - - True - True - PrimitiveDataFrameColumn.Computations.tt - - - True - True - PrimitiveDataFrameColumn.ReversedBinaryOperations.tt - - - True - True - PrimitiveColumnArithmetic.tt - - - True - True - PrimitiveDataFrameColumnComputations.tt - - - True - True - PrimitiveColumnContainer.BinaryOperations.tt - - - True - True - PrimitiveDataFrameColumnArithmetic.tt - - - True - True - PrimitiveColumnContainer.BinaryOperations.tt - - - True - True - Strings.resx - - + + + True + True + Converters.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt + + + True + True + DataFrameColumn.BinaryOperations.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt + + + True + True + DataFrameColumn.BinaryOperators.tt + + + True + True + DataFrameColumn.Computations.tt + + + True + True + DataFrame.BinaryOperations.tt + + + True + True + DataFrame.BinaryOperators.tt + + + True + True + DataFrameBinaryOperators.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperations.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperators.tt + + + True + True + PrimitiveDataFrameColumn.Computations.tt + + + True + True + PrimitiveDataFrameColumn.ReversedBinaryOperations.tt + + + True + True + PrimitiveColumnArithmetic.tt + + + True + True + PrimitiveDataFrameColumnComputations.tt + + + True + True + PrimitiveColumnContainer.BinaryOperations.tt + + + True + True + PrimitiveDataFrameColumnArithmetic.tt + + + True + True + PrimitiveColumnContainer.BinaryOperations.tt + + + True + True + Strings.resx + + - - - ResXFileCodeGenerator - Strings.Designer.cs - Microsoft.Data - - + + + ResXFileCodeGenerator + Strings.Designer.cs + Microsoft.Data + + diff --git a/src/Microsoft.Data.Analysis/TextFieldParser.cs b/src/Microsoft.Data.Analysis/TextFieldParser.cs index 33d7851b21..6cdada1aff 100644 --- a/src/Microsoft.Data.Analysis/TextFieldParser.cs +++ b/src/Microsoft.Data.Analysis/TextFieldParser.cs @@ -11,8 +11,6 @@ using System.Text; using System.Text.RegularExpressions; -[assembly: InternalsVisibleTo("Microsoft.Data.Analysis.Tests, PublicKey= 0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] - namespace Microsoft.Data.Analysis { internal enum FieldType diff --git a/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj b/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj index d40e6f713c..bdfc39e1f6 100644 --- a/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj +++ b/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj @@ -1,14 +1,18 @@  - - netcoreapp3.1 - + + netcoreapp3.1 + $(NoWarn);MSML_PrivateFieldName;MSML_ExtendBaseTestClass + - - - + + + + + + - - - - + + + + diff --git a/test/Microsoft.Data.Analysis.Tests/DataFrameTests.cs b/test/Microsoft.Data.Analysis.Tests/DataFrameTests.cs index 1c8493fc71..c277aae36e 100644 --- a/test/Microsoft.Data.Analysis.Tests/DataFrameTests.cs +++ b/test/Microsoft.Data.Analysis.Tests/DataFrameTests.cs @@ -1776,7 +1776,7 @@ public void TestFillNulls() ArrowStringDataFrameColumn arrowColumn = CreateArrowStringColumn(3); Assert.Equal(3, arrowColumn.Length); Assert.Equal(1, arrowColumn.NullCount); - Assert.Equal(null, arrowColumn[1]); + Assert.Null(arrowColumn[1]); ArrowStringDataFrameColumn arrowColumnFilled = arrowColumn.FillNulls("foo"); Assert.Equal(3, arrowColumn.Length); Assert.Equal(1, arrowColumn.NullCount); diff --git a/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj index fcfbedb82a..e18668c5f5 100644 --- a/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj +++ b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj @@ -1,35 +1,35 @@  + + net461;netcoreapp3.0 + netcoreapp3.0 + $(NoWarn);MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_ExtendBaseTestClass;MSML_GeneralName + - - net461;netcoreapp3.0 - netcoreapp3.0 - + + + - - - + + + + - - - + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperationTests.cs + + - - - TextTemplatingFileGenerator - DataFrameColumn.BinaryOperationTests.cs - - - - - - - - - - True - True - DataFrameColumn.BinaryOperationTests.tt - - + + + + + + True + True + DataFrameColumn.BinaryOperationTests.tt + + From 0b8541a9d08824df7ae9ba0a2f5277bed95a9d77 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 3 Mar 2021 14:24:26 -0800 Subject: [PATCH 49/53] Move extensions reference out of props Make MDA.test use the props defined TFM Comment out 2 unit tests --- ...Microsoft.Data.Analysis.Interactive.csproj | 4 +- .../Microsoft.Data.Analysis.csproj | 2 +- test/Directory.Build.props | 8 - ...oft.Data.Analysis.Interactive.Tests.csproj | 3 - .../BufferTests.cs | 178 +++++++++--------- .../Microsoft.Data.Analysis.Tests.csproj | 2 - .../Microsoft.Extensions.ML.Tests.csproj | 8 + 7 files changed, 100 insertions(+), 105 deletions(-) diff --git a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj index dae403c2d8..5cb73f4a5a 100644 --- a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj +++ b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj @@ -11,8 +11,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 72a06d5014..d34a9f19db 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -15,7 +15,7 @@ 1591: Documentation warnings NU5100: Warning that gets triggered because a .dll is not placed under lib folder on package. This is by design as we want MDAI to be under interactive-extensions folder. --> - $(NoWarn);1591;NU5100;MSML_GeneralName;MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_TypeParamName;SA1028;SA1507;SX1101 + $(NoWarn);1591;NU5100;MSML_GeneralName;MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_TypeParamName;SA1028;SA1507;SX1101;MSML_NoInstanceInitializers $(TargetsForTfmSpecificContentInPackage);AddMDAIToInteractiveExtensionsFolder diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 303d63b310..08cd4f3da6 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -33,14 +33,6 @@ - - - - - - - - - - - diff --git a/test/Microsoft.Data.Analysis.Tests/BufferTests.cs b/test/Microsoft.Data.Analysis.Tests/BufferTests.cs index 8150988608..96f568b6a4 100644 --- a/test/Microsoft.Data.Analysis.Tests/BufferTests.cs +++ b/test/Microsoft.Data.Analysis.Tests/BufferTests.cs @@ -188,94 +188,94 @@ public void TestArrowStringColumnClone() Assert.Null(clone[i]); } -#if !NETFRAMEWORK // https://github.com/dotnet/corefxlab/issues/2796 - [Fact] - public void TestPrimitiveColumnGetReadOnlyBuffers() - { - RecordBatch recordBatch = new RecordBatch.Builder() - .Append("Column1", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))).Build(); - DataFrame df = DataFrame.FromArrowRecordBatch(recordBatch); - - PrimitiveDataFrameColumn column = df.Columns["Column1"] as PrimitiveDataFrameColumn; - - IEnumerable> buffers = column.GetReadOnlyDataBuffers(); - IEnumerable> nullBitMaps = column.GetReadOnlyNullBitMapBuffers(); - - long i = 0; - IEnumerator> bufferEnumerator = buffers.GetEnumerator(); - IEnumerator> nullBitMapsEnumerator = nullBitMaps.GetEnumerator(); - while (bufferEnumerator.MoveNext() && nullBitMapsEnumerator.MoveNext()) - { - ReadOnlyMemory dataBuffer = bufferEnumerator.Current; - ReadOnlyMemory nullBitMap = nullBitMapsEnumerator.Current; - - ReadOnlySpan span = dataBuffer.Span; - for (int j = 0; j < span.Length; j++) - { - // Each buffer has a max length of int.MaxValue - Assert.Equal(span[j], column[j + i * int.MaxValue]); - } - - bool GetBit(byte curBitMap, int index) - { - return ((curBitMap >> (index & 7)) & 1) != 0; - } - ReadOnlySpan bitMapSpan = nullBitMap.Span; - // No nulls in this column, so each bit must be set - for (int j = 0; j < bitMapSpan.Length; j++) - { - for (int k = 0; k < 8; k++) - { - if (j * 8 + k == column.Length) - break; - Assert.True(GetBit(bitMapSpan[j], k)); - } - } - i++; - } - } - - [Fact] - public void TestArrowStringColumnGetReadOnlyBuffers() - { - // Test ArrowStringDataFrameColumn. - StringArray strArray = new StringArray.Builder().Append("foo").Append("bar").Build(); - Memory dataMemory = new byte[] { 102, 111, 111, 98, 97, 114 }; - Memory nullMemory = new byte[] { 1 }; - Memory offsetMemory = new byte[] { 0, 0, 0, 0, 3, 0, 0, 0, 6, 0, 0, 0 }; - - ArrowStringDataFrameColumn column = new ArrowStringDataFrameColumn("String", dataMemory, offsetMemory, nullMemory, strArray.Length, strArray.NullCount); - - IEnumerable> dataBuffers = column.GetReadOnlyDataBuffers(); - IEnumerable> nullBitMaps = column.GetReadOnlyNullBitMapBuffers(); - IEnumerable> offsetsBuffers = column.GetReadOnlyOffsetsBuffers(); - - using (IEnumerator> bufferEnumerator = dataBuffers.GetEnumerator()) - using (IEnumerator> offsetsEnumerator = offsetsBuffers.GetEnumerator()) - using (IEnumerator> nullBitMapsEnumerator = nullBitMaps.GetEnumerator()) - { - while (bufferEnumerator.MoveNext() && nullBitMapsEnumerator.MoveNext() && offsetsEnumerator.MoveNext()) - { - ReadOnlyMemory dataBuffer = bufferEnumerator.Current; - ReadOnlyMemory nullBitMap = nullBitMapsEnumerator.Current; - ReadOnlyMemory offsets = offsetsEnumerator.Current; - - ReadOnlySpan dataSpan = dataBuffer.Span; - ReadOnlySpan offsetsSpan = offsets.Span; - int dataStart = 0; - for (int j = 1; j < offsetsSpan.Length; j++) - { - int length = offsetsSpan[j] - offsetsSpan[j - 1]; - ReadOnlySpan str = dataSpan.Slice(dataStart, length); - ReadOnlySpan columnStr = dataMemory.Span.Slice(dataStart, length); - Assert.Equal(str.Length, columnStr.Length); - for (int s = 0; s < str.Length; s++) - Assert.Equal(str[s], columnStr[s]); - dataStart = length; - } - } - } - } -#endif //!NETFRAMEWORK +//#if !NETFRAMEWORK // https://github.com/dotnet/corefxlab/issues/2796 +// [Fact] +// public void TestPrimitiveColumnGetReadOnlyBuffers() +// { +// RecordBatch recordBatch = new RecordBatch.Builder() +// .Append("Column1", false, col => col.Int32(array => array.AppendRange(Enumerable.Range(0, 10)))).Build(); +// DataFrame df = DataFrame.FromArrowRecordBatch(recordBatch); + +// PrimitiveDataFrameColumn column = df.Columns["Column1"] as PrimitiveDataFrameColumn; + +// IEnumerable> buffers = column.GetReadOnlyDataBuffers(); +// IEnumerable> nullBitMaps = column.GetReadOnlyNullBitMapBuffers(); + +// long i = 0; +// IEnumerator> bufferEnumerator = buffers.GetEnumerator(); +// IEnumerator> nullBitMapsEnumerator = nullBitMaps.GetEnumerator(); +// while (bufferEnumerator.MoveNext() && nullBitMapsEnumerator.MoveNext()) +// { +// ReadOnlyMemory dataBuffer = bufferEnumerator.Current; +// ReadOnlyMemory nullBitMap = nullBitMapsEnumerator.Current; + +// ReadOnlySpan span = dataBuffer.Span; +// for (int j = 0; j < span.Length; j++) +// { +// // Each buffer has a max length of int.MaxValue +// Assert.Equal(span[j], column[j + i * int.MaxValue]); +// } + +// bool GetBit(byte curBitMap, int index) +// { +// return ((curBitMap >> (index & 7)) & 1) != 0; +// } +// ReadOnlySpan bitMapSpan = nullBitMap.Span; +// // No nulls in this column, so each bit must be set +// for (int j = 0; j < bitMapSpan.Length; j++) +// { +// for (int k = 0; k < 8; k++) +// { +// if (j * 8 + k == column.Length) +// break; +// Assert.True(GetBit(bitMapSpan[j], k)); +// } +// } +// i++; +// } +// } + +// [Fact] +// public void TestArrowStringColumnGetReadOnlyBuffers() +// { +// // Test ArrowStringDataFrameColumn. +// StringArray strArray = new StringArray.Builder().Append("foo").Append("bar").Build(); +// Memory dataMemory = new byte[] { 102, 111, 111, 98, 97, 114 }; +// Memory nullMemory = new byte[] { 1 }; +// Memory offsetMemory = new byte[] { 0, 0, 0, 0, 3, 0, 0, 0, 6, 0, 0, 0 }; + +// ArrowStringDataFrameColumn column = new ArrowStringDataFrameColumn("String", dataMemory, offsetMemory, nullMemory, strArray.Length, strArray.NullCount); + +// IEnumerable> dataBuffers = column.GetReadOnlyDataBuffers(); +// IEnumerable> nullBitMaps = column.GetReadOnlyNullBitMapBuffers(); +// IEnumerable> offsetsBuffers = column.GetReadOnlyOffsetsBuffers(); + +// using (IEnumerator> bufferEnumerator = dataBuffers.GetEnumerator()) +// using (IEnumerator> offsetsEnumerator = offsetsBuffers.GetEnumerator()) +// using (IEnumerator> nullBitMapsEnumerator = nullBitMaps.GetEnumerator()) +// { +// while (bufferEnumerator.MoveNext() && nullBitMapsEnumerator.MoveNext() && offsetsEnumerator.MoveNext()) +// { +// ReadOnlyMemory dataBuffer = bufferEnumerator.Current; +// ReadOnlyMemory nullBitMap = nullBitMapsEnumerator.Current; +// ReadOnlyMemory offsets = offsetsEnumerator.Current; + +// ReadOnlySpan dataSpan = dataBuffer.Span; +// ReadOnlySpan offsetsSpan = offsets.Span; +// int dataStart = 0; +// for (int j = 1; j < offsetsSpan.Length; j++) +// { +// int length = offsetsSpan[j] - offsetsSpan[j - 1]; +// ReadOnlySpan str = dataSpan.Slice(dataStart, length); +// ReadOnlySpan columnStr = dataMemory.Span.Slice(dataStart, length); +// Assert.Equal(str.Length, columnStr.Length); +// for (int s = 0; s < str.Length; s++) +// Assert.Equal(str[s], columnStr[s]); +// dataStart = length; +// } +// } +// } +// } +//#endif //!NETFRAMEWORK } } diff --git a/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj index e18668c5f5..bbae14d2b6 100644 --- a/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj +++ b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj @@ -1,7 +1,5 @@  - net461;netcoreapp3.0 - netcoreapp3.0 $(NoWarn);MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_ExtendBaseTestClass;MSML_GeneralName diff --git a/test/Microsoft.Extensions.ML.Tests/Microsoft.Extensions.ML.Tests.csproj b/test/Microsoft.Extensions.ML.Tests/Microsoft.Extensions.ML.Tests.csproj index 377369de9b..ba1bc5a3b2 100644 --- a/test/Microsoft.Extensions.ML.Tests/Microsoft.Extensions.ML.Tests.csproj +++ b/test/Microsoft.Extensions.ML.Tests/Microsoft.Extensions.ML.Tests.csproj @@ -12,6 +12,14 @@ + + + + + + + + From bf821798dda272e86faa8b87ec34c581e1dc69ea Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Fri, 5 Mar 2021 13:33:40 -0800 Subject: [PATCH 50/53] Address feedback --- eng/Versions.props | 5 ++++- ...Microsoft.Data.Analysis.Interactive.csproj | 8 ++----- .../Microsoft.Data.Analysis.csproj | 21 +++++++++---------- .../Microsoft.Data.Analysis.Tests.csproj | 6 ++---- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 353e9fecb6..2e24673209 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -32,8 +32,11 @@ 2.3.1 2 0.20.1 - 3.3.1 + 1.0.0-beta.20410.1 + 1.0.0-beta.20410.1 + 2.0.0 + 4.3.0 4.5.0 1.2.0 diff --git a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj index 5cb73f4a5a..14b3a9a10d 100644 --- a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj +++ b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj @@ -7,12 +7,8 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index d34a9f19db..32eacb668d 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -2,11 +2,9 @@ netstandard2.0 - 7.3 true false 0.5.0 - false This package contains easy-to-use and high-performance libraries for data analysis and transformation. Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration @@ -21,9 +19,7 @@ - + @@ -48,12 +44,15 @@ - - - - - - + + + + + + + + + diff --git a/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj index bbae14d2b6..c70eedea4c 100644 --- a/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj +++ b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj @@ -3,12 +3,10 @@ $(NoWarn);MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_ExtendBaseTestClass;MSML_GeneralName - - - - + + From 9d74a8321783add173b57e61b741ed44267b9e86 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Mon, 8 Mar 2021 10:57:35 -0800 Subject: [PATCH 51/53] Address feedback --- ...Microsoft.Data.Analysis.Interactive.csproj | 24 +- .../Microsoft.Data.Analysis.csproj | 472 +++++++++--------- ...oft.Data.Analysis.Interactive.Tests.csproj | 22 +- .../Microsoft.Data.Analysis.Tests.csproj | 50 +- .../Microsoft.Extensions.ML.Tests.csproj | 2 +- 5 files changed, 285 insertions(+), 285 deletions(-) diff --git a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj index 14b3a9a10d..3167c983dc 100644 --- a/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj +++ b/src/Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj @@ -1,18 +1,18 @@  - - netcoreapp3.1 - false - $(NoWarn);MSML_ParameterLocalVarName;SA1028 - + + netcoreapp3.1 + false + $(NoWarn);MSML_ParameterLocalVarName;SA1028 + - - - - + + + + - - - + + + diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index 32eacb668d..aee209441b 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -1,251 +1,251 @@  - - netstandard2.0 - true - false - 0.5.0 - This package contains easy-to-use and high-performance libraries for data analysis and transformation. - Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. - ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration - true - - $(NoWarn);1591;NU5100;MSML_GeneralName;MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_TypeParamName;SA1028;SA1507;SX1101;MSML_NoInstanceInitializers - $(TargetsForTfmSpecificContentInPackage);AddMDAIToInteractiveExtensionsFolder - + $(NoWarn);1591;NU5100;MSML_GeneralName;MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_TypeParamName;SA1028;SA1507;SX1101;MSML_NoInstanceInitializers + $(TargetsForTfmSpecificContentInPackage);AddMDAIToInteractiveExtensionsFolder + - - - - - - + + + + + + - - <_ItemsToIncludeForInteractive Update="@(_ItemsToIncludeForInteractive)" PackagePath="interactive-extensions/dotnet" /> - - - + + <_ItemsToIncludeForInteractive Update="@(_ItemsToIncludeForInteractive)" PackagePath="interactive-extensions/dotnet" /> + + + - - - True - True - Converters.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperators.tt - - + + + True + True + Converters.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperators.tt + + - - - - - - - + + + + + + + - - - + + + - - - TextTemplatingFileGenerator - Converters.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs - - - TextTemplatingFileGenerator - DataFrameColumn.BinaryOperations.cs - - - TextTemplatingFileGenerator - DataFrameColumn.BinaryOperators.cs - - - TextTemplatingFileGenerator - DataFrameColumn.Computations.cs - - - TextTemplatingFileGenerator - DataFrame.BinaryOperations.cs - - - TextTemplatingFileGenerator - DataFrame.BinaryOperators.cs - - - TextTemplatingFileGenerator - DataFrameBinaryOperators.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude - - - True - True - PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperations.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.BinaryOperators.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.Computations.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumn.ReversedBinaryOperations.cs - - - TextTemplatingFileGenerator - PrimitiveColumnArithmetic.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumnComputations.cs - - - TextTemplatingFileGenerator - PrimitiveColumnContainer.BinaryOperations.cs - - - TextTemplatingFileGenerator - PrimitiveDataFrameColumnArithmetic.cs - - - TextTemplatingFileGenerator - PrimitiveColumnContainer.BinaryOperations.cs - - + + + TextTemplatingFileGenerator + Converters.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperations.cs + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperators.cs + + + TextTemplatingFileGenerator + DataFrameColumn.Computations.cs + + + TextTemplatingFileGenerator + DataFrame.BinaryOperations.cs + + + TextTemplatingFileGenerator + DataFrame.BinaryOperators.cs + + + TextTemplatingFileGenerator + DataFrameBinaryOperators.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude + + + True + True + PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperations.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.BinaryOperators.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.Computations.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumn.ReversedBinaryOperations.cs + + + TextTemplatingFileGenerator + PrimitiveColumnArithmetic.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumnComputations.cs + + + TextTemplatingFileGenerator + PrimitiveColumnContainer.BinaryOperations.cs + + + TextTemplatingFileGenerator + PrimitiveDataFrameColumnArithmetic.cs + + + TextTemplatingFileGenerator + PrimitiveColumnContainer.BinaryOperations.cs + + - - - + + + - - - True - True - Converters.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt - - - True - True - DataFrameColumn.BinaryOperations.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt - - - True - True - DataFrameColumn.BinaryOperators.tt - - - True - True - DataFrameColumn.Computations.tt - - - True - True - DataFrame.BinaryOperations.tt - - - True - True - DataFrame.BinaryOperators.tt - - - True - True - DataFrameBinaryOperators.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperations.tt - - - True - True - PrimitiveDataFrameColumn.BinaryOperators.tt - - - True - True - PrimitiveDataFrameColumn.Computations.tt - - - True - True - PrimitiveDataFrameColumn.ReversedBinaryOperations.tt - - - True - True - PrimitiveColumnArithmetic.tt - - - True - True - PrimitiveDataFrameColumnComputations.tt - - - True - True - PrimitiveColumnContainer.BinaryOperations.tt - - - True - True - PrimitiveDataFrameColumnArithmetic.tt - - - True - True - PrimitiveColumnContainer.BinaryOperations.tt - - - True - True - Strings.resx - - + + + True + True + Converters.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.tt + + + True + True + DataFrameColumn.BinaryOperations.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.tt + + + True + True + DataFrameColumn.BinaryOperators.tt + + + True + True + DataFrameColumn.Computations.tt + + + True + True + DataFrame.BinaryOperations.tt + + + True + True + DataFrame.BinaryOperators.tt + + + True + True + DataFrameBinaryOperators.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperations.tt + + + True + True + PrimitiveDataFrameColumn.BinaryOperators.tt + + + True + True + PrimitiveDataFrameColumn.Computations.tt + + + True + True + PrimitiveDataFrameColumn.ReversedBinaryOperations.tt + + + True + True + PrimitiveColumnArithmetic.tt + + + True + True + PrimitiveDataFrameColumnComputations.tt + + + True + True + PrimitiveColumnContainer.BinaryOperations.tt + + + True + True + PrimitiveDataFrameColumnArithmetic.tt + + + True + True + PrimitiveColumnContainer.BinaryOperations.tt + + + True + True + Strings.resx + + - - - ResXFileCodeGenerator - Strings.Designer.cs - Microsoft.Data - - + + + ResXFileCodeGenerator + Strings.Designer.cs + Microsoft.Data + + diff --git a/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj b/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj index e03e7b8e21..e96eca5c58 100644 --- a/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj +++ b/test/Microsoft.Data.Analysis.Interactive.Tests/Microsoft.Data.Analysis.Interactive.Tests.csproj @@ -1,15 +1,15 @@  - - netcoreapp3.1 - $(NoWarn);MSML_PrivateFieldName;MSML_ExtendBaseTestClass - + + netcoreapp3.1 + $(NoWarn);MSML_PrivateFieldName;MSML_ExtendBaseTestClass + - - - + + + - - - - + + + + diff --git a/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj index c70eedea4c..2b6f43253f 100644 --- a/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj +++ b/test/Microsoft.Data.Analysis.Tests/Microsoft.Data.Analysis.Tests.csproj @@ -1,31 +1,31 @@  - - $(NoWarn);MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_ExtendBaseTestClass;MSML_GeneralName - + + $(NoWarn);MSML_ParameterLocalVarName;MSML_PrivateFieldName;MSML_ExtendBaseTestClass;MSML_GeneralName + - - - - - - + + + + + + - - - TextTemplatingFileGenerator - DataFrameColumn.BinaryOperationTests.cs - - + + + TextTemplatingFileGenerator + DataFrameColumn.BinaryOperationTests.cs + + - - - + + + - - - True - True - DataFrameColumn.BinaryOperationTests.tt - - + + + True + True + DataFrameColumn.BinaryOperationTests.tt + + diff --git a/test/Microsoft.Extensions.ML.Tests/Microsoft.Extensions.ML.Tests.csproj b/test/Microsoft.Extensions.ML.Tests/Microsoft.Extensions.ML.Tests.csproj index ba1bc5a3b2..2105028eea 100644 --- a/test/Microsoft.Extensions.ML.Tests/Microsoft.Extensions.ML.Tests.csproj +++ b/test/Microsoft.Extensions.ML.Tests/Microsoft.Extensions.ML.Tests.csproj @@ -19,7 +19,7 @@ - + From fa39b746ca386d81e3913dd6ed74bb28b21428f7 Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Mon, 8 Mar 2021 10:59:11 -0800 Subject: [PATCH 52/53] Default to preview version --- src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj index aee209441b..5511c493a4 100644 --- a/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj +++ b/src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj @@ -4,7 +4,6 @@ netstandard2.0 true false - 0.5.0 This package contains easy-to-use and high-performance libraries for data analysis and transformation. Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration From 216554a771686d4fc635383f01e03e5c317c713b Mon Sep 17 00:00:00 2001 From: Prashanth Govindarajan Date: Wed, 10 Mar 2021 13:09:39 -0800 Subject: [PATCH 53/53] Update nuget.config --- NuGet.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 5712c11fff..231d0f8008 100644 --- a/NuGet.config +++ b/NuGet.config @@ -11,7 +11,7 @@ - +