Browse Source

Update contrib/libs/apache/avro to 1.11.3

thegeorg 1 year ago
parent
commit
49b4f30439

+ 2 - 2
contrib/libs/apache/avro/CMakeLists.darwin-x86_64.txt

@@ -10,7 +10,7 @@
 add_library(libs-apache-avro)
 target_compile_options(libs-apache-avro PRIVATE
   -DAVRO_SOURCE
-  -DAVRO_VERSION="1.11.1"
+  -DAVRO_VERSION="1.11.3"
   -DSNAPPY_CODEC_AVAILABLE
   $<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>
 )
@@ -31,7 +31,7 @@ target_sources(libs-apache-avro PRIVATE
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/BinaryDecoder.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/BinaryEncoder.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/Compiler.cc
-  ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/CustomFields.cc
+  ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/CustomAttributes.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/DataFile.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/FileStream.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/Generic.cc

+ 2 - 2
contrib/libs/apache/avro/CMakeLists.linux-aarch64.txt

@@ -10,7 +10,7 @@
 add_library(libs-apache-avro)
 target_compile_options(libs-apache-avro PRIVATE
   -DAVRO_SOURCE
-  -DAVRO_VERSION="1.11.1"
+  -DAVRO_VERSION="1.11.3"
   -DSNAPPY_CODEC_AVAILABLE
   $<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>
 )
@@ -32,7 +32,7 @@ target_sources(libs-apache-avro PRIVATE
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/BinaryDecoder.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/BinaryEncoder.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/Compiler.cc
-  ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/CustomFields.cc
+  ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/CustomAttributes.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/DataFile.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/FileStream.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/Generic.cc

+ 2 - 2
contrib/libs/apache/avro/CMakeLists.linux-x86_64.txt

@@ -10,7 +10,7 @@
 add_library(libs-apache-avro)
 target_compile_options(libs-apache-avro PRIVATE
   -DAVRO_SOURCE
-  -DAVRO_VERSION="1.11.1"
+  -DAVRO_VERSION="1.11.3"
   -DSNAPPY_CODEC_AVAILABLE
   $<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>
 )
@@ -32,7 +32,7 @@ target_sources(libs-apache-avro PRIVATE
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/BinaryDecoder.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/BinaryEncoder.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/Compiler.cc
-  ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/CustomFields.cc
+  ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/CustomAttributes.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/DataFile.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/FileStream.cc
   ${CMAKE_SOURCE_DIR}/contrib/libs/apache/avro/impl/Generic.cc

+ 4 - 4
contrib/libs/apache/avro/api/AvroTraits.hh

@@ -60,10 +60,10 @@ struct is_defined {
     typedef char no[2];
 
     template<class U>
-    static yes &test(char (*)[sizeof(U)]) { throw 0; };
+    static yes &test(char (*)[sizeof(U)]) { throw 0; }
 
     template<class U>
-    static no &test(...) { throw 0; };
+    static no &test(...) { throw 0; }
 
     static const bool value = sizeof(test<T>(0)) == sizeof(yes);
 };
@@ -82,10 +82,10 @@ struct is_not_defined {
     typedef char no[2];
 
     template<class U>
-    static yes &test(char (*)[sizeof(U)]) { throw 0; };
+    static yes &test(char (*)[sizeof(U)]) { throw 0; }
 
     template<class U>
-    static no &test(...) { throw 0; };
+    static no &test(...) { throw 0; }
 
     static const bool value = sizeof(test<T>(0)) == sizeof(no);
 };

+ 56 - 0
contrib/libs/apache/avro/api/CustomAttributes.hh

@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+#ifndef avro_CustomAttributes_hh__
+#define avro_CustomAttributes_hh__
+
+#include <boost/optional.hpp>
+#include <iostream>
+#include <map>
+#include <string>
+#include "Config.hh"
+
+namespace avro {
+
+// CustomAttributes class stores avro custom attributes.
+// Each attribute is represented by a unique name and value.
+// User is supposed to create CustomAttributes object and then add it to Schema.
+class AVRO_DECL CustomAttributes {
+  public:
+    // Retrieves the custom attribute json entity for that attributeName, returns an
+    // null if the attribute doesn't exist.
+    boost::optional<std::string> getAttribute(const std::string &name) const;
+
+    // Adds a custom attribute. If the attribute already exists, throw an exception.
+    void addAttribute(const std::string &name, const std::string &value);
+
+    // Provides a way to iterate over the custom attributes or check attribute size.
+    const std::map<std::string, std::string> &attributes() const {
+        return attributes_;
+    }
+
+    // Prints the attribute value for the specific attribute.
+    void printJson(std::ostream& os, const std::string &name) const;
+
+  private:
+    std::map<std::string, std::string> attributes_;
+};
+
+}  // namespace avro
+
+#endif

+ 0 - 55
contrib/libs/apache/avro/api/CustomFields.hh

@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef avro_CustomFields_hh__
-#define avro_CustomFields_hh__
-
-#include <iostream>
-
-#include "../impl/json/JsonDom.hh"
-
-namespace avro {
-
-// CustomFields class stores avro custom attributes.
-// Each field is represented by a unique name and value.
-// User is supposed to create CustomFields object and then add it to Schema.
-class AVRO_DECL CustomFields {
-  public:
-    // Retrieves the custom field json entity for that fieldName, returns an
-    // null Entity if the field doesn't exist.
-    json::Entity getField(const std::string &fieldName) const;
-
-    // Adds a custom field. If the field already exists, throw an exception.
-    void addField(const std::string &fieldName, const json::Entity &fieldValue);
-    void addField(const std::string &fieldName, const std::string &fieldValue);
-
-    // Provides a way to iterate over the custom fields or check field size.
-    const std::map<std::string, json::Entity> &fields() const {
-        return fields_;
-    }
-
-    // Prints the json string for the specific field.
-    void printJson(std::ostream& os, const std::string &fieldName) const;
-
-  private:
-    std::map<std::string, json::Entity> fields_;
-};
-
-}  // namespace avro
-
-#endif

+ 3 - 3
contrib/libs/apache/avro/api/Node.hh

@@ -26,7 +26,7 @@
 #include <memory>
 #include <utility>
 
-#include "CustomFields.hh"
+#include "CustomAttributes.hh"
 #include "Exception.hh"
 #include "LogicalType.hh"
 #include "SchemaResolution.hh"
@@ -154,7 +154,7 @@ public:
     }
     virtual size_t fixedSize() const = 0;
 
-    void addCustomAttributesForField(const CustomFields& customAttributes) {
+    void addCustomAttributesForField(const CustomAttributes& customAttributes) {
         checkLock();
         doAddCustomAttribute(customAttributes);
     }
@@ -191,7 +191,7 @@ protected:
     virtual void doAddLeaf(const NodePtr &newLeaf) = 0;
     virtual void doAddName(const std::string &name) = 0;
     virtual void doSetFixedSize(size_t size) = 0;
-    virtual void doAddCustomAttribute(const CustomFields& customFields) = 0;
+    virtual void doAddCustomAttribute(const CustomAttributes& customAttributes) = 0;
 
 private:
     const Type type_;

+ 7 - 7
contrib/libs/apache/avro/api/NodeImpl.hh

@@ -32,7 +32,7 @@
 
 #include "Node.hh"
 #include "NodeConcepts.hh"
-#include "CustomFields.hh"
+#include "CustomAttributes.hh"
 
 namespace avro {
 
@@ -160,8 +160,8 @@ protected:
 
     void setLeafToSymbolic(size_t index, const NodePtr &node) override;
 
-    void doAddCustomAttribute(const CustomFields &customfields) override {
-      customAttributes_.add(customfields);
+    void doAddCustomAttribute(const CustomAttributes &customAttributes) override {
+      customAttributes_.add(customAttributes);
     }
 
     SchemaResolution furtherResolution(const Node &reader) const {
@@ -223,8 +223,8 @@ using MultiLeaves = concepts::MultiAttribute<NodePtr>;
 
 using NoLeafNames = concepts::NoAttribute<std::string>;
 using LeafNames = concepts::MultiAttribute<std::string>;
-using MultiAttributes = concepts::MultiAttribute<CustomFields>;
-using NoAttributes = concepts::NoAttribute<CustomFields>;
+using MultiAttributes = concepts::MultiAttribute<CustomAttributes>;
+using NoAttributes = concepts::NoAttribute<CustomAttributes>;
 
 using NoSize = concepts::NoAttribute<int>;
 using HasSize = concepts::SingleAttribute<int>;
@@ -544,9 +544,9 @@ NodeImpl<A, B, C, D, E>::printBasicInfo(std::ostream &os) const {
         os << " " << sizeAttribute_.get();
     }
     os << '\n';
-    int count = leaves();
+    size_t count = leaves();
     count = count ? count : names();
-    for (int i = 0; i < count; ++i) {
+    for (size_t i = 0; i < count; ++i) {
         if (C::hasAttribute) {
             os << "name " << nameAt(i) << '\n';
         }

+ 1 - 1
contrib/libs/apache/avro/api/Reader.hh

@@ -84,7 +84,7 @@ public:
         union {
             double d;
             uint64_t i;
-        } v;
+        } v = { 0 };
         reader_.read(v.i);
         val = v.d;
     }

+ 2 - 2
contrib/libs/apache/avro/api/Schema.hh

@@ -21,7 +21,7 @@
 
 #include "Config.hh"
 #include "NodeImpl.hh"
-#include "CustomFields.hh"
+#include "CustomAttributes.hh"
 #include <string>
 
 /// \file
@@ -103,7 +103,7 @@ public:
     void addField(const std::string &name, const Schema &fieldSchema);
     // Add a field with custom attributes
     void addField(const std::string &name, const Schema &fieldSchema,
-                  const CustomFields &customFields);
+                  const CustomAttributes &customAttributes);
 
     std::string getDoc() const;
     void setDoc(const std::string &);

Some files were not shown because too many files changed in this diff