Repository: apache/arrow
File: cpp/src/parquet/types.cc (C++)

Code before:
  DCHECK(bit_width == 64 || bit_width == 32 || bit_width == 16 || bit_width == 8);
  return IntLogicalType::Make(bit_width, is_signed);
}

std::shared_ptr<const LogicalType> LogicalType::Null() { return NullLogicalType::Make(); }

std::shared_ptr<const LogicalType> LogicalType::JSON() { return JSONLogicalType::Make(); }

std::shared_ptr<const LogicalType> LogicalType::BSON() { return BSONLogicalType::Make(); }

std::shared_ptr<const LogicalType> LogicalType::UUID() { return UUIDLogicalType::Make(); }

std::shared_ptr<const LogicalType> LogicalType::Float16() {
  return Float16LogicalType::Make();
}

std::shared_ptr<const LogicalType> LogicalType::Geometry(std::string crs) {
  return GeometryLogicalType::Make(std::move(crs));
}

std::shared_ptr<const LogicalType> LogicalType::Geography(
    std::string crs, LogicalType::EdgeInterpolationAlgorithm algorithm) {
  return GeographyLogicalType::Make(std::move(crs), algorithm);
}

std::shared_ptr<const LogicalType> LogicalType::Variant(int8_t specVersion) {
  return VariantLogicalType::Make(specVersion);
}

std::shared_ptr<const LogicalType> LogicalType::None() { return NoLogicalType::Make(); }

/*
 * The logical type implementation classes are built in four layers: (1) the base
 * layer, which establishes the interface and provides generally reusable implementations
 * for the ToJSON() and Equals() methods; (2) an intermediate derived layer for the
 * "compatibility" methods, which provides implementations for is_compatible() and
 * ToConvertedType(); (3) another intermediate layer for the "applicability" methods
 * that provides several implementations for the is_applicable() method; and (4) the
 * final derived classes, one for each logical type, which supply implementations
 * for those methods that remain virtual (usually just ToString() and ToThrift()) or
 * otherwise need to be overridden.
 */

// LogicalTypeImpl base class

class LogicalType::Impl {
 public:
  virtual bool is_applicable(parquet::Type::type primitive_type,
                             int32_t primitive_length = -1) const = 0;

  virtual bool is_compatible(ConvertedType::type converted_type,

Review comment (suggestion):
```suggestion
std::shared_ptr<const LogicalType> LogicalType::Variant(int8_t spec_version) {
```

Code after:
std::shared_ptr<const LogicalType> LogicalType::Interval() {
  return IntervalLogicalType::Make();
}

std::shared_ptr<const LogicalType> LogicalType::Int(int bit_width, bool is_signed) {
  DCHECK(bit_width == 64 || bit_width == 32 || bit_width == 16 || bit_width == 8);
  return IntLogicalType::Make(bit_width, is_signed);
}

std::shared_ptr<const LogicalType> LogicalType::Null() { return NullLogicalType::Make(); }

std::shared_ptr<const LogicalType> LogicalType::JSON() { return JSONLogicalType::Make(); }

std::shared_ptr<const LogicalType> LogicalType::BSON() { return BSONLogicalType::Make(); }

std::shared_ptr<const LogicalType> LogicalType::UUID() { return UUIDLogicalType::Make(); }

std::shared_ptr<const LogicalType> LogicalType::Float16() {
  return Float16LogicalType::Make();
}

std::shared_ptr<const LogicalType> LogicalType::Geometry(std::string crs) {
  return GeometryLogicalType::Make(std::move(crs));
}

std::shared_ptr<const LogicalType> LogicalType::Geography(
    std::string crs, LogicalType::EdgeInterpolationAlgorithm algorithm) {
  return GeographyLogicalType::Make(std::move(crs), algorithm);
}

std::shared_ptr<const LogicalType> LogicalType::Variant(int8_t spec_version) {
  return VariantLogicalType::Make(spec_version);
}

std::shared_ptr<const LogicalType> LogicalType::None() { return NoLogicalType::Make(); }

/*
 * The logical type implementation classes are built in four layers: (1) the base
 * layer, which establishes the interface and provides generally reusable implementations
 * for the ToJSON() and Equals() methods; (2) an intermediate derived layer for the
 * "compatibility" methods, which provides implementations for is_compatible() and
 * ToConvertedType(); (3) another intermediate layer for the "applicability" methods
 * that provides several implementations for the is_applicable() method; and (4) the
 * final derived classes, one for each logical type, which supply implementations
 * for those methods that remain virtual (usually just ToString() and ToThrift()) or
 * otherwise need to be overridden.
 */

// LogicalTypeImpl base class

class LogicalType::Impl {