You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usingSystem;usingApache.Arrow.Types;namespaceApache.Arrow.Scalars{publicreadonlystructNullScalar:Scalar{publicIArrowTypeDataType=>NullType.Default;publicvoidValidate(){}publicvoidValidateFull(){}}publicreadonlystructBooleanScalar:PrimitiveScalar<BooleanType,bool>{publicIArrowTypeDataType=>BooleanType.Default;publicboolValue{get;}publicBooleanScalar(boolvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Boolean)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(bool)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructInt8Scalar:NumericScalar<Int8Type,sbyte>{publicIArrowTypeDataType=>Int8Type.Default;publicsbyteValue{get;}publicInt8Scalar(sbytevalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Int8)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(sbyte)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructUInt8Scalar:NumericScalar<UInt8Type,byte>{publicIArrowTypeDataType=>UInt8Type.Default;publicbyteValue{get;}publicUInt8Scalar(bytevalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.UInt8)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(byte)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructInt16Scalar:NumericScalar<Int16Type,short>{publicIArrowTypeDataType=>Int16Type.Default;publicshortValue{get;}publicInt16Scalar(shortvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Int16)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(short)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructUInt16Scalar:NumericScalar<UInt16Type,ushort>{publicIArrowTypeDataType=>UInt16Type.Default;publicushortValue{get;}publicUInt16Scalar(ushortvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.UInt16)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(ushort)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructInt32Scalar:NumericScalar<Int32Type,int>{publicIArrowTypeDataType=>Int32Type.Default;publicintValue{get;}publicInt32Scalar(intvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Int32)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(int)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructUInt32Scalar:NumericScalar<UInt32Type,uint>{publicIArrowTypeDataType=>UInt32Type.Default;publicuintValue{get;}publicUInt32Scalar(uintvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.UInt32)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(uint)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructInt64Scalar:NumericScalar<Int64Type,long>{publicIArrowTypeDataType=>Int64Type.Default;publiclongValue{get;}publicInt64Scalar(longvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Int64)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(long)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructUInt64Scalar:NumericScalar<UInt64Type,ulong>{publicIArrowTypeDataType=>UInt64Type.Default;publiculongValue{get;}publicUInt64Scalar(ulongvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.UInt64)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(ulong)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}
# if NET6_0_OR_GREATERpublicreadonlystructHalfFloatScalar:NumericScalar<HalfFloatType,Half>{publicIArrowTypeDataType=>HalfFloatType.Default;publicHalfValue{get;}publicHalfFloatScalar(Halfvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.HalfFloat)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(float)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}
# endif
publicreadonlystructFloatScalar:NumericScalar<FloatType,float>{publicIArrowTypeDataType=>FloatType.Default;publicfloatValue{get;}publicFloatScalar(floatvalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Float)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(float)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructDoubleScalar:NumericScalar<DoubleType,double>{publicIArrowTypeDataType=>DoubleType.Default;publicdoubleValue{get;}publicDoubleScalar(doublevalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Double)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(double)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// BinarypublicreadonlystructBinaryScalar:BinaryScalarBase<BinaryType,byte[]>{publicIArrowTypeDataType=>BinaryType.Default;publicbyte[]Value{get;}publicBinaryScalar(byte[]value){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Binary)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(byte[])!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// StringpublicreadonlystructStringScalar:BinaryScalarBase<StringType,string>{publicIArrowTypeDataType=>StringType.Default;publicstringValue{get;}publicStringScalar(stringvalue){Value=value;}publicvoidValidate(){if(Value==null)thrownewInvalidOperationException("Invalid csharp null value for string scalar");if(DataType.TypeId!=ArrowTypeId.String)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(string)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// FixedSizedBinarypublicreadonlystructFixedSizedBinaryScalar:BinaryScalarBase<FixedSizeBinaryType,byte[]>{publicIArrowTypeDataType{get;}publicbyte[]Value{get;}publicFixedSizedBinaryScalar(byte[]value,FixedSizeBinaryTypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.FixedSizedBinary)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(byte[])!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// Date32publicreadonlystructDate32Scalar:TemporalScalar<Date32Type,DateTime>{publicIArrowTypeDataType=>Date32Type.Default;publicDateTimeValue{get;}publicDate32Scalar(DateTimevalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Date32)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(int)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// Date64publicreadonlystructDate64Scalar:TemporalScalar<Date64Type,DateTime>{publicIArrowTypeDataType=>Date64Type.Default;publicDateTimeValue{get;}publicDate64Scalar(DateTimevalue){Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Date64)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(long)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// TimestamppublicreadonlystructTimestampScalar:TemporalScalar<TimestampType,DateTime>{publicIArrowTypeDataType{get;}publicDateTimeValue{get;}publicTimestampScalar(DateTimevalue,TimestampTypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Timestamp)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(long)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// Time32publicreadonlystructTime32Scalar:TemporalScalar<Time32Type,TimeSpan>{publicIArrowTypeDataType{get;}publicTimeSpanValue{get;}publicTime32Scalar(TimeSpanvalue,Time32TypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Time32)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(int)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// Time64publicreadonlystructTime64Scalar:TemporalScalar<Time64Type,TimeSpan>{publicIArrowTypeDataType{get;}publicTimeSpanValue{get;}publicTime64Scalar(TimeSpanvalue,Time64TypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Time64)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(long)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// IntervalpublicreadonlystructIntervalScalar:TemporalScalar<IntervalType,TimeSpan>{publicIArrowTypeDataType{get;}publicTimeSpanValue{get;}publicIntervalScalar(TimeSpanvalue,IntervalTypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Interval)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(long)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// Decimal128publicreadonlystructDecimal128Scalar:PrimitiveScalar<Decimal128Type,decimal>{publicIArrowTypeDataType{get;}publicdecimalValue{get;}publicDecimal128Scalar(decimalvalue,Decimal128TypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Decimal128)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(decimal)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// Decimal256publicreadonlystructDecimal256Scalar:PrimitiveScalar<Decimal256Type,decimal>{publicIArrowTypeDataType{get;}publicdecimalValue{get;}publicDecimal256Scalar(decimalvalue,Decimal256TypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Decimal256)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(decimal)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// DurationpublicreadonlystructDurationScalar:TemporalScalar<DurationType,TimeSpan>{publicIArrowTypeDataType{get;}publicTimeSpanValue{get;}publicDurationScalar(TimeSpanvalue,DurationTypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Duration)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(long)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// Decimal32publicreadonlystructDecimal32Scalar:PrimitiveScalar<Decimal32Type,decimal>{publicIArrowTypeDataType{get;}publicdecimalValue{get;}publicDecimal32Scalar(decimalvalue,Decimal32TypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Decimal32)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(decimal)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}// Decimal64publicreadonlystructDecimal64Scalar:PrimitiveScalar<Decimal64Type,decimal>{publicIArrowTypeDataType{get;}publicdecimalValue{get;}publicDecimal64Scalar(decimalvalue,Decimal64TypedataType){DataType=dataType;Value=value;}publicvoidValidate(){if(DataType.TypeId!=ArrowTypeId.Decimal64)thrownewInvalidOperationException("Invalid arrow type for scalar");if(typeof(decimal)!=Value.GetType())thrownewInvalidOperationException("Invalid csharp value type for scalar");}publicvoidValidateFull(){Validate();}}publicreadonlystructListScalar:ListScalarBase<ListType>{publicIArrowTypeDataType=>Values.Data.DataType;publicIArrowArrayValues{get;}publicListScalar(IArrowArrayvalues){Values=values;}publicvoidValidate(){}publicvoidValidateFull(){}}publicreadonlystructStructScalar:Scalar<StructType>{publicIArrowTypeDataType{get;}publicScalar[]Values{get;}publicStructScalar(Scalar[]values,StructTypedataType){DataType=dataType;Values=values;}publicvoidValidate(){foreach(varvalueinValues){value.Validate();}}publicvoidValidateFull(){foreach(varvalueinValues){value.ValidateFull();}}}}
Component(s)
C#
The text was updated successfully, but these errors were encountered:
Describe the enhancement requested
Hello,
I would like use more user friendly methods to serialize/deserialize c# objects creating scalars, specifically for nested structures
But i have doubts if this is a good start implementation or completly wrong, any advice or correction ?
Br
Nick
Currently it looks like
Interfaces:
Scalar structs:
Component(s)
C#
The text was updated successfully, but these errors were encountered: