| 283 | } |
| 284 | |
| 285 | Field decodeField(ReadBuffer & buf) |
| 286 | { |
| 287 | UInt8 type = 0; |
| 288 | readBinary(type, buf); |
| 289 | switch (FieldBinaryTypeIndex(type)) |
| 290 | { |
| 291 | case FieldBinaryTypeIndex::Null: |
| 292 | return Null(); |
| 293 | case FieldBinaryTypeIndex::PositiveInfinity: |
| 294 | return POSITIVE_INFINITY; |
| 295 | case FieldBinaryTypeIndex::NegativeInfinity: |
| 296 | return NEGATIVE_INFINITY; |
| 297 | case FieldBinaryTypeIndex::Int64: |
| 298 | { |
| 299 | Int64 value = 0; |
| 300 | readVarInt(value, buf); |
| 301 | return value; |
| 302 | } |
| 303 | case FieldBinaryTypeIndex::UInt64: |
| 304 | { |
| 305 | UInt64 value = 0; |
| 306 | readVarUInt(value, buf); |
| 307 | return value; |
| 308 | } |
| 309 | case FieldBinaryTypeIndex::Int128: |
| 310 | return decodeBigInteger<Int128>(buf); |
| 311 | case FieldBinaryTypeIndex::UInt128: |
| 312 | return decodeBigInteger<UInt128>(buf); |
| 313 | case FieldBinaryTypeIndex::Int256: |
| 314 | return decodeBigInteger<Int256>(buf); |
| 315 | case FieldBinaryTypeIndex::UInt256: |
| 316 | return decodeBigInteger<UInt256>(buf); |
| 317 | case FieldBinaryTypeIndex::Float64: |
| 318 | return decodeValueLittleEndian<Float64>(buf); |
| 319 | case FieldBinaryTypeIndex::Decimal32: |
| 320 | return decodeDecimal<Decimal32>(buf); |
| 321 | case FieldBinaryTypeIndex::Decimal64: |
| 322 | return decodeDecimal<Decimal64>(buf); |
| 323 | case FieldBinaryTypeIndex::Decimal128: |
| 324 | return decodeDecimal<Decimal128>(buf); |
| 325 | case FieldBinaryTypeIndex::Decimal256: |
| 326 | return decodeDecimal<Decimal256>(buf); |
| 327 | case FieldBinaryTypeIndex::String: |
| 328 | { |
| 329 | String value; |
| 330 | readStringBinary(value, buf); |
| 331 | return value; |
| 332 | } |
| 333 | case FieldBinaryTypeIndex::UUID: |
| 334 | return decodeValueLittleEndian<UUID>(buf); |
| 335 | case FieldBinaryTypeIndex::IPv4: |
| 336 | return decodeValueLittleEndian<IPv4>(buf); |
| 337 | case FieldBinaryTypeIndex::IPv6: |
| 338 | return decodeValueLittleEndian<IPv6>(buf); |
| 339 | case FieldBinaryTypeIndex::Bool: |
| 340 | { |
| 341 | bool value = false; |
| 342 | readBinary(value, buf); |