Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
9ee4e8f
[doris-1063][vectorized] support clickhouse vec code in doris
Mar 19, 2021
f3c7464
[doris-1063][vectorized] fix compile error in gcc 10
Mar 22, 2021
65275f7
[doris-1063][vectorized] support row batch convert to vec block
Mar 22, 2021
39d9713
[doris-1063] refactor
Mar 22, 2021
477bd14
[doris-1063][vectorized] block test
Mar 22, 2021
b299d45
[doris-1063][vectorized] fix block test
Mar 23, 2021
4e134a3
[doris-1063][vectorized] support function and agg function interface
Mar 25, 2021
84e0cf7
[doris-1063][vectorized] support nullable column in rowbatch convert …
Mar 26, 2021
728c2cf
[doris-1063][vectorized]
Mar 30, 2021
84fb28f
[doris-1063][vectorized] support vector expr
Mar 30, 2021
5072e85
[doris-1063] rename files and repalce include
Mar 31, 2021
724edfd
[doris-1063] add some test case in vexpr
Mar 31, 2021
6d73cd0
[doris-1063] format code and change namespace
Mar 31, 2021
bb2109b
[doris-1063][vectorized]
Mar 31, 2021
87e164c
[doris-1063][vectorized] spec column name, fix data type
Apr 1, 2021
22e19d5
[doris-1063][vectorized] add benchmark
Apr 1, 2021
c0b39ae
[doris-1063][vectorized] add vexpr create trees
Apr 1, 2021
4f6f2c6
[doris-1063][vectorized] support more operation of vexpr and vexpr_co…
Apr 1, 2021
a7acc63
[doris-1063][vectorized] support no group agg node
Apr 2, 2021
2092000
[doris-1063][vectorized] support outputexpr vecteroized
Apr 2, 2021
074e269
[doris-1063][vectorized] support abs function of decimal type
Apr 6, 2021
11f7a36
[doris-1063][vectorized] support no group agg node, support data sink
Apr 6, 2021
a432066
[doris-1063][vectorized] support literal expr
Apr 7, 2021
8a4ed57
[doris-1063][vectorized] support < > = != comparison expr
Apr 7, 2021
723940f
[doris-1063][vectorized] support and/or/not/xor logic expr
Apr 7, 2021
65be887
[doris-1063][vectorized] support return block from olap scan node
yangzhg Apr 2, 2021
08a8578
[doris-1063][vectorized] fix core when return rows is large than 1024
Apr 8, 2021
a56f64f
[doris-1063][vectorized] use function base instead of ifunction
Apr 8, 2021
b335184
[doris-1063][vectorized] add cast function Note:: not support Dateti…
Apr 8, 2021
6d52b5a
[doris-1063][vectorized] 1. support cast expr 2. support sum(decimal)
Apr 9, 2021
1410731
[doris-1063][vectorized] fix some trick logic
Apr 9, 2021
640513c
[doris-1063][vectorized] fix aggnode align
Apr 12, 2021
b10619e
[doris-1063][vectorized] support vectorized filter expr
Apr 9, 2021
1134b6d
[doris-1063][vectorized] fix core when sink const column
Apr 12, 2021
ea27c06
[doris-1063][vectorized] Fix bug of while break in scanner and core f…
Apr 12, 2021
2a0bbf4
[doris-1063][vectorized] Fix bug of deadlock of doris
Apr 12, 2021
a069be2
[doris-1063][vectorized] support simple group by
Apr 13, 2021
08ce2ef
[compile][vectorized] fix compile error between internal and open
stdpain Apr 13, 2021
a2be416
1. Support fitler conjunct push down to storage engine
Apr 14, 2021
381c9ee
fix stream load be npe
wangbo Apr 15, 2021
44e6270
[vectorized] support agg const
stdpain Apr 14, 2021
34d1b80
1. Support +=*/int_div operations
Apr 15, 2021
0e74dc5
support serialize and deserialize block
Apr 19, 2021
a4fd144
add compress and decompress when serialize (#6)
yangzhg Apr 21, 2021
407ac47
Fix core when serialize and deserialize nullable column (#7)
yangzhg Apr 21, 2021
3749c96
remove serialize function row by row (#10)
yangzhg Apr 21, 2021
ac700bc
[Exechange Node] Support Exechange Node (#9)
stdpain Apr 22, 2021
067141a
fix merge error (#11)
stdpain Apr 22, 2021
a460e46
Change avg intermediate type to origin type (#12)
EmmyMiao87 Apr 22, 2021
79c3d41
[AGG] support multi-tablet no group AGG (#14)
stdpain Apr 23, 2021
1f08e48
[UDAF]Add max/min UDAF (#8)
wangbo Apr 23, 2021
be9d2b8
[VSort Node] Support VSortNode (#13)
HappenLee Apr 23, 2021
a174383
[VTON-N Node] Support VTON-N Node
Apr 25, 2021
f4a0d50
1. remove some idle code
Apr 25, 2021
ed7f585
support multi-tablet group by agg (#15)
stdpain Apr 25, 2021
13cce08
fix serialize error (#18)
stdpain Apr 25, 2021
61f8d24
max/min support nullable column (#17)
wangbo Apr 27, 2021
db90111
[Sort] Support merge sort in ExchangeNode (#19)
HappenLee Apr 27, 2021
73a840a
Add profile to analyze the performance (#20)
HappenLee Apr 27, 2021
0833446
1. Speed up compilation 2. Optimization of sum nullable column (#21)
stdpain Apr 28, 2021
d16e883
1. Fix the bug of sort node return empty block if child eos is true a…
HappenLee Apr 30, 2021
9fee2bc
Support plan vectorized functiuon in FE (#24)
yangzhg Apr 30, 2021
05bde1f
add vectorized union node (#22)
yangzhg Apr 30, 2021
02057b9
support iterator in vaggnode (#25)
stdpain May 7, 2021
cf1c4a9
some warning fix (#27)
stdpain May 7, 2021
b13a4a9
1. Fix the core bug of agg query in DEBUG mode (#28)
HappenLee May 8, 2021
04f336f
[1/2] support multi-distinct (#29)
stdpain May 11, 2021
42317b3
[Bug-Fix] Add function `addBuiltinBothScalaAndVectorized` to replace …
HappenLee May 11, 2021
a474b5c
[2/2] support multi-distinct (#30)
stdpain May 11, 2021
9febeff
add profile in agg node (#33)
stdpain May 13, 2021
224e919
fix stream load fail (#34)
stdpain May 14, 2021
344f75d
Support agg functiuon for const vliteral and remove some unless sink …
HappenLee May 14, 2021
c8d6c94
Support hll function: hll_empty(), hll_hash(), hll_cardinality() (#36)
HappenLee May 17, 2021
3e949ac
support date and datetime. (#35)
yangzhg May 17, 2021
12fa213
support multi distinct sum/min/max (#37)
stdpain May 17, 2021
1945b2d
remove get_timezone
yangzhg May 17, 2021
d6a0c3e
remove time zone from data_time (#39)
yangzhg May 17, 2021
6b2496e
support value cast to varchar (#38)
HappenLee May 18, 2021
037cd40
support serialize and deserialize date/datetime (#42)
yangzhg May 18, 2021
18361a3
Fix the bug of grout by column is null (#40)
HappenLee May 18, 2021
3335261
Support having clause (#43)
yangzhg May 18, 2021
139a03a
define column bitmap (#41)
stdpain May 18, 2021
c4f5c15
provide status return type (#44)
stdpain May 19, 2021
d2a0b07
fix nullable decimal column will core when comparison with other valu…
yangzhg May 19, 2021
0f83426
Support Stream Pre Agg (#47)
HappenLee May 24, 2021
f959f24
support to_bitmap (#45)
stdpain May 24, 2021
64aec63
add binary bitmap function (#51)
stdpain May 26, 2021
f074f2d
Support cast of each type (#50)
HappenLee May 26, 2021
cd238ea
add is null / is not null (#52)
May 27, 2021
ca5e01f
support some bitmap function bitmap_count bitmap_and/or/xor (#53)
stdpain May 27, 2021
3d1294e
rebase doris master
yangzhg May 28, 2021
c1ed00d
support bitmap agg function bitmap_union bitmap_union_count bitmap_un…
stdpain May 30, 2021
332786d
Support day, hour, minute, month, year, second, weekofyear, dayofmont…
HappenLee May 31, 2021
32d0eb0
Support in/not in predicate (#57)
HappenLee Jun 2, 2021
79f672b
support some string function (#58)
stdpain Jun 2, 2021
91c7777
Support Function of to_days date_add, date_sub, datediff, timediff, *…
HappenLee Jun 3, 2021
9a19621
support if function (#60)
Jun 4, 2021
280250e
support some string function (#61)
stdpain Jun 7, 2021
2cb2eb6
Support Time Function (#62)
HappenLee Jun 7, 2021
481e252
Fix bug, support nullable function, and optimal (#67)
HappenLee Jun 10, 2021
90dc50b
support str_to_date, lpad, rpad (#64)
stdpain Jun 10, 2021
7a2c2ec
[vec] support json functions (#68)
stdpain Jun 11, 2021
6d6a735
implement some math function sin asin cos acos tan atan ceil log log2…
yangzhg Jun 11, 2021
a475bc1
fix no call create/desctory in agg data (#69)
stdpain Jun 11, 2021
f311afe
fix_math bug
yangzhg Jun 18, 2021
cf64824
Del unless file in vec/common logger_useful.h defines.h (#73)
HappenLee Jun 18, 2021
c0cd360
fix strict-warning, add some profile, use status instead of exception…
stdpain Jun 18, 2021
4914da6
function reformat for IO/Columns (#75)
HappenLee Jun 18, 2021
919342b
use status instead of exception [2] (#76)
stdpain Jun 18, 2021
503325e
reformat function name of vec/core (#77)
HappenLee Jun 21, 2021
0b257ed
use status instead of exception [3] (#78)
stdpain Jun 21, 2021
a325d54
reformat function name of vec/aggregate_function (#79)
HappenLee Jun 21, 2021
c8b7b8b
use status instead of exception [4] (#80)
stdpain Jun 21, 2021
e7f5d5f
reformat function name of vec/function vec/data_type (#81)
HappenLee Jun 22, 2021
65c69c8
fix binary cast errror (#83)
stdpain Jun 23, 2021
4f4ef6a
support cross join node (#84)
HappenLee Jun 25, 2021
b350f14
Add The Profile For VExec (#85)
HappenLee Jun 28, 2021
f85cc80
add memory tracker in agg node, fix unregist bitmap function (#86)
stdpain Jun 29, 2021
e9831df
refactor the code of serialize/deserialize (#88)
HappenLee Jun 29, 2021
f0c4fbf
fix double free in agg (#87)
stdpain Jun 29, 2021
259728a
fix unmeaning materized in agg, reuse vector in vectorized agg calc (…
stdpain Jun 30, 2021
c538edd
1. Add MemTracker In Sort/Scan/Exchange/Corss Join Node (#90)
HappenLee Jun 30, 2021
ed02f2f
Fix the mem leak and mem limit (#91)
HappenLee Jun 30, 2021
c8c442e
remove unused code and format (#93)
BiteTheDDDDt Jun 30, 2021
42e32bc
remove unused code, format some code (#92)
stdpain Jul 1, 2021
42381aa
Format code in vec/data_types, vec/function ,Normalize thirdparty (#94)
HappenLee Jul 1, 2021
872527c
remove Errorcodes (#95)
stdpain Jul 1, 2021
83596e4
disable format in section (#96)
stdpain Jul 1, 2021
b55702e
fix null in FE in vectorized judge (#97)
stdpain Jul 5, 2021
e228d5b
1. Remove useless cast in math compute (#98)
HappenLee Jul 5, 2021
76e043a
fix core in exec_node::init (#99)
stdpain Jul 5, 2021
caf43e9
1. Refactored constructor of Function/ScalaFunction/AggregateFunction…
HappenLee Jul 5, 2021
6fb6f20
support null result in no grouping aggregate function in empty set (#…
HappenLee Jul 7, 2021
2e7670e
Refactor the seriable/deseriable of agg (#103)
HappenLee Jul 8, 2021
00c6ee5
Fix Agg Memory OverFlow (#105)
stdpain Jul 9, 2021
2e35f8d
Plan nullable param (#101)
EmmyMiao87 Jul 9, 2021
15b5880
Refactor code of aggregate Node (#104)
HappenLee Jul 12, 2021
a80aefe
fix couldn't found sum(largeint) (#107)
stdpain Jul 12, 2021
fc84062
Fix nullable error of case when (#110)
EmmyMiao87 Jul 12, 2021
b6f4756
Fix the error result of const expr (#111)
EmmyMiao87 Jul 12, 2021
65fd002
Add more function to null_result_with_one_null_param_functions (#112)
EmmyMiao87 Jul 12, 2021
fe697a3
[BUG]fix expr's args type and return type check failed (#108)
wangbo Jul 13, 2021
3a999dc
fix compile problem after rebase code
HappenLee Jul 13, 2021
23c34ad
Remove unused datetime check (#114)
EmmyMiao87 Jul 13, 2021
9c2185c
Fix UT (#116)
HappenLee Jul 15, 2021
4aa1a1b
rebase from apache master
HappenLee Jul 30, 2021
257d672
support join (#118)
stdpain Aug 2, 2021
a8c2610
[NEW FEATURE]local exchange under doris-vec (#120)
zhangstar333 Aug 9, 2021
8544355
[vec-join] support nullable column join and eq_for_null join (#119)
stdpain Aug 9, 2021
429bbd2
rebase from apache master
HappenLee Aug 10, 2021
f29db50
[Local Exchange] Fix the bug: (#122)
HappenLee Aug 16, 2021
291120f
add nginx style memory_pool
Aug 18, 2021
d46448c
delete main for memorypool
Aug 18, 2021
556e1a8
add memoryPool
Aug 19, 2021
7c5cbdd
MemoryPool test
Aug 19, 2021
097f1c7
template CachedObj base class
Aug 19, 2021
330f2c5
[MemReuse] Support MemReuse in Vec Exec Engine (#123)
HappenLee Aug 23, 2021
dd6b588
[Bug] Fix the 3 bug following (#127)
HappenLee Aug 23, 2021
ad56eac
[Vec Storage Engine] Add VCollectIterator Interface (#126)
HappenLee Aug 23, 2021
1010304
[Reader-Vec] Support RowBlockV2 Convert To Vec Block (#125)
HappenLee Aug 23, 2021
5889a27
MergeIterator support vectorized next_batch interface
Aug 23, 2021
84ead3e
bugfix: memory pool
Aug 24, 2021
dad8096
[Bug-Fix] The bug following fixed: (#132)
HappenLee Aug 26, 2021
609a349
use ChunkAllocator for memory_pool
Aug 26, 2021
c93d42c
new memory pool support dynamic next_block_size
Aug 26, 2021
34e61e5
[Bug fix] The bug following be fixed: (#133)
HappenLee Aug 30, 2021
aa71b17
[Bug fix] The bug following be fixed: (#135)
HappenLee Aug 31, 2021
dd77a64
Vectorized read implementation for RLE decode. (#134)
wangshuo128 Sep 1, 2021
0aa9522
MergeIterator support vectorized next_batch interface (#130)
zuochunwei Sep 2, 2021
19c44e9
add nginx style memory_pool
Aug 18, 2021
4fc981d
delete main for memorypool
Aug 18, 2021
cab3f76
add memoryPool
Aug 19, 2021
3057d60
MemoryPool test
Aug 19, 2021
d752d19
template CachedObj base class
Aug 19, 2021
d5e2fff
bugfix: memory pool
Aug 24, 2021
b452638
use ChunkAllocator for memory_pool
Aug 26, 2021
5a1ab5d
new memory pool support dynamic next_block_size
Aug 26, 2021
6ef3341
Merge branch 'master' of github.com:zuochunwei/doris-vectorized
Sep 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 14 additions & 1 deletion be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ check_function_exists(sched_getcpu HAVE_SCHED_GETCPU)
# -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG: enable nanosecond precision for boost
# -fno-omit-frame-pointers: Keep frame pointer for functions in register
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wall -Wno-sign-compare -Wno-unknown-pragmas -pthread -Werror=strict-aliasing")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fno-omit-frame-pointer")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fstrict-aliasing -fno-omit-frame-pointer -Werror=return-type")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -std=gnu++17 -D__STDC_FORMAT_MACROS")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-deprecated -Wno-vla")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG")
Expand Down Expand Up @@ -461,6 +461,7 @@ set(DORIS_LINK_LIBS
Webserver
TestUtil
Geo
Vec
Plugin
${WL_END_GROUP}
)
Expand Down Expand Up @@ -631,6 +632,7 @@ add_subdirectory(${SRC_DIR}/udf)
add_subdirectory(${SRC_DIR}/tools)
add_subdirectory(${SRC_DIR}/util)
add_subdirectory(${SRC_DIR}/plugin)
add_subdirectory(${SRC_DIR}/vec)

# Utility CMake function to make specifying tests and benchmarks less verbose
FUNCTION(ADD_BE_TEST TEST_NAME)
Expand Down Expand Up @@ -682,6 +684,12 @@ if (${MAKE_TEST} STREQUAL "ON")
add_subdirectory(${TEST_DIR}/runtime)
add_subdirectory(${TEST_DIR}/udf)
add_subdirectory(${TEST_DIR}/util)
add_subdirectory(${TEST_DIR}/vec/core)
add_subdirectory(${TEST_DIR}/vec/exec)
add_subdirectory(${TEST_DIR}/vec/exprs)
add_subdirectory(${TEST_DIR}/vec/function)
add_subdirectory(${TEST_DIR}/vec/runtime)
add_subdirectory(${TEST_DIR}/vec/aggregate_functions)
add_subdirectory(${TEST_DIR}/plugin)
add_subdirectory(${TEST_DIR}/plugin/example)
endif ()
Expand All @@ -704,3 +712,8 @@ install(FILES
${BASE_DIR}/../conf/odbcinst.ini
DESTINATION ${OUTPUT_DIR}/conf)


get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
message(STATUS "dir='${dir}'")
endforeach()
5 changes: 5 additions & 0 deletions be/src/common/compiler_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
/// not a command. This should be used sparingly for cases when either the function
/// needs to be inlined for a specific reason or the compiler's heuristics make a bad
/// decision, e.g. not inlining a small function on a hot path.
#ifdef ALWAYS_INLINE
#undef ALWAYS_INLINE
#endif
#define ALWAYS_INLINE __attribute__((always_inline))
#define NO_INLINE __attribute__((__noinline__))
#define MAY_ALIAS __attribute__((__may_alias__))

#define ALIGN_CACHE_LINE __attribute__((aligned(CACHE_LINE_SIZE)))

Expand Down
1 change: 1 addition & 0 deletions be/src/common/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@
DCHECK(a == b) << "[ " #a " = " << static_cast<int>(a) << " , " #b " = " \
<< static_cast<int>(b) << " ]"

#include "fmt/format.h"
#endif
2 changes: 2 additions & 0 deletions be/src/common/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ class Status {
/// trailing message.
Status clone_and_append(const Slice& msg) const;

operator bool() { return this->ok(); }

private:
const char* copy_state(const char* state);

Expand Down
13 changes: 11 additions & 2 deletions be/src/exec/aggregation_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include <gperftools/profiler.h>
#include <math.h>
#include <thrift/protocol/TDebugProtocol.h>

#include <sstream>

Expand Down Expand Up @@ -223,6 +222,15 @@ Status AggregationNode::open(RuntimeState* state) {
}

Status AggregationNode::get_next(RuntimeState* state, RowBatch* row_batch, bool* eos) {
// 1. `!need_finalize` means this aggregation node not the level two aggregation node
// 2. `_singleton_output_tuple != nullptr` means is not group by
// 3. `child(0)->rows_returned() == 0` mean not data from child
// in level two aggregation node should return NULL result
// level one aggregation node set `eos = true` return directly
if (UNLIKELY(!_needs_finalize && _singleton_output_tuple != nullptr && child(0)->rows_returned() == 0)) {
*eos = true;
return Status::OK();
}
SCOPED_TIMER(_runtime_profile->total_time_counter());
RETURN_IF_ERROR(exec_debug_action(TExecNodePhase::GETNEXT));
RETURN_IF_CANCELLED(state);
Expand Down Expand Up @@ -403,7 +411,8 @@ Tuple* AggregationNode::finalize_tuple(Tuple* tuple, MemPool* pool) {
dst = Tuple::create(_output_tuple_desc->byte_size(), pool);
}
if (_needs_finalize) {
AggFnEvaluator::finalize(_aggregate_evaluators, _agg_fn_ctxs, tuple, dst);
AggFnEvaluator::finalize(_aggregate_evaluators, _agg_fn_ctxs, tuple, dst,
_singleton_output_tuple != nullptr && child(0)->rows_returned() == 0);
} else {
AggFnEvaluator::serialize(_aggregate_evaluators, _agg_fn_ctxs, tuple);
}
Expand Down
2 changes: 1 addition & 1 deletion be/src/exec/broker_scan_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ BrokerScanNode::BrokerScanNode(ObjectPool* pool, const TPlanNode& tnode, const D
BrokerScanNode::~BrokerScanNode() {}

Status BrokerScanNode::init(const TPlanNode& tnode, RuntimeState* state) {
RETURN_IF_ERROR(ScanNode::init(tnode));
RETURN_IF_ERROR(ScanNode::init(tnode, state));
auto& broker_scan_node = tnode.broker_scan_node;

if (broker_scan_node.__isset.pre_filter_exprs) {
Expand Down
2 changes: 1 addition & 1 deletion be/src/exec/cross_join_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Status CrossJoinNode::construct_build_side(RuntimeState* state) {
RETURN_IF_CANCELLED(state);
// TODO(zhaochun):
// RETURN_IF_ERROR(state->CheckQueryState());
bool eos = true;
bool eos = false;
RETURN_IF_ERROR(child(1)->get_next(state, batch, &eos));

// to prevent use too many memory
Expand Down
30 changes: 21 additions & 9 deletions be/src/exec/data_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@
#include "runtime/result_sink.h"
#include "runtime/runtime_state.h"
#include "util/logging.h"
#include "vec/sink/result_sink.h"
#include "vec/sink/vdata_stream_sender.h"

namespace doris {

Status DataSink::create_data_sink(ObjectPool* pool, const TDataSink& thrift_sink,
const std::vector<TExpr>& output_exprs,
const TPlanFragmentExecParams& params,
const RowDescriptor& row_desc,
bool is_vec,
boost::scoped_ptr<DataSink>* sink) {
DataSink* tmp_sink = NULL;

Expand All @@ -55,9 +58,15 @@ Status DataSink::create_data_sink(ObjectPool* pool, const TDataSink& thrift_sink
? params.send_query_statistics_with_every_batch
: false;
// TODO: figure out good buffer size based on size of output row
tmp_sink = new DataStreamSender(pool, params.sender_id, row_desc, thrift_sink.stream_sink,
params.destinations, 16 * 1024,
send_query_statistics_with_every_batch);
if (is_vec) {
tmp_sink = new doris::vectorized::VDataStreamSender(
pool, params.sender_id, row_desc, thrift_sink.stream_sink, params.destinations,
16 * 1024, send_query_statistics_with_every_batch);
} else {
tmp_sink = new DataStreamSender(pool, params.sender_id, row_desc, thrift_sink.stream_sink,
params.destinations, 16 * 1024,
send_query_statistics_with_every_batch);
}
// RETURN_IF_ERROR(sender->prepare(state->obj_pool(), thrift_sink.stream_sink));
sink->reset(tmp_sink);
break;
Expand All @@ -68,7 +77,11 @@ Status DataSink::create_data_sink(ObjectPool* pool, const TDataSink& thrift_sink
}

// TODO: figure out good buffer size based on size of output row
tmp_sink = new ResultSink(row_desc, output_exprs, thrift_sink.result_sink, 1024);
if (is_vec) {
tmp_sink = new doris::vectorized::ResultSink(row_desc, output_exprs, thrift_sink.result_sink, 1024);
} else {
tmp_sink = new ResultSink(row_desc, output_exprs, thrift_sink.result_sink, 1024);
}
sink->reset(tmp_sink);
break;
case TDataSinkType::MEMORY_SCRATCH_SINK:
Expand Down Expand Up @@ -98,8 +111,7 @@ Status DataSink::create_data_sink(ObjectPool* pool, const TDataSink& thrift_sink
if (!thrift_sink.__isset.odbc_table_sink) {
return Status::InternalError("Missing data odbc sink.");
}
OdbcTableSink* odbc_tbl_sink = new OdbcTableSink(pool,
row_desc, output_exprs);
OdbcTableSink* odbc_tbl_sink = new OdbcTableSink(pool, row_desc, output_exprs);
sink->reset(odbc_tbl_sink);
break;
}
Expand Down Expand Up @@ -158,9 +170,9 @@ Status DataSink::init(const TDataSink& thrift_sink) {
}

Status DataSink::prepare(RuntimeState* state) {
_expr_mem_tracker = MemTracker::CreateTracker(
-1, _name + ":Expr:" + std::to_string(state->load_job_id()),
state->instance_mem_tracker());
_expr_mem_tracker =
MemTracker::CreateTracker(-1, _name + ":Expr:" + std::to_string(state->load_job_id()),
state->instance_mem_tracker());
return Status::OK();
}

Expand Down
1 change: 1 addition & 0 deletions be/src/exec/data_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class DataSink {
const std::vector<TExpr>& output_exprs,
const TPlanFragmentExecParams& params,
const RowDescriptor& row_desc,
bool is_vec,
boost::scoped_ptr<DataSink>* sink);

// Returns the runtime profile for the sink.
Expand Down
93 changes: 77 additions & 16 deletions be/src/exec/exec_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
#include "runtime/runtime_state.h"
#include "util/debug_util.h"
#include "util/runtime_profile.h"
#include "vec/core/block.h"
#include "vec/exec/join/vhash_join_node.h"
#include "vec/exec/vaggregation_node.h"
#include "vec/exec/vcross_join_node.h"
#include "vec/exec/vexchange_node.h"
#include "vec/exec/volap_scan_node.h"
#include "vec/exec/vsort_node.h"
#include "vec/exec/vunion_node.h"
#include "vec/exprs/vexpr.h"

namespace doris {

Expand Down Expand Up @@ -127,9 +136,7 @@ ExecNode::ExecNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl
_rows_returned_counter(NULL),
_rows_returned_rate(NULL),
_memory_used_counter(NULL),
_is_closed(false) {
init_runtime_profile(print_plan_node_type(tnode.node_type));
}
_is_closed(false) {}

ExecNode::~ExecNode() {}

Expand Down Expand Up @@ -159,7 +166,21 @@ void ExecNode::push_down_predicate(RuntimeState* state, std::list<ExprContext*>*
}

Status ExecNode::init(const TPlanNode& tnode, RuntimeState* state) {
std::string profile;
if (state && state->enable_vectorized_exec()) {
profile = "V" + print_plan_node_type(tnode.node_type);
} else {
profile = print_plan_node_type(tnode.node_type);
}
init_runtime_profile(profile);

if (tnode.__isset.vconjunct) {
_vconjunct_ctx_ptr.reset(new doris::vectorized::VExprContext*);
RETURN_IF_ERROR(doris::vectorized::VExpr::create_expr_tree(_pool, tnode.vconjunct,
_vconjunct_ctx_ptr.get()));
}
RETURN_IF_ERROR(Expr::create_expr_trees(_pool, tnode.conjuncts, &_conjunct_ctxs));

return Status::OK();
}

Expand All @@ -178,11 +199,14 @@ Status ExecNode::prepare(RuntimeState* state) {
_expr_mem_tracker = MemTracker::CreateTracker(-1, "ExecNode:Exprs:" + _runtime_profile->name(),
_mem_tracker);
_expr_mem_pool.reset(new MemPool(_expr_mem_tracker.get()));
// TODO chenhao

if (_vconjunct_ctx_ptr) {
RETURN_IF_ERROR((*_vconjunct_ctx_ptr)->prepare(state, row_desc(), expr_mem_tracker()));
}
RETURN_IF_ERROR(Expr::prepare(_conjunct_ctxs, state, row_desc(), expr_mem_tracker()));

// TODO(zc):
// AddExprCtxsToFree(_conjunct_ctxs);

for (int i = 0; i < _children.size(); ++i) {
RETURN_IF_ERROR(_children[i]->prepare(state));
}
Expand All @@ -192,6 +216,9 @@ Status ExecNode::prepare(RuntimeState* state) {

Status ExecNode::open(RuntimeState* state) {
RETURN_IF_ERROR(exec_debug_action(TExecNodePhase::OPEN));
if (_vconjunct_ctx_ptr) {
RETURN_IF_ERROR((*_vconjunct_ctx_ptr)->open(state));
}
return Expr::open(_conjunct_ctxs, state);
}

Expand Down Expand Up @@ -230,6 +257,7 @@ Status ExecNode::close(RuntimeState* state) {
}
}

if (_vconjunct_ctx_ptr) (*_vconjunct_ctx_ptr)->close(state);
Expr::close(_conjunct_ctxs, state);

if (expr_mem_pool() != nullptr) {
Expand Down Expand Up @@ -362,22 +390,39 @@ Status ExecNode::create_node(RuntimeState* state, ObjectPool* pool, const TPlanN
return Status::OK();

case TPlanNodeType::OLAP_SCAN_NODE:
*node = pool->add(new OlapScanNode(pool, tnode, descs));
if (state->enable_vectorized_exec()) {
*node = pool->add(new vectorized::VOlapScanNode(pool, tnode, descs));
} else {
*node = pool->add(new OlapScanNode(pool, tnode, descs));
}
return Status::OK();

case TPlanNodeType::AGGREGATION_NODE:
if (config::enable_partitioned_aggregation) {
*node = pool->add(new PartitionedAggregationNode(pool, tnode, descs));
if (state->enable_vectorized_exec()) {
*node = pool->add(new vectorized::AggregationNode(pool, tnode, descs));
} else {
*node = pool->add(new AggregationNode(pool, tnode, descs));
if (config::enable_partitioned_aggregation) {
*node = pool->add(new PartitionedAggregationNode(pool, tnode, descs));
} else {
*node = pool->add(new AggregationNode(pool, tnode, descs));
}
}
return Status::OK();

case TPlanNodeType::HASH_JOIN_NODE:
*node = pool->add(new HashJoinNode(pool, tnode, descs));
if (state->enable_vectorized_exec()) {
*node = pool->add(new vectorized::HashJoinNode(pool, tnode, descs));
} else {
*node = pool->add(new HashJoinNode(pool, tnode, descs));
}
return Status::OK();

case TPlanNodeType::CROSS_JOIN_NODE:
*node = pool->add(new CrossJoinNode(pool, tnode, descs));
if (state->enable_vectorized_exec()) {
*node = pool->add(new vectorized::VCrossJoinNode(pool, tnode, descs));
} else {
*node = pool->add(new CrossJoinNode(pool, tnode, descs));
}
return Status::OK();

case TPlanNodeType::MERGE_JOIN_NODE:
Expand All @@ -389,7 +434,11 @@ Status ExecNode::create_node(RuntimeState* state, ObjectPool* pool, const TPlanN
return Status::OK();

case TPlanNodeType::EXCHANGE_NODE:
*node = pool->add(new ExchangeNode(pool, tnode, descs));
if (state->enable_vectorized_exec()) {
*node = pool->add(new doris::vectorized::VExchangeNode(pool, tnode, descs));
} else {
*node = pool->add(new ExchangeNode(pool, tnode, descs));
}
return Status::OK();

case TPlanNodeType::SELECT_NODE:
Expand All @@ -401,10 +450,14 @@ Status ExecNode::create_node(RuntimeState* state, ObjectPool* pool, const TPlanN
return Status::OK();

case TPlanNodeType::SORT_NODE:
if (tnode.sort_node.use_top_n) {
*node = pool->add(new TopNNode(pool, tnode, descs));
if (state->enable_vectorized_exec()) {
*node = pool->add(new vectorized::VSortNode(pool, tnode, descs));
} else {
*node = pool->add(new SpillSortNode(pool, tnode, descs));
if (tnode.sort_node.use_top_n) {
*node = pool->add(new TopNNode(pool, tnode, descs));
} else {
*node = pool->add(new SpillSortNode(pool, tnode, descs));
}
}

return Status::OK();
Expand All @@ -417,7 +470,11 @@ Status ExecNode::create_node(RuntimeState* state, ObjectPool* pool, const TPlanN
return Status::OK();

case TPlanNodeType::UNION_NODE:
*node = pool->add(new UnionNode(pool, tnode, descs));
if (state->enable_vectorized_exec()) {
*node = pool->add(new vectorized::VUnionNode(pool, tnode, descs));
} else {
*node = pool->add(new UnionNode(pool, tnode, descs));
}
return Status::OK();

case TPlanNodeType::INTERSECT_NODE:
Expand Down Expand Up @@ -624,4 +681,8 @@ Status ExecNode::QueryMaintenance(RuntimeState* state, const std::string& msg) {
return state->check_query_state(msg);
}

Status ExecNode::get_next(RuntimeState* state, vectorized::Block* block, bool* eos) {
return Status::NotSupported("Not Implemented get block");
}

} // namespace doris
Loading