MCPcopy Create free account
hub / github.com/apache/arrow / Make

Method Make

cpp/src/arrow/csv/converter.cc:713–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711 value_type_(value_type) {}
712
713Result<std::shared_ptr<Converter>> Converter::Make(const std::shared_ptr<DataType>& type,
714 const ConvertOptions& options,
715 MemoryPool* pool) {
716 std::shared_ptr<Converter> ptr;
717
718 switch (type->id()) {
719#define CONVERTER_CASE(TYPE_ID, CONVERTER_TYPE) \
720 case TYPE_ID: \
721 ptr.reset(new CONVERTER_TYPE(type, options, pool)); \
722 break;
723
724#define NUMERIC_CONVERTER_CASE(TYPE_ID, TYPE_CLASS) \
725 CONVERTER_CASE(TYPE_ID, \
726 (PrimitiveConverter<TYPE_CLASS, NumericValueDecoder<TYPE_CLASS>>))
727
728#define REAL_CONVERTER_CASE(TYPE_ID, TYPE_CLASS, DECODER) \
729 case TYPE_ID: \
730 ptr = MakeRealConverter<Converter, PrimitiveConverter, TYPE_CLASS, DECODER>( \
731 type, options, pool); \
732 break;
733
734 CONVERTER_CASE(Type::NA, NullConverter)
735 NUMERIC_CONVERTER_CASE(Type::INT8, Int8Type)
736 NUMERIC_CONVERTER_CASE(Type::INT16, Int16Type)
737 NUMERIC_CONVERTER_CASE(Type::INT32, Int32Type)
738 NUMERIC_CONVERTER_CASE(Type::INT64, Int64Type)
739 NUMERIC_CONVERTER_CASE(Type::UINT8, UInt8Type)
740 NUMERIC_CONVERTER_CASE(Type::UINT16, UInt16Type)
741 NUMERIC_CONVERTER_CASE(Type::UINT32, UInt32Type)
742 NUMERIC_CONVERTER_CASE(Type::UINT64, UInt64Type)
743 NUMERIC_CONVERTER_CASE(Type::FLOAT, FloatType)
744 NUMERIC_CONVERTER_CASE(Type::DOUBLE, DoubleType)
745 REAL_CONVERTER_CASE(Type::DECIMAL, Decimal128Type, DecimalValueDecoder)
746 NUMERIC_CONVERTER_CASE(Type::DATE32, Date32Type)
747 NUMERIC_CONVERTER_CASE(Type::DATE64, Date64Type)
748 NUMERIC_CONVERTER_CASE(Type::TIME32, Time32Type)
749 NUMERIC_CONVERTER_CASE(Type::TIME64, Time64Type)
750 NUMERIC_CONVERTER_CASE(Type::DURATION, DurationType)
751 CONVERTER_CASE(Type::BOOL, (PrimitiveConverter<BooleanType, BooleanValueDecoder>))
752 CONVERTER_CASE(Type::BINARY,
753 (PrimitiveConverter<BinaryType, BinaryValueDecoder<false>>))
754 CONVERTER_CASE(Type::LARGE_BINARY,
755 (PrimitiveConverter<LargeBinaryType, BinaryValueDecoder<false>>))
756 CONVERTER_CASE(Type::FIXED_SIZE_BINARY,
757 (PrimitiveConverter<FixedSizeBinaryType, FixedSizeBinaryValueDecoder>))
758
759 case Type::TIMESTAMP:
760 ptr = MakeTimestampConverter<PrimitiveConverter>(type, options, pool);
761 break;
762
763 case Type::STRING:
764 if (options.check_utf8) {
765 ptr = std::make_shared<PrimitiveConverter<StringType, BinaryValueDecoder<true>>>(
766 type, options, pool);
767 } else {
768 ptr = std::make_shared<PrimitiveConverter<StringType, BinaryValueDecoder<false>>>(
769 type, options, pool);
770 }

Callers

nothing calls this directly

Calls 7

index_typeMethod · 0.80
NotImplementedFunction · 0.50
MakeFunction · 0.50
idMethod · 0.45
ToStringMethod · 0.45
value_typeMethod · 0.45
InitializeMethod · 0.45

Tested by

no test coverage detected