This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch dev-1.0.1 in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
commit 209bb3895475f8e0ecea5ed810a319cbf29b7b9c Author: hongbin <x...@users.noreply.github.com> AuthorDate: Wed Mar 30 09:51:48 2022 +0800 [refactor] Fix some code comments typo and cleanup unused include (#8684) --- be/src/vec/olap/block_reader.cpp | 2 +- be/src/vec/olap/block_reader.h | 2 +- be/src/vec/olap/vcollect_iterator.h | 4 +- be/src/vec/olap/vgeneric_iterators.cpp | 5 +-- be/src/vec/runtime/vdata_stream_mgr.h | 1 + be/src/vec/runtime/vdatetime_value.cpp | 1 - be/src/vec/runtime/vdatetime_value.h | 66 ++++++++++++++----------------- be/src/vec/runtime/vpartition_info.h | 3 +- be/src/vec/runtime/vsorted_run_merger.cpp | 2 - be/src/vec/sink/mysql_result_writer.cpp | 2 +- be/src/vec/sink/result_writer.h | 2 + be/src/vec/sink/vdata_stream_sender.cpp | 8 ++-- 12 files changed, 46 insertions(+), 52 deletions(-) diff --git a/be/src/vec/olap/block_reader.cpp b/be/src/vec/olap/block_reader.cpp index 6f581da..1959fc7 100644 --- a/be/src/vec/olap/block_reader.cpp +++ b/be/src/vec/olap/block_reader.cpp @@ -109,7 +109,7 @@ void BlockReader::_init_agg_state(const ReaderParams& read_params) { function->create(place); _agg_places.push_back(place); - //calculate has_string tag + // calculate `has_string` tag. _stored_has_string_tag[idx] = _stored_data_columns[idx]->is_column_string() || (_stored_data_columns[idx]->is_nullable() && diff --git a/be/src/vec/olap/block_reader.h b/be/src/vec/olap/block_reader.h index 8bb97cf..322316f 100644 --- a/be/src/vec/olap/block_reader.h +++ b/be/src/vec/olap/block_reader.h @@ -53,7 +53,7 @@ private: friend class VCollectIterator; friend class DeleteHandler; - // Direcly read row from rowset and pass to upper caller. No need to do aggregation. + // Directly read row from rowset and pass to upper caller. No need to do aggregation. // This is usually used for DUPLICATE KEY tables OLAPStatus _direct_next_block(Block* block, MemPool* mem_pool, ObjectPool* agg_pool, bool* eof); // Just same as _direct_next_block, but this is only for AGGREGATE KEY tables. diff --git a/be/src/vec/olap/vcollect_iterator.h b/be/src/vec/olap/vcollect_iterator.h index 366d126..b5c0089 100644 --- a/be/src/vec/olap/vcollect_iterator.h +++ b/be/src/vec/olap/vcollect_iterator.h @@ -164,7 +164,7 @@ private: inline OLAPStatus _normal_next(Block* block); // Each LevelIterator corresponds to a rowset reader, - // it will be cleared after '_heap' has been initilized when '_merge == true'. + // it will be cleared after '_heap' has been initialized when '_merge == true'. std::list<LevelIterator*> _children; // point to the Level0Iterator containing the next output row. // null when VCollectIterator hasn't been initialized or reaches EOF. @@ -186,7 +186,7 @@ private: std::unique_ptr<LevelIterator> _inner_iter; // Each LevelIterator corresponds to a rowset reader, - // it will be cleared after '_inner_iter' has been initilized. + // it will be cleared after '_inner_iter' has been initialized. std::list<LevelIterator*> _children; bool _merge = true; diff --git a/be/src/vec/olap/vgeneric_iterators.cpp b/be/src/vec/olap/vgeneric_iterators.cpp index 8145cc3..6d18ee5 100644 --- a/be/src/vec/olap/vgeneric_iterators.cpp +++ b/be/src/vec/olap/vgeneric_iterators.cpp @@ -21,7 +21,6 @@ #include "olap/iterators.h" #include "olap/row.h" #include "olap/row_block2.h" -#include "olap/row_cursor_cell.h" namespace doris { @@ -199,7 +198,7 @@ public: // Don't call this when valid() is false, action is undefined Status advance(); - // Return if has remaining data in this context. + // Return if it has remaining data in this context. // Only when this function return true, current_row() // will return a valid row bool valid() const { return _valid; } @@ -356,7 +355,7 @@ Status VMergeIterator::next_batch(vectorized::Block* block) { // VUnionIterator will read data from input iterator one by one. class VUnionIterator : public RowwiseIterator { public: - // Iterators' ownership it transfered to this class. + // Iterators' ownership it transferred to this class. // This class will delete all iterators when destructs // Client should not use iterators any more. VUnionIterator(std::vector<RowwiseIterator*>& v, std::shared_ptr<MemTracker> parent) diff --git a/be/src/vec/runtime/vdata_stream_mgr.h b/be/src/vec/runtime/vdata_stream_mgr.h index 5cce8e4..0d1d0f8 100644 --- a/be/src/vec/runtime/vdata_stream_mgr.h +++ b/be/src/vec/runtime/vdata_stream_mgr.h @@ -16,6 +16,7 @@ // under the License. #pragma once + #include <memory> #include <mutex> #include <set> diff --git a/be/src/vec/runtime/vdatetime_value.cpp b/be/src/vec/runtime/vdatetime_value.cpp index 4c59277..ec40d27 100644 --- a/be/src/vec/runtime/vdatetime_value.cpp +++ b/be/src/vec/runtime/vdatetime_value.cpp @@ -24,7 +24,6 @@ #include <limits> #include <sstream> -#include "common/logging.h" #include "util/timezone_utils.h" #include "runtime/datetime_value.h" diff --git a/be/src/vec/runtime/vdatetime_value.h b/be/src/vec/runtime/vdatetime_value.h index 4ec8d6e..6a77cdc 100644 --- a/be/src/vec/runtime/vdatetime_value.h +++ b/be/src/vec/runtime/vdatetime_value.h @@ -67,23 +67,10 @@ struct TimeInterval { int64_t second; bool is_neg; - TimeInterval() - : year(0), - month(0), - day(0), - hour(0), - minute(0), - second(0), - is_neg(false) {} + TimeInterval() : year(0), month(0), day(0), hour(0), minute(0), second(0), is_neg(false) {} TimeInterval(TimeUnit unit, int64_t count, bool is_neg_param) - : year(0), - month(0), - day(0), - hour(0), - minute(0), - second(0), - is_neg(is_neg_param) { + : year(0), month(0), day(0), hour(0), minute(0), second(0), is_neg(is_neg_param) { switch (unit) { case YEAR: year = count; @@ -157,8 +144,8 @@ static constexpr size_t MAX_MONTH_NAME_LEN = max_char_length(s_month_name, std:: uint8_t mysql_week_mode(uint32_t mode); -class VecDateTimeValue { // Now this type is a temp solution with little changes, maybe large refactoring follow-up. -public: +class VecDateTimeValue { // Now this type is a temp solution with little changes, maybe large refactoring follow-up. +public: // Constructor VecDateTimeValue() : _neg(0), @@ -166,14 +153,14 @@ public: _second(0), _minute(0), _hour(0), - _day(0), // _microsecond(0): remove it to reduce memory, and Reorder the variables - _month(0), // so this is a difference between Vectorization mode and Rowbatch mode with DateTimeValue; - _year(0) {} // before int128 16 bytes ---> after int64 8 bytes + _day(0), // _microsecond(0): remove it to reduce memory, and Reorder the variables + _month(0), // so this is a difference between Vectorization mode and Rowbatch mode with DateTimeValue; + _year(0) {} // before int128 16 bytes ---> after int64 8 bytes explicit VecDateTimeValue(int64_t t) { from_date_int64(t); } - void set_time(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, - uint32_t minute, uint32_t second); + void set_time(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t minute, + uint32_t second); // Converted from Olap Date or Datetime bool from_olap_datetime(uint64_t datetime) { @@ -182,7 +169,7 @@ public: uint64_t date = datetime / 1000000; uint64_t time = datetime % 1000000; - auto [year, month, day, hour, minute, second] = std::tuple{0,0,0,0,0,0}; + auto [year, month, day, hour, minute, second] = std::tuple {0, 0, 0, 0, 0, 0}; year = date / 10000; date %= 10000; month = date / 100; @@ -205,7 +192,7 @@ public: _neg = 0; _type = TIME_DATE; - auto [year, month, day, hour, minute, second] = std::tuple{0,0,0,0,0,0}; + auto [year, month, day, hour, minute, second] = std::tuple {0, 0, 0, 0, 0, 0}; day = date & 0x1f; date >>= 5; @@ -238,7 +225,7 @@ public: bool from_date_daynr(uint64_t); // Construct Date/Datetime type value from string. - // At least the following formats are recogniced (based on number of digits) + // At least the following formats are recognised (based on number of digits) // 'YYMMDD', 'YYYYMMDD', 'YYMMDDHHMMSS', 'YYYYMMDDHHMMSS' // 'YY-MM-DD', 'YYYY-MM-DD', 'YY-MM-DD HH.MM.SS' // 'YYYYMMDDTHHMMSS' @@ -269,13 +256,14 @@ public: // Return true if range or date is invalid static bool check_range(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, - uint32_t minute, uint32_t second, uint16_t type); + uint32_t minute, uint32_t second, uint16_t type); static bool check_date(uint32_t year, uint32_t month, uint32_t day); // compute the diff between two datetime value template <TimeUnit unit> - static int64_t datetime_diff(const VecDateTimeValue& ts_value1, const VecDateTimeValue& ts_value2) { + static int64_t datetime_diff(const VecDateTimeValue& ts_value1, + const VecDateTimeValue& ts_value2) { switch (unit) { case YEAR: { int year = (ts_value2.year() - ts_value1.year()); @@ -340,7 +328,7 @@ public: int64_t to_int64() const; bool check_range_and_set_time(uint32_t year, uint32_t month, uint32_t day, uint32_t hour, - uint32_t minute, uint32_t second, uint16_t type) { + uint32_t minute, uint32_t second, uint16_t type) { if (check_range(year, month, day, hour, minute, second, type)) { return false; } @@ -354,12 +342,13 @@ public: // 0000-01-01 is 1st B.C. static uint64_t calc_daynr(uint32_t year, uint32_t month, uint32_t day); - static uint8_t calc_weekday(uint64_t daynr, bool); //W = (D + M*2 + 3*(M+1)/5 + Y + Y/4 -Y/100 + Y/400)%7 + static uint8_t calc_weekday(uint64_t daynr, + bool); //W = (D + M*2 + 3*(M+1)/5 + Y + Y/4 -Y/100 + Y/400)%7 int year() const { return _year; } int month() const { return _month; } int quarter() const { return (_month - 1) / 3 + 1; } - int week() const { return week(mysql_week_mode(0)); }//00-53 + int week() const { return week(mysql_week_mode(0)); } //00-53 int day() const { return _day; } int hour() const { return _hour; } int minute() const { return _minute; } @@ -548,11 +537,14 @@ public: int type() const { return _type; } - bool is_valid_date() const { return !check_range(_year, _month, _day, - _hour, _minute, _second, _type) && _month > 0 && _day > 0; } - + bool is_valid_date() const { + return !check_range(_year, _month, _day, _hour, _minute, _second, _type) && _month > 0 && + _day > 0; + } + void convert_vec_dt_to_dt(doris::DateTimeValue* dt); void convert_dt_to_vec_dt(doris::DateTimeValue* dt); + private: // Used to make sure sizeof VecDateTimeValue friend class UnusedClass; @@ -630,7 +622,7 @@ private: uint16_t _year; VecDateTimeValue(uint8_t neg, uint8_t type, uint8_t hour, uint8_t minute, uint8_t second, - uint16_t year, uint8_t month, uint8_t day) + uint16_t year, uint8_t month, uint8_t day) : _neg(neg), _type(type), _second(second), @@ -651,13 +643,15 @@ std::ostream& operator<<(std::ostream& os, const VecDateTimeValue& value); std::size_t hash_value(VecDateTimeValue const& value); +} // namespace vectorized } // namespace doris -} namespace std { template <> struct hash<doris::vectorized::VecDateTimeValue> { - size_t operator()(const doris::vectorized::VecDateTimeValue& v) const { return doris::vectorized::hash_value(v); } + size_t operator()(const doris::vectorized::VecDateTimeValue& v) const { + return doris::vectorized::hash_value(v); + } }; } // namespace std diff --git a/be/src/vec/runtime/vpartition_info.h b/be/src/vec/runtime/vpartition_info.h index 3c59e74..61ab6ad 100644 --- a/be/src/vec/runtime/vpartition_info.h +++ b/be/src/vec/runtime/vpartition_info.h @@ -16,6 +16,7 @@ // under the License. #pragma once + #include "common/status.h" #include "runtime/dpp_sink_internal.h" #include "vec/exprs/vexpr.h" @@ -51,7 +52,7 @@ private: int64_t _id; PartRange _range; // Information used to distribute data - // distribute exprs + // distribute express. std::vector<VExprContext*> _distributed_expr_ctxs; int32_t _distributed_bucket; }; diff --git a/be/src/vec/runtime/vsorted_run_merger.cpp b/be/src/vec/runtime/vsorted_run_merger.cpp index 0d0ecc0..79afa1b 100644 --- a/be/src/vec/runtime/vsorted_run_merger.cpp +++ b/be/src/vec/runtime/vsorted_run_merger.cpp @@ -19,11 +19,9 @@ #include <vector> -#include "exprs/expr.h" #include "runtime/descriptors.h" #include "runtime/row_batch.h" #include "runtime/sorter.h" -#include "runtime/tuple_row.h" #include "util/debug_util.h" #include "util/defer_op.h" #include "util/runtime_profile.h" diff --git a/be/src/vec/sink/mysql_result_writer.cpp b/be/src/vec/sink/mysql_result_writer.cpp index 4a8f72d..74a9bff 100644 --- a/be/src/vec/sink/mysql_result_writer.cpp +++ b/be/src/vec/sink/mysql_result_writer.cpp @@ -19,13 +19,13 @@ #include "runtime/buffer_control_block.h" #include "runtime/runtime_state.h" -#include "util/date_func.h" #include "vec/columns/column_nullable.h" #include "vec/columns/column_vector.h" #include "vec/common/assert_cast.h" #include "vec/exprs/vexpr.h" #include "vec/exprs/vexpr_context.h" #include "vec/runtime/vdatetime_value.h" + namespace doris { namespace vectorized { VMysqlResultWriter::VMysqlResultWriter(BufferControlBlock* sinker, diff --git a/be/src/vec/sink/result_writer.h b/be/src/vec/sink/result_writer.h index ef03980..a1fb6ec 100644 --- a/be/src/vec/sink/result_writer.h +++ b/be/src/vec/sink/result_writer.h @@ -16,7 +16,9 @@ // under the License. #pragma once + #include "runtime/result_writer.h" + namespace doris { namespace vectorized { class VResultWriter : public ResultWriter { diff --git a/be/src/vec/sink/vdata_stream_sender.cpp b/be/src/vec/sink/vdata_stream_sender.cpp index cd830e5..fc55ca8 100644 --- a/be/src/vec/sink/vdata_stream_sender.cpp +++ b/be/src/vec/sink/vdata_stream_sender.cpp @@ -433,7 +433,7 @@ Status VDataStreamSender::send(RuntimeState* state, Block* block) { int result[result_size]; RETURN_IF_ERROR(get_partition_column_result(block, result)); - // vectorized caculate hash + // vectorized calculate hash int rows = block->rows(); // for each row, we have a siphash val std::vector<SipHash> siphashs(rows); @@ -453,7 +453,7 @@ Status VDataStreamSender::send(RuntimeState* state, Block* block) { RETURN_IF_ERROR(channel_add_rows(_channels, num_channels, hash_vals, rows, block)); } else if (_part_type == TPartitionType::BUCKET_SHFFULE_HASH_PARTITIONED) { - // 1. caculate hash + // 1. calculate hash // 2. dispatch rows to channel int num_channels = _channel_shared_ptrs.size(); @@ -461,7 +461,7 @@ Status VDataStreamSender::send(RuntimeState* state, Block* block) { int result[result_size]; RETURN_IF_ERROR(get_partition_column_result(block, result)); - // vectorized caculate hash val + // vectorized calculate hash val int rows = block->rows(); // for each row, we have a hash_val std::vector<size_t> hash_vals(rows); @@ -488,7 +488,7 @@ Status VDataStreamSender::send(RuntimeState* state, Block* block) { channel_add_rows(_channel_shared_ptrs, num_channels, hash_vals, rows, block)); } else { // Range partition - // 1. caculate range + // 1. calculate range // 2. dispatch rows to channel } return Status::OK(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org