[ 
https://issues.apache.org/jira/browse/AVRO-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16431026#comment-16431026
 ] 

ASF GitHub Bot commented on AVRO-1702:
--------------------------------------

aprgoog commented on a change in pull request #302: AVRO-1702: Added support 
for logical types in the C++ client.
URL: https://github.com/apache/avro/pull/302#discussion_r180186435
 
 

 ##########
 File path: lang/c++/impl/LogicalType.cc
 ##########
 @@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Exception.hh"
+#include "LogicalType.hh"
+
+namespace avro {
+
+LogicalType::LogicalType(Type type)
+    : type_(type), precision_(0), scale_(0) {}
+
+LogicalType::Type LogicalType::type() const {
+    return type_;
+}
+
+void LogicalType::setPrecision(int precision) {
+    if (type_ != DECIMAL) {
+        throw Exception("Only logical type DECIMAL can have precision");
+    }
+    if (precision <= 0) {
+        throw Exception(boost::format("Precision cannot be: %1%") % precision);
+    }
+    precision_ = precision;
+}
+
+int LogicalType::precision() const {
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Add LogicalType support to c++ library
> --------------------------------------
>
>                 Key: AVRO-1702
>                 URL: https://issues.apache.org/jira/browse/AVRO-1702
>             Project: Avro
>          Issue Type: New Feature
>          Components: c++
>            Reporter: peter liu
>            Assignee: peter liu
>            Priority: Major
>
> I'd like to port the logicaltype support to c++ library



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to