diff --git a/be/src/exprs/encryption_functions.h b/be/src/exprs/encryption_functions.h index bb57e7b32c..6622c6f463 100644 --- a/be/src/exprs/encryption_functions.h +++ b/be/src/exprs/encryption_functions.h @@ -1,22 +1,21 @@ -// Modifications copyright (C) 2017, Baidu.com, Inc. -// Copyright 2017 The Apache Software Foundation - -// 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. +/**************************************************************** + * + * The author of this software is David M. Gay. + * + * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + * + ***************************************************************/ #ifndef BDG_PALO_BE_SRC_QUERY_EXPRS_ENCRYPTION_FUNCTIONS_H #define BDG_PALO_BE_SRC_QUERY_EXPRS_ENCRYPTION_FUNCTIONS_H diff --git a/be/src/http/mongoose.cpp b/be/src/http/mongoose.cpp index 8f1568a968..f6e0c2aaef 100644 --- a/be/src/http/mongoose.cpp +++ b/be/src/http/mongoose.cpp @@ -1,22 +1,19 @@ -// Copyright (c) 2004-2012 Sergey Lyubka -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. +// Copyright (c) 2004-2013 Sergey Lyubka +// Copyright (c) 2013-2018 Cesanta Software Limited +// All rights reserved + +// This software is dual-licensed: you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. For the terms of this +// license, see . + +// You are free to use this software under the terms of the GNU General +// Public License, but WITHOUT ANY WARRANTY; without even the implied +// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. + +// Alternatively, you can license this software under a commercial +// license, as set out in . #if defined(_WIN32) #define _CRT_SECURE_NO_WARNINGS // Disable deprecation warning in VS2005 diff --git a/be/src/olap/column_file/segment_reader.cpp b/be/src/olap/column_file/segment_reader.cpp index d821453688..a20db5507c 100644 --- a/be/src/olap/column_file/segment_reader.cpp +++ b/be/src/olap/column_file/segment_reader.cpp @@ -139,7 +139,7 @@ OLAPStatus SegmentReader::_load_segment_file() { // In file_header.unserialize(), it validates file length, signature, checksum of protobuf. _file_header = _olap_index->get_seg_pb(_segment_id); _null_supported = _olap_index->get_null_supported(_segment_id); - _header_length = _file_header.size(); + _header_length = _file_header->size(); res = _check_file_version(); if (OLAP_SUCCESS != res) { @@ -334,8 +334,13 @@ void SegmentReader::_set_column_map() { _unique_id_to_table_id_map.clear(); _unique_id_to_segment_id_map.clear(); - for (ColumnId table_column_id = 0; table_column_id < tablet_schema().size(); - ++table_column_id) { + for (ColumnId table_column_id : _used_columns) { + ColumnId unique_column_id = tablet_schema()[table_column_id].unique_id; + _table_id_to_unique_id_map[table_column_id] = unique_column_id; + _unique_id_to_table_id_map[unique_column_id] = table_column_id; + } + + for (ColumnId table_column_id : _load_bf_columns) { ColumnId unique_column_id = tablet_schema()[table_column_id].unique_id; _table_id_to_unique_id_map[table_column_id] = unique_column_id; _unique_id_to_table_id_map[unique_column_id] = table_column_id; diff --git a/be/src/olap/column_file/segment_reader.h b/be/src/olap/column_file/segment_reader.h index dcef7d709a..4197ec939a 100644 --- a/be/src/olap/column_file/segment_reader.h +++ b/be/src/olap/column_file/segment_reader.h @@ -233,7 +233,7 @@ private: } inline const ColumnDataHeaderMessage& _header_message() { - return _file_header.message(); + return _file_header->message(); } OLAPStatus _init_include_blocks(uint32_t first_block, uint32_t last_block); @@ -344,7 +344,7 @@ private: Cache* _lru_cache; std::vector _cache_handle; - FileHeader _file_header; + const FileHeader* _file_header; std::unique_ptr _tracker; std::unique_ptr _mem_pool; diff --git a/be/src/olap/olap_index.h b/be/src/olap/olap_index.h index 78318e9425..b74919b5b1 100644 --- a/be/src/olap/olap_index.h +++ b/be/src/olap/olap_index.h @@ -608,8 +608,8 @@ public: return _index.get_row_block_position(pos, rbp); } - inline const FileHeader& get_seg_pb(uint32_t seg_id) const { - return _seg_pb_map.at(seg_id); + inline const FileHeader* get_seg_pb(uint32_t seg_id) const { + return &(_seg_pb_map.at(seg_id)); } inline bool get_null_supported(uint32_t seg_id) { diff --git a/be/src/runtime/vectorized_row_batch.cpp b/be/src/runtime/vectorized_row_batch.cpp index 68938ecc4a..6ac1f44534 100644 --- a/be/src/runtime/vectorized_row_batch.cpp +++ b/be/src/runtime/vectorized_row_batch.cpp @@ -32,17 +32,18 @@ VectorizedRowBatch::VectorizedRowBatch( _mem_pool.reset(new MemPool(_tracker.get())); _selected = reinterpret_cast(new char[sizeof(uint16_t) * _capacity]); - for (int i = 0; i < schema.size(); ++i) { - _vectors.push_back(new ColumnVector()); + for (ColumnId column_id : cols) { + ColumnVector* col_vec = new ColumnVector(); + _col_map[column_id] = col_vec; } } void VectorizedRowBatch::dump_to_row_block(RowBlock* row_block) { if (_selected_in_use) { for (auto column_id : _cols) { - bool no_nulls = _vectors[column_id]->no_nulls(); + bool no_nulls = _col_map[column_id]->no_nulls(); // pointer of this field's vector - char* vec_field_ptr = (char*)_vectors[column_id]->col_data(); + char* vec_field_ptr = (char*)_col_map[column_id]->col_data(); // pointer of this field in row block char* row_field_ptr = row_block->_mem_buf + row_block->_field_offset_in_memory[column_id]; @@ -67,7 +68,7 @@ void VectorizedRowBatch::dump_to_row_block(RowBlock* row_block) { row_field_ptr += row_block->_mem_row_bytes; } } else { - bool* is_null = _vectors[column_id]->is_null(); + bool* is_null = _col_map[column_id]->is_null(); for (int row = 0; row < _size; ++row) { if (is_null[_selected[row]]) { *row_field_ptr = 1; @@ -84,9 +85,9 @@ void VectorizedRowBatch::dump_to_row_block(RowBlock* row_block) { } } else { for (auto column_id : _cols) { - bool no_nulls = _vectors[column_id]->no_nulls(); + bool no_nulls = _col_map[column_id]->no_nulls(); - char* vec_field_ptr = (char*)_vectors[column_id]->col_data(); + char* vec_field_ptr = (char*)_col_map[column_id]->col_data(); char* row_field_ptr = row_block->_mem_buf + row_block->_field_offset_in_memory[column_id]; const FieldInfo& field_info = _schema[column_id]; @@ -110,7 +111,7 @@ void VectorizedRowBatch::dump_to_row_block(RowBlock* row_block) { vec_field_ptr += field_size; } } else { - bool* is_null = _vectors[column_id]->is_null(); + bool* is_null = _col_map[column_id]->is_null(); for (int row = 0; row < _size; ++row) { if (is_null[row]) { *row_field_ptr = 1; diff --git a/be/src/runtime/vectorized_row_batch.h b/be/src/runtime/vectorized_row_batch.h index 1c830c23a0..531764d1f6 100644 --- a/be/src/runtime/vectorized_row_batch.h +++ b/be/src/runtime/vectorized_row_batch.h @@ -74,9 +74,10 @@ public: const std::vector& schema, const std::vector& cols, int capacity); + ~VectorizedRowBatch() { - for (auto col_vec : _vectors) { - delete col_vec; + for (auto& item: _col_map) { + delete item.second; } delete[] _selected; } @@ -86,7 +87,7 @@ public: } ColumnVector* column(int column_index) { - return _vectors[column_index]; + return _col_map[column_index]; } const std::vector& columns() const { return _cols; } @@ -141,7 +142,7 @@ private: const uint16_t _capacity; uint16_t _size = 0; uint16_t* _selected = nullptr; - std::vector _vectors; + std::map _col_map; bool _selected_in_use = false; uint8_t _block_status;