You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2021/04/19 15:54:34 UTC

[GitHub] [orc] boroknagyz commented on a change in pull request #682: ORC-781: [C++] Make type annotations available from C++

boroknagyz commented on a change in pull request #682:
URL: https://github.com/apache/orc/pull/682#discussion_r615971579



##########
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've added hasAttributeKey() to Type, and throw std::range_error in removeAttribute() and getAttributeValue() when key is not present




-- 
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:
users@infra.apache.org