in csharp/src/Client/SchemaConverter.cs [138:220]
public static Type GetArrowType(Field f, DecimalBehavior decimalBehavior, StructBehavior structBehavior)
{
switch (f.DataType.TypeId)
{
case ArrowTypeId.Binary:
return typeof(byte[]);
case ArrowTypeId.Boolean:
return typeof(bool);
case ArrowTypeId.Decimal128:
if (decimalBehavior == DecimalBehavior.UseSqlDecimal)
return typeof(SqlDecimal);
else
return typeof(decimal);
case ArrowTypeId.Decimal256:
return typeof(string);
#if NET6_0_OR_GREATER
case ArrowTypeId.Time32:
case ArrowTypeId.Time64:
return typeof(TimeOnly);
#else
case ArrowTypeId.Time32:
case ArrowTypeId.Time64:
return typeof(TimeSpan);
#endif
case ArrowTypeId.Date32:
case ArrowTypeId.Date64:
return typeof(DateTime);
case ArrowTypeId.Double:
return typeof(double);
#if NET5_0_OR_GREATER
case ArrowTypeId.HalfFloat:
return typeof(Half);
#endif
case ArrowTypeId.Float:
return typeof(float);
case ArrowTypeId.Int8:
return typeof(sbyte);
case ArrowTypeId.Int16:
return typeof(short);
case ArrowTypeId.Int32:
return typeof(int);
case ArrowTypeId.Int64:
return typeof(long);
case ArrowTypeId.String:
return typeof(string);
case ArrowTypeId.Struct:
return structBehavior == StructBehavior.JsonString ? typeof(string) : typeof(Dictionary<string, object?>);
case ArrowTypeId.Timestamp:
return typeof(DateTimeOffset);
case ArrowTypeId.Null:
return typeof(DBNull);
case ArrowTypeId.Interval:
switch (((IntervalType)f.DataType).Unit)
{
case IntervalUnit.MonthDayNanosecond:
return typeof(MonthDayNanosecondInterval);
case IntervalUnit.DayTime:
return typeof(DayTimeInterval);
case IntervalUnit.YearMonth:
return typeof(YearMonthInterval);
}
goto default;
default:
return f.DataType.GetType();
}
}