You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/23 07:55:44 UTC

[GitHub] [incubator-doris] HappenLee commented on a diff in pull request #9541: [feature-wip](parquet-orc) Support orc scanner in vectorized engine

HappenLee commented on code in PR #9541:
URL: https://github.com/apache/incubator-doris/pull/9541#discussion_r879094893


##########
be/src/vec/data_types/data_type_factory.cpp:
##########
@@ -310,10 +310,10 @@ DataTypePtr DataTypeFactory::create_data_type(const arrow::Type::type& type, boo
         nested = std::make_shared<vectorized::DataTypeString>();
         break;
     case ::arrow::Type::DECIMAL:
-        nested = std::make_shared<vectorized::DataTypeDecimal<vectorized::Decimal128>>(27, 9);
+        nested = std::make_shared<vectorized::DataTypeDecimal<vectorized::Decimal128>>();

Review Comment:
   why delete the `27,9`?



##########
be/src/vec/exec/vorc_reader.h:
##########
@@ -0,0 +1,57 @@
+// 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.
+
+#pragma once
+
+#include <arrow/adapters/orc/adapter.h>
+#include <arrow/api.h>
+#include <arrow/buffer.h>
+
+#include <stdint.h>
+#include <map>
+#include <string>
+#include "common/status.h"
+#include "exec/arrow_reader.h"
+namespace doris::vectorized {
+
+// Reader of orc file
+class VORCReaderWrap : public ArrowReaderWrap {

Review Comment:
   May be the file should in `be/exec` same as `parquet_reader`. And the class do not use vectorized::block. maybe no need name `VORC`?



##########
be/src/vec/exec/vorc_reader.h:
##########
@@ -0,0 +1,57 @@
+// 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.
+
+#pragma once
+
+#include <arrow/adapters/orc/adapter.h>
+#include <arrow/api.h>
+#include <arrow/buffer.h>
+
+#include <stdint.h>
+#include <map>
+#include <string>
+#include "common/status.h"
+#include "exec/arrow_reader.h"
+namespace doris::vectorized {
+
+// Reader of orc file
+class VORCReaderWrap : public ArrowReaderWrap {
+public:
+    VORCReaderWrap(FileReader* file_reader, int64_t batch_size, int32_t num_of_columns_from_file);
+    virtual ~VORCReaderWrap();
+
+    Status init_reader(const std::vector<SlotDescriptor*>& tuple_slot_descs,
+                       const std::string& timezone) override;
+    Status next_batch(std::shared_ptr<arrow::RecordBatch>* batch,
+                      const std::vector<SlotDescriptor*>& tuple_slot_descs, bool* eof) override;
+
+private:
+    Status _column_indices(const std::vector<SlotDescriptor*>& tuple_slot_descs);
+    Status _next_stripe_reader(bool* eof);
+
+private:
+    // orc file reader object
+    std::shared_ptr<::arrow::RecordBatchReader> _rb_reader;
+    std::unique_ptr<arrow::adapters::orc::ORCFileReader> _reader;
+    std::map<std::string, int> _map_column; // column-name <---> column-index

Review Comment:
   For simultaneous variables in `orc` and `parquet`, you should put them in the parent class. like `_map_column`.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org