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

Code before:

std::shared_ptr<const LogicalType> GeographyLogicalType::Make(
    std::string crs, LogicalType::EdgeInterpolationAlgorithm algorithm) {
  auto logical_type = std::shared_ptr<GeographyLogicalType>(new GeographyLogicalType());
  logical_type->impl_.reset(new LogicalType::Impl::Geography(std::move(crs), algorithm));
  return logical_type;
}
class LogicalType::Impl::Variant final : public LogicalType::Impl::Incompatible,
                                         public LogicalType::Impl::Inapplicable {
 public:
  friend class VariantLogicalType;

  std::string ToString() const override;
  std::string ToJSON() const override;
  format::LogicalType ToThrift() const override;

  int8_t spec_version() const { return specVersion_; }

 private:
  explicit Variant(const int8_t specVersion)
      : LogicalType::Impl(LogicalType::Type::VARIANT, SortOrder::UNKNOWN),
        LogicalType::Impl::Inapplicable() {
    this->specVersion_ = specVersion;
  }

  int8_t specVersion_;
};

int8_t VariantLogicalType::spec_version() const {
  return (dynamic_cast<const LogicalType::Impl::Variant&>(*impl_)).spec_version();
}

std::string LogicalType::Impl::Variant::ToString() const {
  std::stringstream type;
  type << "Variant(" << static_cast<int>(specVersion_) << ")";
  return type.str();
}

std::string LogicalType::Impl::Variant::ToJSON() const {
  std::stringstream json;
  json << R"({"Type": "Variant", "SpecVersion": )" << static_cast<int>(specVersion_)
       << "}";

  return json.str();
}

format::LogicalType LogicalType::Impl::Variant::ToThrift() const {
  format::LogicalType type;
  format::VariantType variant_type;
  variant_type.__set_specification_version(specVersion_);
  type.__set_VARIANT(variant_type);

Review comment (suggestion):
Fix casing.
```suggestion
  int8_t spec_version_;
```

Code after:
}

std::string_view GeographyLogicalType::algorithm_name() const {
  return (dynamic_cast<const LogicalType::Impl::Geography&>(*impl_)).algorithm_name();
}

std::shared_ptr<const LogicalType> GeographyLogicalType::Make(
    std::string crs, LogicalType::EdgeInterpolationAlgorithm algorithm) {
  auto logical_type = std::shared_ptr<GeographyLogicalType>(new GeographyLogicalType());
  logical_type->impl_.reset(new LogicalType::Impl::Geography(std::move(crs), algorithm));
  return logical_type;
}
class LogicalType::Impl::Variant final : public LogicalType::Impl::Incompatible,
                                         public LogicalType::Impl::Inapplicable {
 public:
  friend class VariantLogicalType;

  std::string ToString() const override;
  std::string ToJSON() const override;
  format::LogicalType ToThrift() const override;

  int8_t spec_version() const { return spec_version_; }

 private:
  explicit Variant(const int8_t spec_version)
      : LogicalType::Impl(LogicalType::Type::VARIANT, SortOrder::UNKNOWN),
        LogicalType::Impl::Inapplicable() {
    this->spec_version_ = spec_version;
  }

  int8_t spec_version_;
};

int8_t VariantLogicalType::spec_version() const {
  return (dynamic_cast<const LogicalType::Impl::Variant&>(*impl_)).spec_version();
}

std::string LogicalType::Impl::Variant::ToString() const {
  std::stringstream type;
  type << "Variant(" << static_cast<int>(spec_version_) << ")";
  return type.str();
}

std::string LogicalType::Impl::Variant::ToJSON() const {
  std::stringstream json;
  json << R"({"Type": "Variant", "SpecVersion": )" << static_cast<int>(spec_version_)
       << "}";

  return json.str();
}