Add ToString method to ColumnDescripotor

This commit is contained in:
Micah Kornfield committed 2019-05-17 11:42:55 -07:00
1 parent e68ca7f9ae
commit 9568a67448
2 files changed
+26 -3

No files matched your search

+24 -3
View File
@@ -16,17 +16,15 @@
// under the License.
#include "parquet/schema.h"
#include "parquet/schema-internal.h"
#include <algorithm>
#include <cstring>
#include <memory>
#include <string>
#include <utility>
#include "arrow/util/logging.h"
#include "parquet/exception.h"
#include "parquet/schema-internal.h"
#include "parquet/thrift.h"
using parquet::format::SchemaElement;
@@ -746,6 +744,29 @@ std::string SchemaDescriptor::ToString() const {
return ss.str();
}
std::string ColumnDescriptor::ToString() const {
std::ostringstream ss;
ss << "column descriptor = {" << std::endl
<< " name: " << name() << std::endl
<< " path: " << path()->ToDotString() << std::endl
<< " physical_type: " << TypeToString(physical_type()) << std::endl
<< " logical_type: " << LogicalTypeToString(logical_type()) << std::endl
<< " max_definition_level: " << max_definition_level() << std::endl
<< " max_repetition_level: " << max_repetition_level() << std::endl;
if (physical_type() == ::parquet::Type::FIXED_LEN_BYTE_ARRAY) {
ss << " length: " << type_length() << std::endl;
}
if (logical_type() == parquet::LogicalType::DECIMAL) {
ss << " precision: " << type_precision() << std::endl
<< " scale: " << type_scale() << std::endl;
}
ss << "}";
return ss.str();
}
int ColumnDescriptor::type_scale() const {
return primitive_node_->decimal_metadata().scale;
}
+2
View File
@@ -353,6 +353,8 @@ class PARQUET_EXPORT ColumnDescriptor {
const schema::NodePtr& schema_node() const { return node_; }
std::string ToString() const;
int type_length() const;
int type_precision() const;