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

Function DoMakeComparator

cpp/src/parquet/statistics.cc:1047–1099  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1045}
1046
1047std::shared_ptr<Comparator> DoMakeComparator(Type::type physical_type,
1048 LogicalType::Type::type logical_type,
1049 SortOrder::type sort_order,
1050 int type_length) {
1051 if (SortOrder::SIGNED == sort_order) {
1052 switch (physical_type) {
1053 case Type::BOOLEAN:
1054 return std::make_shared<TypedComparatorImpl<true, BooleanType>>();
1055 case Type::INT32:
1056 return std::make_shared<TypedComparatorImpl<true, Int32Type>>();
1057 case Type::INT64:
1058 return std::make_shared<TypedComparatorImpl<true, Int64Type>>();
1059 case Type::INT96:
1060 return std::make_shared<TypedComparatorImpl<true, Int96Type>>();
1061 case Type::FLOAT:
1062 return std::make_shared<TypedComparatorImpl<true, FloatType>>();
1063 case Type::DOUBLE:
1064 return std::make_shared<TypedComparatorImpl<true, DoubleType>>();
1065 case Type::BYTE_ARRAY:
1066 return std::make_shared<TypedComparatorImpl<true, ByteArrayType>>();
1067 case Type::FIXED_LEN_BYTE_ARRAY:
1068 if (logical_type == LogicalType::Type::FLOAT16) {
1069 return std::make_shared<TypedComparatorImpl<true, Float16LogicalType>>(
1070 type_length);
1071 }
1072 if (logical_type == LogicalType::Type::TIMESTAMP) {
1073 return std::make_shared<TypedComparatorImpl<true, Flba12TimestampType>>(
1074 type_length);
1075 }
1076 return std::make_shared<TypedComparatorImpl<true, FLBAType>>(type_length);
1077 default:
1078 ParquetException::NYI("Signed Compare not implemented");
1079 }
1080 } else if (SortOrder::UNSIGNED == sort_order) {
1081 switch (physical_type) {
1082 case Type::INT32:
1083 return std::make_shared<TypedComparatorImpl<false, Int32Type>>();
1084 case Type::INT64:
1085 return std::make_shared<TypedComparatorImpl<false, Int64Type>>();
1086 case Type::INT96:
1087 return std::make_shared<TypedComparatorImpl<false, Int96Type>>();
1088 case Type::BYTE_ARRAY:
1089 return std::make_shared<TypedComparatorImpl<false, ByteArrayType>>();
1090 case Type::FIXED_LEN_BYTE_ARRAY:
1091 return std::make_shared<TypedComparatorImpl<false, FLBAType>>(type_length);
1092 default:
1093 ParquetException::NYI("Unsigned Compare not implemented");
1094 }
1095 } else {
1096 throw ParquetException("UNKNOWN Sort Order");
1097 }
1098 return nullptr;
1099}
1100
1101} // namespace
1102

Callers 1

MakeMethod · 0.85

Calls 2

NYIFunction · 0.85
ParquetExceptionFunction · 0.85

Tested by

no test coverage detected