github-actions[bot] commented on code in PR #15966: URL: https://github.com/apache/doris/pull/15966#discussion_r1089889453
########## be/src/olap/rowset/segment_v2/column_reader.cpp: ########## @@ -449,13 +476,91 @@ Status ColumnReader::new_iterator(ColumnIterator** iterator) { null_iterator); return Status::OK(); } + case FieldType::OLAP_FIELD_TYPE_MAP: { + ColumnIterator* key_iterator = nullptr; + RETURN_IF_ERROR(_sub_readers[0]->new_iterator(&key_iterator)); + ColumnIterator* val_iterator = nullptr; + RETURN_IF_ERROR(_sub_readers[1]->new_iterator(&val_iterator)); + ColumnIterator* null_iterator = nullptr; + if (is_nullable()) { + RETURN_IF_ERROR(_sub_readers[2]->new_iterator(&null_iterator)); + } + *iterator = new MapFileColumnIterator(this, null_iterator, key_iterator, val_iterator); + return Status::OK(); + } default: return Status::NotSupported("unsupported type to create iterator: {}", std::to_string(type)); } } } +///====================== MapFileColumnIterator ============================//// +MapFileColumnIterator::MapFileColumnIterator(ColumnReader* reader, ColumnIterator* null_iterator, + ColumnIterator* key_iterator, + ColumnIterator* val_iterator) + : _map_reader(reader) { + _key_iterator.reset(key_iterator); + _val_iterator.reset(val_iterator); + if (_map_reader->is_nullable()) { + _null_iterator.reset(null_iterator); + } +} + +Status MapFileColumnIterator::init(const ColumnIteratorOptions& opts) { + RETURN_IF_ERROR(_key_iterator->init(opts)); + RETURN_IF_ERROR(_val_iterator->init(opts)); + if (_map_reader->is_nullable()) { + RETURN_IF_ERROR(_null_iterator->init(opts)); + } + return Status::OK(); +} + +Status MapFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool* has_null) { + return Status::NotSupported("Not support next_batch"); +} + +Status MapFileColumnIterator::seek_to_ordinal(ordinal_t ord) { + RETURN_IF_ERROR(_key_iterator->seek_to_ordinal(ord)); + RETURN_IF_ERROR(_val_iterator->seek_to_ordinal(ord)); + if (_map_reader->is_nullable()) { + RETURN_IF_ERROR(_null_iterator->seek_to_ordinal(ord)); + } + return Status::OK(); +} + +Status MapFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst, + bool* has_null) { + const auto* column_map = vectorized::check_and_get_column<vectorized::ColumnMap>( + dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column() + : *dst); + size_t num_read = *n; + auto column_key_ptr = column_map->get_keys().assume_mutable(); + auto column_val_ptr = column_map->get_values().assume_mutable(); + RETURN_IF_ERROR(_key_iterator->next_batch(num_read, column_key_ptr, has_null)); Review Comment: warning: no matching member function for call to 'next_batch' [clang-diagnostic-error] ```cpp RETURN_IF_ERROR(_key_iterator->next_batch(num_read, column_key_ptr, has_null)); ^ ``` **be/src/common/status.h:487:** expanded from macro 'RETURN_IF_ERROR' ```cpp Status _status_ = (stmt); \ ^ ``` **be/src/olap/rowset/segment_v2/column_reader.h:276:** candidate function not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'size_t *' (aka 'unsigned long *') for 1st argument; take the address of the argument with & ```cpp virtual Status next_batch(size_t* n, vectorized::MutableColumnPtr& dst, bool* has_null) { ^ ``` **be/src/olap/rowset/segment_v2/column_reader.h:274:** candidate function not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'size_t *' (aka 'unsigned long *') for 1st argument; take the address of the argument with & ```cpp virtual Status next_batch(size_t* n, ColumnBlockView* dst, bool* has_null) = 0; ^ ``` **be/src/olap/rowset/segment_v2/column_reader.h:261:** candidate function not viable: requires 2 arguments, but 3 were provided ```cpp Status next_batch(size_t* n, ColumnBlockView* dst) { ^ ``` **be/src/olap/rowset/segment_v2/column_reader.h:266:** candidate function not viable: requires 2 arguments, but 3 were provided ```cpp Status next_batch(size_t* n, vectorized::MutableColumnPtr& dst) { ^ ``` ########## be/src/olap/rowset/segment_v2/column_reader.cpp: ########## @@ -449,13 +476,91 @@ null_iterator); return Status::OK(); } + case FieldType::OLAP_FIELD_TYPE_MAP: { + ColumnIterator* key_iterator = nullptr; + RETURN_IF_ERROR(_sub_readers[0]->new_iterator(&key_iterator)); + ColumnIterator* val_iterator = nullptr; + RETURN_IF_ERROR(_sub_readers[1]->new_iterator(&val_iterator)); + ColumnIterator* null_iterator = nullptr; + if (is_nullable()) { + RETURN_IF_ERROR(_sub_readers[2]->new_iterator(&null_iterator)); + } + *iterator = new MapFileColumnIterator(this, null_iterator, key_iterator, val_iterator); + return Status::OK(); + } default: return Status::NotSupported("unsupported type to create iterator: {}", std::to_string(type)); } } } +///====================== MapFileColumnIterator ============================//// +MapFileColumnIterator::MapFileColumnIterator(ColumnReader* reader, ColumnIterator* null_iterator, + ColumnIterator* key_iterator, + ColumnIterator* val_iterator) + : _map_reader(reader) { + _key_iterator.reset(key_iterator); + _val_iterator.reset(val_iterator); + if (_map_reader->is_nullable()) { + _null_iterator.reset(null_iterator); + } +} + +Status MapFileColumnIterator::init(const ColumnIteratorOptions& opts) { + RETURN_IF_ERROR(_key_iterator->init(opts)); + RETURN_IF_ERROR(_val_iterator->init(opts)); + if (_map_reader->is_nullable()) { + RETURN_IF_ERROR(_null_iterator->init(opts)); + } + return Status::OK(); +} + +Status MapFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool* has_null) { + return Status::NotSupported("Not support next_batch"); +} + +Status MapFileColumnIterator::seek_to_ordinal(ordinal_t ord) { + RETURN_IF_ERROR(_key_iterator->seek_to_ordinal(ord)); + RETURN_IF_ERROR(_val_iterator->seek_to_ordinal(ord)); + if (_map_reader->is_nullable()) { + RETURN_IF_ERROR(_null_iterator->seek_to_ordinal(ord)); + } + return Status::OK(); +} + +Status MapFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst, + bool* has_null) { + const auto* column_map = vectorized::check_and_get_column<vectorized::ColumnMap>( + dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column() + : *dst); + size_t num_read = *n; + auto column_key_ptr = column_map->get_keys().assume_mutable(); + auto column_val_ptr = column_map->get_values().assume_mutable(); + RETURN_IF_ERROR(_key_iterator->next_batch(num_read, column_key_ptr, has_null)); + RETURN_IF_ERROR(_val_iterator->next_batch(num_read, column_val_ptr, has_null)); Review Comment: warning: no matching member function for call to 'next_batch' [clang-diagnostic-error] ```cpp RETURN_IF_ERROR(_val_iterator->next_batch(num_read, column_val_ptr, has_null)); ^ ``` **be/src/common/status.h:487:** expanded from macro 'RETURN_IF_ERROR' ```cpp Status _status_ = (stmt); \ ^ ``` **be/src/olap/rowset/segment_v2/column_reader.h:276:** candidate function not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'size_t *' (aka 'unsigned long *') for 1st argument; take the address of the argument with & ```cpp virtual Status next_batch(size_t* n, vectorized::MutableColumnPtr& dst, bool* has_null) { ^ ``` **be/src/olap/rowset/segment_v2/column_reader.h:274:** candidate function not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'size_t *' (aka 'unsigned long *') for 1st argument; take the address of the argument with & ```cpp virtual Status next_batch(size_t* n, ColumnBlockView* dst, bool* has_null) = 0; ^ ``` **be/src/olap/rowset/segment_v2/column_reader.h:261:** candidate function not viable: requires 2 arguments, but 3 were provided ```cpp Status next_batch(size_t* n, ColumnBlockView* dst) { ^ ``` **be/src/olap/rowset/segment_v2/column_reader.h:266:** candidate function not viable: requires 2 arguments, but 3 were provided ```cpp Status next_batch(size_t* n, vectorized::MutableColumnPtr& dst) { ^ ``` ########## be/src/runtime/map_value.h: ########## @@ -0,0 +1,73 @@ +// 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 <type_traits> + +#include "runtime/primitive_type.h" + +namespace doris_udf { +class FunctionContext; +struct AnyVal; +} // namespace doris_udf + +namespace doris { + +using doris_udf::FunctionContext; Review Comment: warning: using decl 'FunctionContext' is unused [misc-unused-using-decls] ```cpp using doris_udf::FunctionContext; ^ ``` **be/src/runtime/map_value.h:30:** remove the using ```cpp using doris_udf::FunctionContext; ^ ``` ########## be/src/vec/data_types/data_type_factory.cpp: ########## @@ -45,6 +50,11 @@ if (col_desc.type() == OLAP_FIELD_TYPE_ARRAY) { DCHECK(col_desc.get_subtype_count() == 1); nested = std::make_shared<DataTypeArray>(create_data_type(col_desc.get_sub_column(0))); + } else if (col_desc.type() == OLAP_FIELD_TYPE_MAP) { + DCHECK(col_desc.get_subtype_count() == 2); + nested = std::make_shared<vectorized::DataTypeMap>( Review Comment: warning: no member named 'DataTypeMap' in namespace 'doris::vectorized' [clang-diagnostic-error] ```cpp nested = std::make_shared<vectorized::DataTypeMap>( ^ ``` ########## be/src/udf/udf.h: ########## @@ -927,6 +951,7 @@ using doris_udf::DateTimeVal; using doris_udf::HllVal; using doris_udf::FunctionContext; using doris_udf::CollectionVal; +using doris_udf::MapVal; Review Comment: warning: using decl 'MapVal' is unused [misc-unused-using-decls] ```cpp using doris_udf::MapVal; ^ ``` **be/src/udf/udf.h:953:** remove the using ```cpp using doris_udf::MapVal; ^ ``` ########## be/src/vec/data_types/data_type_factory.cpp: ########## @@ -299,6 +315,13 @@ case PGenericType::FIXEDLENGTHOBJECT: nested = std::make_shared<DataTypeFixedLengthObject>(); break; + case PGenericType::MAP: + DCHECK(pcolumn.children_size() == 2); + // here to check pcolumn is list? + nested = std::make_shared<vectorized::DataTypeMap>( Review Comment: warning: no member named 'DataTypeMap' in namespace 'doris::vectorized' [clang-diagnostic-error] ```cpp nested = std::make_shared<vectorized::DataTypeMap>( ^ ``` ########## be/src/vec/data_types/data_type_factory.cpp: ########## @@ -29,6 +29,11 @@ DataTypePtr DataTypeFactory::create_data_type(const doris::Field& col_desc) { if (col_desc.type() == OLAP_FIELD_TYPE_ARRAY) { DCHECK(col_desc.get_sub_field_count() == 1); nested = std::make_shared<DataTypeArray>(create_data_type(*col_desc.get_sub_field(0))); + } else if (col_desc.type() == OLAP_FIELD_TYPE_MAP) { + DCHECK(col_desc.get_sub_field_count() == 2); + nested = std::make_shared<vectorized::DataTypeMap>( Review Comment: warning: no member named 'DataTypeMap' in namespace 'doris::vectorized' [clang-diagnostic-error] ```cpp nested = std::make_shared<vectorized::DataTypeMap>( ^ ``` ########## be/src/vec/data_types/data_type_factory.cpp: ########## @@ -131,6 +141,12 @@ nested = std::make_shared<vectorized::DataTypeArray>( create_data_type(col_desc.children[0], col_desc.contains_null)); break; + case TYPE_MAP: + DCHECK(col_desc.children.size() == 2); + nested = std::make_shared<vectorized::DataTypeMap>( Review Comment: warning: no member named 'DataTypeMap' in namespace 'doris::vectorized' [clang-diagnostic-error] ```cpp nested = std::make_shared<vectorized::DataTypeMap>( ^ ``` ########## be/src/runtime/map_value.h: ########## @@ -0,0 +1,73 @@ +// 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 <type_traits> + +#include "runtime/primitive_type.h" + +namespace doris_udf { +class FunctionContext; +struct AnyVal; +} // namespace doris_udf + +namespace doris { + +using doris_udf::FunctionContext; +using doris_udf::AnyVal; Review Comment: warning: using decl 'AnyVal' is unused [misc-unused-using-decls] ```cpp using doris_udf::AnyVal; ^ ``` **be/src/runtime/map_value.h:31:** remove the using ```cpp using doris_udf::AnyVal; ^ ``` ########## be/src/vec/data_types/data_type_factory.cpp: ########## @@ -368,6 +391,12 @@ nested = std::make_shared<vectorized::DataTypeArray>( create_data_type(type->field(0)->type().get(), true)); break; + case ::arrow::Type::MAP: + DCHECK(type->num_fields() == 2); + nested = std::make_shared<vectorized::DataTypeMap>( Review Comment: warning: no member named 'DataTypeMap' in namespace 'doris::vectorized' [clang-diagnostic-error] ```cpp nested = std::make_shared<vectorized::DataTypeMap>( ^ ``` -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org