wgtmac commented on a change in pull request #682:
URL: https://github.com/apache/orc/pull/682#discussion_r614643081
##########
File path: c++/include/orc/Type.hh
##########
@@ -58,6 +58,11 @@ namespace orc {
virtual uint64_t getMaximumLength() const = 0;
virtual uint64_t getPrecision() const = 0;
virtual uint64_t getScale() const = 0;
+ virtual Type& setAttribute(const std::string& key,
Review comment:
What's the benefit to make return type as Type& for setAttribute() and
removeAttribute() ? Is it better to make it void?
##########
File path: c++/src/TypeImpl.cc
##########
@@ -121,6 +121,32 @@ namespace orc {
return scale;
}
+ Type& TypeImpl::setAttribute(const std::string& key,
+ const std::string& value) {
+ attributes[key] = value;
+ return *this;
+ }
+
+ Type& TypeImpl::removeAttribute(const std::string& key) {
+ attributes.erase(key);
+ return *this;
+ }
+
+ std::vector<std::string> TypeImpl::getAttributeKeys() const {
+ std::vector<std::string> ret;
+ ret.reserve(attributes.size());
+ for (auto& attribute : attributes) {
+ ret.push_back(attribute.first);
+ }
+ return ret;
+ }
+
+ std::string TypeImpl::getAttributeValue(const std::string& key) const {
Review comment:
I'd prefer to add a new interface`bool hasAttributeKey(const
std::string& key) const` to check existence and throw here if the key does not
exist.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]