[
https://issues.apache.org/jira/browse/ARROW-1209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239254#comment-16239254
]
ASF GitHub Bot commented on ARROW-1209:
---------------------------------------
cpcloud commented on a change in pull request #1026: ARROW-1209: [C++] [WIP]
Support for reading avro from an AvroFileReader
URL: https://github.com/apache/arrow/pull/1026#discussion_r148942055
##########
File path: cpp/src/arrow/adapters/avro/adapter.cc
##########
@@ -0,0 +1,325 @@
+// 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 <cstdint>
+#include <memory>
+#include <string>
+#include <sstream>
+#include <arrow/util/logging.h>
+
+#include "arrow/adapters/avro/adapter.h"
+
+#include "arrow/builder.h"
+#include "arrow/buffer.h"
+#include "arrow/memory_pool.h"
+#include "arrow/status.h"
+#include "arrow/table.h"
+#include "arrow/type.h"
+#include "arrow/type_traits.h"
+#include "arrow/util/bit-util.h"
+#include "arrow/util/macros.h"
+#include "arrow/util/visibility.h"
+
+#include "avro.h"
+
+namespace arrow {
+namespace adapters {
+namespace avro {
+
+class AvroArrowReader::AvroArrowReaderImpl {
+public:
+ Status GenerateAvroSchema(avro_file_reader_t *file_reader,
+ std::shared_ptr<DataType> *out) {
+ auto wschema = avro_file_reader_get_writer_schema(*file_reader);
+ std::shared_ptr<DataType> arrow_schema = get_arrow_type(wschema);
+ // make array builder
+ out = &arrow_schema;
+ return Status::OK();
+ }
+
+ std::shared_ptr<DataType> get_arrow_type(avro_schema_t schema) {
+ avro_schema_t child;
+ size_t size, idx;
+ int64_t length;
+ const char *name;
Review comment:
There's no need to define these variables at the top of the function since
wherever you use them you always return early. Also, I think it's easier to
follow if variables are declared as close as possible to where they are used.
----------------------------------------------------------------
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]
> [C++] Implement converter between Arrow record batches and Avro records
> -----------------------------------------------------------------------
>
> Key: ARROW-1209
> URL: https://issues.apache.org/jira/browse/ARROW-1209
> Project: Apache Arrow
> Issue Type: New Feature
> Components: C++
> Reporter: Wes McKinney
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.0.0
>
>
> This would be useful for streaming systems that need to consume or produce
> Avro in C/C++
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)