This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 9cb9781 [chore](storage) add STORAGE_LAYER_VECTORIZED_SWITCH (#8005)
9cb9781 is described below
commit 9cb9781d86b3a1e63b84f4dace3645575d3cd52c
Author: zuochunwei <[email protected]>
AuthorDate: Sat Feb 19 11:47:36 2022 +0800
[chore](storage) add STORAGE_LAYER_VECTORIZED_SWITCH (#8005)
if you want test storage layer vectorized, you need modify some codes to
let vectorized storage layer working,
it's boring work.
now, you can just change one code (redefine the macro
STORAGE_LAYER_VECTORIZED_SWITCH as 1 or 0),
this gets more convenient.
---
be/src/olap/rowset/beta_rowset_reader.cpp | 32 +++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/be/src/olap/rowset/beta_rowset_reader.cpp
b/be/src/olap/rowset/beta_rowset_reader.cpp
index 3aed8eb..0134cb5 100644
--- a/be/src/olap/rowset/beta_rowset_reader.cpp
+++ b/be/src/olap/rowset/beta_rowset_reader.cpp
@@ -15,12 +15,21 @@
// specific language governing permissions and limitations
// under the License.
-#include "beta_rowset_reader.h"
+// add a switch for storage layer vectorized
+// you can easily switch on/off storage layer vectorized using
STORAGE_LAYER_VECTORIZED_SWITCH without changing other codes
+// 0:close storage layer vectorized (default value); 1:open
+#define STORAGE_LAYER_VECTORIZED_SWITCH 0
+#include "beta_rowset_reader.h"
#include <utility>
-
#include "olap/delete_handler.h"
+
+#if !STORAGE_LAYER_VECTORIZED_SWITCH
#include "olap/generic_iterators.h"
+#else
+#include "vec/olap/vgeneric_iterators.h"
+#endif
+
#include "olap/row_block.h"
#include "olap/row_block2.h"
#include "olap/row_cursor.h"
@@ -118,11 +127,19 @@ OLAPStatus BetaRowsetReader::init(RowsetReaderContext*
read_context) {
// merge or union segment iterator
RowwiseIterator* final_iterator;
+#if !STORAGE_LAYER_VECTORIZED_SWITCH
if (read_context->need_ordered_result &&
_rowset->rowset_meta()->is_segments_overlapping()) {
final_iterator = new_merge_iterator(iterators, _parent_tracker,
read_context->sequence_id_idx);
} else {
final_iterator = new_union_iterator(iterators, _parent_tracker);
}
+#else
+ if (read_context->need_ordered_result &&
_rowset->rowset_meta()->is_segments_overlapping()) {
+ final_iterator = vectorized::new_merge_iterator(iterators,
_parent_tracker);
+ } else {
+ final_iterator = vectorized::new_union_iterator(iterators,
_parent_tracker);
+ }
+#endif
auto s = final_iterator->init(read_options);
if (!s.ok()) {
LOG(WARNING) << "failed to init iterator: " << s.to_string();
@@ -180,6 +197,7 @@ OLAPStatus BetaRowsetReader::next_block(RowBlock** block) {
OLAPStatus BetaRowsetReader::next_block(vectorized::Block* block) {
SCOPED_RAW_TIMER(&_stats->block_fetch_ns);
+#if !STORAGE_LAYER_VECTORIZED_SWITCH
bool is_first = true;
do {
@@ -215,6 +233,16 @@ OLAPStatus BetaRowsetReader::next_block(vectorized::Block*
block) {
}
is_first = false;
} while (block->rows() < _context->batch_size); // here we should keep
block.rows() < batch_size
+#else // STORAGE_LAYER_VECTORIZED_SWITCH
+ auto s = _iterator->next_batch(block);
+ if (!s.ok()) {
+ if (s.is_end_of_file()) {
+ return OLAP_ERR_DATA_EOF;
+ } else {
+ LOG(WARNING) << "failed to read next block: " << s.to_string();
+ }
+ }
+#endif // STORAGE_LAYER_VECTORIZED_SWITCH
return OLAP_SUCCESS;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]