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

Function DoMakeComparator

cpp/src/parquet/statistics.cc:992–1040  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

990}
991
992std::shared_ptr<Comparator> DoMakeComparator(Type::type physical_type,
993 LogicalType::Type::type logical_type,
994 SortOrder::type sort_order,
995 int type_length) {
996 if (SortOrder::SIGNED == sort_order) {
997 switch (physical_type) {
998 case Type::BOOLEAN:
999 return std::make_shared<TypedComparatorImpl<true, BooleanType>>();
1000 case Type::INT32:
1001 return std::make_shared<TypedComparatorImpl<true, Int32Type>>();
1002 case Type::INT64:
1003 return std::make_shared<TypedComparatorImpl<true, Int64Type>>();
1004 case Type::INT96:
1005 return std::make_shared<TypedComparatorImpl<true, Int96Type>>();
1006 case Type::FLOAT:
1007 return std::make_shared<TypedComparatorImpl<true, FloatType>>();
1008 case Type::DOUBLE:
1009 return std::make_shared<TypedComparatorImpl<true, DoubleType>>();
1010 case Type::BYTE_ARRAY:
1011 return std::make_shared<TypedComparatorImpl<true, ByteArrayType>>();
1012 case Type::FIXED_LEN_BYTE_ARRAY:
1013 if (logical_type == LogicalType::Type::FLOAT16) {
1014 return std::make_shared<TypedComparatorImpl<true, Float16LogicalType>>(
1015 type_length);
1016 }
1017 return std::make_shared<TypedComparatorImpl<true, FLBAType>>(type_length);
1018 default:
1019 ParquetException::NYI("Signed Compare not implemented");
1020 }
1021 } else if (SortOrder::UNSIGNED == sort_order) {
1022 switch (physical_type) {
1023 case Type::INT32:
1024 return std::make_shared<TypedComparatorImpl<false, Int32Type>>();
1025 case Type::INT64:
1026 return std::make_shared<TypedComparatorImpl<false, Int64Type>>();
1027 case Type::INT96:
1028 return std::make_shared<TypedComparatorImpl<false, Int96Type>>();
1029 case Type::BYTE_ARRAY:
1030 return std::make_shared<TypedComparatorImpl<false, ByteArrayType>>();
1031 case Type::FIXED_LEN_BYTE_ARRAY:
1032 return std::make_shared<TypedComparatorImpl<false, FLBAType>>(type_length);
1033 default:
1034 ParquetException::NYI("Unsigned Compare not implemented");
1035 }
1036 } else {
1037 throw ParquetException("UNKNOWN Sort Order");
1038 }
1039 return nullptr;
1040}
1041
1042} // namespace
1043

Callers 1

MakeMethod · 0.85

Calls 2

NYIFunction · 0.85
ParquetExceptionFunction · 0.85

Tested by

no test coverage detected