public ArrayColumnReader(int rowCount, IClickHouseColumnTypeInfo elementType) { _rowCount = rowCount; _elementType = elementType; _ranges = new List <(int offset, int length)>(_rowCount); }
public ArrayColumnWriterDispatcher(string columnName, string columnType, object rows, ClickHouseColumnSettings?columnSettings, IClickHouseColumnTypeInfo elementTypeInfo) { _columnName = columnName; _columnType = columnType; _rows = rows; _columnSettings = columnSettings; _elementTypeInfo = elementTypeInfo; }
public NullableTypeInfo(IClickHouseColumnTypeInfo underlyingType) { if (underlyingType is NullableTypeInfo) { throw new ArgumentException("The underlying type can't be nullable.", nameof(underlyingType)); } UnderlyingType = underlyingType ?? throw new ArgumentNullException(nameof(underlyingType)); ComplexTypeName = $"{TypeName}({UnderlyingType.ComplexTypeName})"; }
public MultiDimensionalArrayColumnWriterDispatcher( string columnName, string columnType, IReadOnlyList <Array> rows, ClickHouseColumnSettings?columnSettings, IClickHouseColumnTypeInfo elementTypeInfo, Func <Array, object> dispatchArray) { _columnName = columnName; _columnType = columnType; _rows = rows; _columnSettings = columnSettings; _elementTypeInfo = elementTypeInfo; _dispatchArray = dispatchArray; }
public LowCardinalityColumnReader(int rowCount, IClickHouseColumnTypeInfo baseType) { _rowCount = rowCount; if (baseType is NullableTypeInfo nullableBaseType) { if (nullableBaseType.UnderlyingType == null) { throw new ClickHouseException(ClickHouseErrorCodes.TypeNotFullySpecified, $"The type \"{baseType.ComplexTypeName}\" is not fully specified."); } // LowCardinality column stores NULL as the key 0 _baseType = nullableBaseType.UnderlyingType; } else { _baseType = baseType; } }
public override void Format(IClickHouseColumnTypeInfo keyType, IClickHouseColumnTypeInfo valueType, StringBuilder queryStringBuilder, object untypedMap) { var map = (IReadOnlyDictionary <TKey, TValue>)untypedMap; queryStringBuilder.Append("tuple(["); { var needComma = false; foreach (var(key, _) in map) { if (needComma) { queryStringBuilder.Append(','); } else { needComma = true; } keyType.FormatValue(queryStringBuilder, key); } } queryStringBuilder.Append("],["); { var needComma = false; foreach (var(_, value) in map) { if (needComma) { queryStringBuilder.Append(','); } else { needComma = true; } keyType.FormatValue(queryStringBuilder, value); } } queryStringBuilder.Append("])"); }
private ArrayTypeInfo(IClickHouseColumnTypeInfo elementTypeInfo) { _elementTypeInfo = elementTypeInfo ?? throw new ArgumentNullException(nameof(elementTypeInfo)); _exposedElementHeaderSize = GetExposedElementHeaderSize(elementTypeInfo); ComplexTypeName = $"{TypeName}({_elementTypeInfo.ComplexTypeName})"; }
private LowCardinalityTypeInfo(IClickHouseColumnTypeInfo baseType) { _baseType = baseType ?? throw new ArgumentNullException(nameof(baseType)); ComplexTypeName = $"{TypeName}({_baseType.ComplexTypeName})"; }
public IClickHouseColumnWriter Dispatch(string columnName, object rows, ClickHouseColumnSettings?columnSettings, IClickHouseColumnTypeInfo underlyingTypeInfo) { var genericList = (IReadOnlyList <TValue?>)rows; var listWrapper = new MappedReadOnlyList <TValue?, TValue>(genericList, item => item ?? default); return(underlyingTypeInfo.CreateColumnWriter(columnName, listWrapper, columnSettings)); }
public NullableColumnWriter(string columnName, string columnType, IReadOnlyList <T> rows, ClickHouseColumnSettings?columnSettings, IClickHouseColumnTypeInfo underlyingTypeInfo) { if (underlyingTypeInfo == null) { throw new ArgumentNullException(nameof(underlyingTypeInfo)); } _rows = rows ?? throw new ArgumentNullException(nameof(rows)); ColumnName = columnName ?? throw new ArgumentNullException(nameof(columnName)); ColumnType = columnType ?? throw new ArgumentNullException(nameof(columnType)); if (typeof(T).IsValueType && typeof(T).IsGenericType && typeof(T).GetGenericTypeDefinition() == typeof(Nullable <>)) { var valueType = typeof(T).GetGenericArguments()[0]; var dispatcherType = typeof(ValueOrDefaultListDispatcher <>).MakeGenericType(valueType); var columnDispatcher = (IValueOrDefaultListDispatcherBase)Activator.CreateInstance(dispatcherType) !; _internalColumnWriter = columnDispatcher.Dispatch(columnName, rows, columnSettings, underlyingTypeInfo); } else { _internalColumnWriter = underlyingTypeInfo.CreateColumnWriter(columnName, rows, columnSettings); } }
public NullableColumnReader(int rowCount, IClickHouseColumnTypeInfo underlyingType) { _rowCount = rowCount; _underlyingType = underlyingType; }
public ColumnInfo(string name, IClickHouseColumnTypeInfo typeInfo) { Name = name; TypeInfo = typeInfo; }
public LowCardinalitySkippingColumnReader(int rowCount, IClickHouseColumnTypeInfo baseType) { _rowCount = rowCount; _baseType = baseType; }
public LowCardinalityColumnReader(int rowCount, IClickHouseColumnTypeInfo baseType, bool isNullable) { _rowCount = rowCount; _baseType = baseType; _isNullable = isNullable; }
private MapTypeInfo(IClickHouseColumnTypeInfo keyType, IClickHouseColumnTypeInfo valueType, IClickHouseColumnTypeInfo underlyingType) { _typeArgs = new KeyValuePair <IClickHouseColumnTypeInfo, IClickHouseColumnTypeInfo>(keyType, valueType); ComplexTypeName = $"{TypeName}({keyType.ComplexTypeName}, {valueType.ComplexTypeName})"; _underlyingType = underlyingType; }
public abstract void Format(IClickHouseColumnTypeInfo keyType, IClickHouseColumnTypeInfo valueType, StringBuilder queryStringBuilder, object map);