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

Method Make

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

Source from the content-addressed store, hash-verified

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

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