aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/apache
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2023-11-12 15:09:39 +0300
committerthegeorg <thegeorg@yandex-team.com>2023-11-12 15:27:56 +0300
commit49b4f30439166504566307aa3507a2c0bcb6dbfa (patch)
tree63a98d8039fd2cddf45ccc57dba96daa8fbd4a06 /contrib/libs/apache
parente4bf7da8cc01e5fd68c54a0d299c2d07c67b0076 (diff)
downloadydb-49b4f30439166504566307aa3507a2c0bcb6dbfa.tar.gz
Update contrib/libs/apache/avro to 1.11.3
Diffstat (limited to 'contrib/libs/apache')
-rw-r--r--contrib/libs/apache/avro/CMakeLists.darwin-x86_64.txt4
-rw-r--r--contrib/libs/apache/avro/CMakeLists.linux-aarch64.txt4
-rw-r--r--contrib/libs/apache/avro/CMakeLists.linux-x86_64.txt4
-rw-r--r--contrib/libs/apache/avro/api/AvroTraits.hh8
-rw-r--r--contrib/libs/apache/avro/api/CustomAttributes.hh56
-rw-r--r--contrib/libs/apache/avro/api/CustomFields.hh55
-rw-r--r--contrib/libs/apache/avro/api/Node.hh6
-rw-r--r--contrib/libs/apache/avro/api/NodeImpl.hh14
-rw-r--r--contrib/libs/apache/avro/api/Reader.hh2
-rw-r--r--contrib/libs/apache/avro/api/Schema.hh4
-rw-r--r--contrib/libs/apache/avro/api/buffer/Buffer.hh2
-rw-r--r--contrib/libs/apache/avro/impl/Compiler.cc16
-rw-r--r--contrib/libs/apache/avro/impl/CustomAttributes.cc53
-rw-r--r--contrib/libs/apache/avro/impl/CustomFields.cc59
-rw-r--r--contrib/libs/apache/avro/impl/DataFile.cc10
-rw-r--r--contrib/libs/apache/avro/impl/NodeImpl.cc12
-rw-r--r--contrib/libs/apache/avro/impl/Resolver.cc2
-rw-r--r--contrib/libs/apache/avro/impl/Schema.cc8
-rw-r--r--contrib/libs/apache/avro/impl/ValidSchema.cc4
-rw-r--r--contrib/libs/apache/avro/impl/Validator.cc2
-rw-r--r--contrib/libs/apache/avro/ya.make10
21 files changed, 165 insertions, 170 deletions
diff --git a/contrib/libs/apache/avro/CMakeLists.darwin-x86_64.txt b/contrib/libs/apache/avro/CMakeLists.darwin-x86_64.txt
index e53e3ffee9..29b2696872 100644
--- a/contrib/libs/apache/avro/CMakeLists.darwin-x86_64.txt
+++ b/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
diff --git a/contrib/libs/apache/avro/CMakeLists.linux-aarch64.txt b/contrib/libs/apache/avro/CMakeLists.linux-aarch64.txt
index d0460bdc9e..1fbc9136af 100644
--- a/contrib/libs/apache/avro/CMakeLists.linux-aarch64.txt
+++ b/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
diff --git a/contrib/libs/apache/avro/CMakeLists.linux-x86_64.txt b/contrib/libs/apache/avro/CMakeLists.linux-x86_64.txt
index d0460bdc9e..1fbc9136af 100644
--- a/contrib/libs/apache/avro/CMakeLists.linux-x86_64.txt
+++ b/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
diff --git a/contrib/libs/apache/avro/api/AvroTraits.hh b/contrib/libs/apache/avro/api/AvroTraits.hh
index 7b5a636ec3..465470a938 100644
--- a/contrib/libs/apache/avro/api/AvroTraits.hh
+++ b/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);
};
diff --git a/contrib/libs/apache/avro/api/CustomAttributes.hh b/contrib/libs/apache/avro/api/CustomAttributes.hh
new file mode 100644
index 0000000000..adad6f6de0
--- /dev/null
+++ b/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
diff --git a/contrib/libs/apache/avro/api/CustomFields.hh b/contrib/libs/apache/avro/api/CustomFields.hh
deleted file mode 100644
index 01468ff4a0..0000000000
--- a/contrib/libs/apache/avro/api/CustomFields.hh
+++ /dev/null
@@ -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
diff --git a/contrib/libs/apache/avro/api/Node.hh b/contrib/libs/apache/avro/api/Node.hh
index c9af126f1a..3f5fe5b05d 100644
--- a/contrib/libs/apache/avro/api/Node.hh
+++ b/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_;
diff --git a/contrib/libs/apache/avro/api/NodeImpl.hh b/contrib/libs/apache/avro/api/NodeImpl.hh
index 62e62eb653..ef1c1dac9b 100644
--- a/contrib/libs/apache/avro/api/NodeImpl.hh
+++ b/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';
}
diff --git a/contrib/libs/apache/avro/api/Reader.hh b/contrib/libs/apache/avro/api/Reader.hh
index ca6a719e31..588a912648 100644
--- a/contrib/libs/apache/avro/api/Reader.hh
+++ b/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;
}
diff --git a/contrib/libs/apache/avro/api/Schema.hh b/contrib/libs/apache/avro/api/Schema.hh
index fa504815ad..163b50049c 100644
--- a/contrib/libs/apache/avro/api/Schema.hh
+++ b/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 &);
diff --git a/contrib/libs/apache/avro/api/buffer/Buffer.hh b/contrib/libs/apache/avro/api/buffer/Buffer.hh
index bc3baf1233..45c439d6d4 100644
--- a/contrib/libs/apache/avro/api/buffer/Buffer.hh
+++ b/contrib/libs/apache/avro/api/buffer/Buffer.hh
@@ -145,7 +145,7 @@ public:
**/
size_type wroteTo(size_type size) {
- int wrote = 0;
+ size_type wrote = 0;
if (size) {
if (size > freeSpace()) {
throw std::length_error("Impossible to write more data than free space");
diff --git a/contrib/libs/apache/avro/impl/Compiler.cc b/contrib/libs/apache/avro/impl/Compiler.cc
index 014229e11a..383798c4d6 100644
--- a/contrib/libs/apache/avro/impl/Compiler.cc
+++ b/contrib/libs/apache/avro/impl/Compiler.cc
@@ -21,7 +21,7 @@
#include <utility>
#include "Compiler.hh"
-#include "CustomFields.hh"
+#include "CustomAttributes.hh"
#include "NodeConcepts.hh"
#include "Schema.hh"
#include "Stream.hh"
@@ -149,8 +149,8 @@ struct Field {
const string name;
const NodePtr schema;
const GenericDatum defaultValue;
- const CustomFields customFields;
- Field(string n, NodePtr v, GenericDatum dv, const CustomFields& cf) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customFields(std::move(cf)) {}
+ const CustomAttributes customAttributes;
+ Field(string n, NodePtr v, GenericDatum dv, const CustomAttributes& ca) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customAttributes(std::move(ca)) {}
};
static void assertType(const Entity &e, EntityType et) {
@@ -268,14 +268,14 @@ static const std::unordered_set<std::string>& getKnownFields() {
return kKnownFields;
}
-static void getCustomAttributes(const Object& m, CustomFields &customAttributes)
+static void getCustomAttributes(const Object& m, CustomAttributes &customAttributes)
{
// Don't add known fields on primitive type and fixed type into custom
// fields.
const std::unordered_set<std::string>& kKnownFields = getKnownFields();
for (const auto &entry : m) {
if (kKnownFields.find(entry.first) == kKnownFields.end()) {
- customAttributes.addField(entry.first, entry.second);
+ customAttributes.addAttribute(entry.first, entry.second.stringValue());
}
}
}
@@ -291,7 +291,7 @@ static Field makeField(const Entity &e, SymbolTable &st, const string &ns) {
}
GenericDatum d = (it2 == m.end()) ? GenericDatum() : makeGenericDatum(node, it2->second, st);
// Get custom attributes
- CustomFields customAttributes;
+ CustomAttributes customAttributes;
getCustomAttributes(m, customAttributes);
return Field(n, node, d, customAttributes);
@@ -304,7 +304,7 @@ static NodePtr makeRecordNode(const Entity &e, const Name &name,
const Array &v = getArrayField(e, m, "fields");
concepts::MultiAttribute<string> fieldNames;
concepts::MultiAttribute<NodePtr> fieldValues;
- concepts::MultiAttribute<CustomFields> customAttributes;
+ concepts::MultiAttribute<CustomAttributes> customAttributes;
vector<GenericDatum> defaultValues;
for (const auto &it : v) {
@@ -312,7 +312,7 @@ static NodePtr makeRecordNode(const Entity &e, const Name &name,
fieldNames.add(f.name);
fieldValues.add(f.schema);
defaultValues.push_back(f.defaultValue);
- customAttributes.add(f.customFields);
+ customAttributes.add(f.customAttributes);
}
NodeRecord *node;
if (doc == nullptr) {
diff --git a/contrib/libs/apache/avro/impl/CustomAttributes.cc b/contrib/libs/apache/avro/impl/CustomAttributes.cc
new file mode 100644
index 0000000000..1186d9e26a
--- /dev/null
+++ b/contrib/libs/apache/avro/impl/CustomAttributes.cc
@@ -0,0 +1,53 @@
+
+/**
+ * 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 "CustomAttributes.hh"
+#include <map>
+#include <memory>
+#include "Exception.hh"
+
+namespace avro {
+
+boost::optional<std::string> CustomAttributes::getAttribute(const std::string &name) const {
+ boost::optional<std::string> result;
+ std::map<std::string, std::string>::const_iterator iter =
+ attributes_.find(name);
+ if (iter == attributes_.end()) {
+ return result;
+ }
+ result = iter->second;
+ return result;
+}
+
+void CustomAttributes::addAttribute(const std::string& name,
+ const std::string& value) {
+ auto iter_and_find =
+ attributes_.insert(std::pair<std::string, std::string>(name, value));
+ if (!iter_and_find.second) {
+ throw Exception(name + " already exists and cannot be added");
+ }
+}
+
+void CustomAttributes::printJson(std::ostream& os,
+ const std::string& name) const {
+ if (attributes().find(name) == attributes().end()) {
+ throw Exception(name + " doesn't exist");
+ }
+ os << "\"" << name << "\": \"" << attributes().at(name) << "\"";
+}
+} // namespace avro
diff --git a/contrib/libs/apache/avro/impl/CustomFields.cc b/contrib/libs/apache/avro/impl/CustomFields.cc
deleted file mode 100644
index 04541daae5..0000000000
--- a/contrib/libs/apache/avro/impl/CustomFields.cc
+++ /dev/null
@@ -1,59 +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.
- */
-#include "CustomFields.hh"
-#include <map>
-#include <memory>
-#include "Exception.hh"
-
-namespace avro {
-
-using json::Entity;
-
-Entity CustomFields::getField(const std::string &fieldName) const {
- std::map<std::string, Entity>::const_iterator iter =
- fields_.find(fieldName);
- if (iter == fields_.end()) {
- return Entity();
- }
- return iter->second;
-}
-
-void CustomFields::addField(const std::string& fieldName,
- const std::string& fieldValue) {
- addField(fieldName,
- json::Entity(std::make_shared<std::string>(fieldValue)));
-}
-
-void CustomFields::addField(const std::string& fieldName,
- const Entity& fieldValue) {
- auto iter_and_find =
- fields_.insert(std::pair<std::string, Entity>(fieldName, fieldValue));
- if (!iter_and_find.second) {
- throw Exception(fieldName + " already exists and cannot be added");
- }
-}
-
-void CustomFields::printJson(std::ostream& os,
- const std::string& fieldName) const {
- if (fields_.find(fieldName) == fields_.end()) {
- throw Exception(fieldName + " doesn't exist");
- }
- os << "\"" << fieldName << "\": " << fields_.at(fieldName).toString();
-}
-} // namespace avro
diff --git a/contrib/libs/apache/avro/impl/DataFile.cc b/contrib/libs/apache/avro/impl/DataFile.cc
index 966eff8538..45fdbb649d 100644
--- a/contrib/libs/apache/avro/impl/DataFile.cc
+++ b/contrib/libs/apache/avro/impl/DataFile.cc
@@ -256,14 +256,14 @@ void DataFileWriterBase::setMetadata(const string &key, const string &value) {
metadata_[key] = v;
}
-DataFileReaderBase::DataFileReaderBase(const char *filename) : filename_(filename), codec_(NULL_CODEC), stream_(fileSeekableInputStream(filename)),
- decoder_(binaryDecoder()), objectCount_(0), eof_(false), blockStart_(-1),
- blockEnd_(-1) {
+DataFileReaderBase::DataFileReaderBase(const char *filename) : filename_(filename), stream_(fileSeekableInputStream(filename)),
+ decoder_(binaryDecoder()), objectCount_(0), eof_(false),
+ codec_(NULL_CODEC), blockStart_(-1), blockEnd_(-1) {
readHeader();
}
-DataFileReaderBase::DataFileReaderBase(std::unique_ptr<InputStream> inputStream) : codec_(NULL_CODEC), stream_(std::move(inputStream)),
- decoder_(binaryDecoder()), objectCount_(0), eof_(false) {
+DataFileReaderBase::DataFileReaderBase(std::unique_ptr<InputStream> inputStream) : stream_(std::move(inputStream)),
+ decoder_(binaryDecoder()), objectCount_(0), eof_(false), codec_(NULL_CODEC) {
readHeader();
}
diff --git a/contrib/libs/apache/avro/impl/NodeImpl.cc b/contrib/libs/apache/avro/impl/NodeImpl.cc
index 37c855505c..5549c68fd4 100644
--- a/contrib/libs/apache/avro/impl/NodeImpl.cc
+++ b/contrib/libs/apache/avro/impl/NodeImpl.cc
@@ -83,13 +83,13 @@ std::ostream &operator<<(std::ostream &os, indent x) {
return os;
}
-void printCustomFields(const CustomFields& customFields, int depth,
+void printCustomAttributes(const CustomAttributes& customAttributes, int depth,
std::ostream &os) {
- std::map<std::string, json::Entity>::const_iterator iter =
- customFields.fields().begin();
- while (iter != customFields.fields().end()) {
+ std::map<std::string, std::string>::const_iterator iter =
+ customAttributes.attributes().begin();
+ while (iter != customAttributes.attributes().end()) {
os << ",\n" << indent(depth);
- customFields.printJson(os, iter->first);
+ customAttributes.printJson(os, iter->first);
++iter;
}
}
@@ -287,7 +287,7 @@ void NodeRecord::printJson(std::ostream &os, size_t depth) const {
}
}
if(customAttributes_.size() == fields) {
- printCustomFields(customAttributes_.get(i), depth, os);
+ printCustomAttributes(customAttributes_.get(i), depth, os);
}
os << '\n';
os << indent(--depth) << '}';
diff --git a/contrib/libs/apache/avro/impl/Resolver.cc b/contrib/libs/apache/avro/impl/Resolver.cc
index 919345e8a2..d19a04ad76 100644
--- a/contrib/libs/apache/avro/impl/Resolver.cc
+++ b/contrib/libs/apache/avro/impl/Resolver.cc
@@ -710,8 +710,8 @@ NonUnionToUnionParser::NonUnionToUnionParser(ResolverFactory &factory,
const NodePtr &writer,
const NodePtr &reader,
const CompoundLayout &offsets) : Resolver(),
- offset_(offsets.offset()),
choice_(0),
+ offset_(offsets.offset()),
choiceOffset_(offsets.at(0).offset()),
setFuncOffset_(offsets.at(1).offset()) {
#ifndef NDEBUG
diff --git a/contrib/libs/apache/avro/impl/Schema.cc b/contrib/libs/apache/avro/impl/Schema.cc
index fa90d3422c..3315f25258 100644
--- a/contrib/libs/apache/avro/impl/Schema.cc
+++ b/contrib/libs/apache/avro/impl/Schema.cc
@@ -19,7 +19,7 @@
#include <utility>
#include "Schema.hh"
-#include "CustomFields.hh"
+#include "CustomAttributes.hh"
namespace avro {
@@ -28,11 +28,11 @@ RecordSchema::RecordSchema(const std::string &name) : Schema(new NodeRecord) {
}
void RecordSchema::addField(const std::string &name, const Schema &fieldSchema) {
- const CustomFields emptyCustomField;
- addField(name, fieldSchema, emptyCustomField);
+ const CustomAttributes emptyCustomAttribute;
+ addField(name, fieldSchema, emptyCustomAttribute);
}
-void RecordSchema::addField(const std::string &name, const Schema &fieldSchema, const CustomFields &customFields) {
+void RecordSchema::addField(const std::string &name, const Schema &fieldSchema, const CustomAttributes &customFields) {
// add the name first. it will throw if the name is a duplicate, preventing
// the leaf from being added
node_->addName(name);
diff --git a/contrib/libs/apache/avro/impl/ValidSchema.cc b/contrib/libs/apache/avro/impl/ValidSchema.cc
index 63a3bbee91..1356d84489 100644
--- a/contrib/libs/apache/avro/impl/ValidSchema.cc
+++ b/contrib/libs/apache/avro/impl/ValidSchema.cc
@@ -69,8 +69,8 @@ static bool validate(const NodePtr &node, SymbolMap &symbolMap) {
}
node->lock();
- auto leaves = node->leaves();
- for (auto i = 0; i < leaves; ++i) {
+ size_t leaves = node->leaves();
+ for (size_t i = 0; i < leaves; ++i) {
const NodePtr &leaf(node->leafAt(i));
if (!validate(leaf, symbolMap)) {
diff --git a/contrib/libs/apache/avro/impl/Validator.cc b/contrib/libs/apache/avro/impl/Validator.cc
index 0e5fd8beda..3cd4e9e499 100644
--- a/contrib/libs/apache/avro/impl/Validator.cc
+++ b/contrib/libs/apache/avro/impl/Validator.cc
@@ -71,7 +71,7 @@ bool Validator::countingSetup() {
void Validator::countingAdvance() {
if (countingSetup()) {
- auto index = (compoundStack_.back().pos)++;
+ size_t index = (compoundStack_.back().pos)++;
const NodePtr &node = compoundStack_.back().node;
if (index < node->leaves()) {
diff --git a/contrib/libs/apache/avro/ya.make b/contrib/libs/apache/avro/ya.make
index 7a7216f72f..cd073fa7fb 100644
--- a/contrib/libs/apache/avro/ya.make
+++ b/contrib/libs/apache/avro/ya.make
@@ -1,4 +1,4 @@
-# Generated by devtools/yamaker from nixpkgs 22.05.
+# Generated by devtools/yamaker from nixpkgs 22.11.
LIBRARY()
@@ -10,9 +10,9 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.11.1)
+VERSION(1.11.3)
-ORIGINAL_SOURCE(https://github.com/apache/avro/archive/release-1.11.1.tar.gz)
+ORIGINAL_SOURCE(https://github.com/apache/avro/archive/release-1.11.3.tar.gz)
PEERDIR(
contrib/libs/snappy
@@ -34,7 +34,7 @@ NO_UTIL()
CFLAGS(
-DAVRO_SOURCE
- -DAVRO_VERSION=\"1.11.1\"
+ -DAVRO_VERSION=\"1.11.3\"
-DSNAPPY_CODEC_AVAILABLE
)
@@ -42,7 +42,7 @@ SRCS(
impl/BinaryDecoder.cc
impl/BinaryEncoder.cc
impl/Compiler.cc
- impl/CustomFields.cc
+ impl/CustomAttributes.cc
impl/DataFile.cc
impl/FileStream.cc
impl/Generic.cc