File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 16
16
17
17
#pragma once
18
18
19
+ #include " dwio/nimble/common/Exceptions.h"
19
20
#include " dwio/nimble/velox/DecodedVectorManager.h"
20
21
21
22
namespace facebook ::nimble {
@@ -28,8 +29,27 @@ class RawSizeContext {
28
29
return decodedVectorManager_;
29
30
}
30
31
32
+ void appendSize (uint64_t size) {
33
+ columnSizes_.push_back (size);
34
+ }
35
+
36
+ uint64_t sizeAt (uint64_t columnIndex) const {
37
+ NIMBLE_ASSERT (
38
+ columnIndex < columnSizes_.size (),
39
+ fmt::format (
40
+ " Column index {} is out of range. Total number of columns is {}" ,
41
+ columnIndex,
42
+ columnSizes_.size ()));
43
+ return columnSizes_.at (columnIndex);
44
+ }
45
+
46
+ uint64_t columnCount () const {
47
+ return columnSizes_.size ();
48
+ }
49
+
31
50
private:
32
51
DecodedVectorManager decodedVectorManager_;
52
+ std::vector<uint64_t > columnSizes_;
33
53
};
34
54
35
55
} // namespace facebook::nimble
Original file line number Diff line number Diff line change @@ -442,7 +442,8 @@ uint64_t getRawSizeFromMapVector(
442
442
uint64_t getRawSizeFromRowVector (
443
443
const velox::VectorPtr& vector,
444
444
const velox::common::Ranges& ranges,
445
- RawSizeContext& context) {
445
+ RawSizeContext& context,
446
+ const bool topLevel) {
446
447
VELOX_CHECK_NOT_NULL (vector);
447
448
const auto & encoding = vector->encoding ();
448
449
const velox::RowVector* rowVector;
@@ -528,8 +529,12 @@ uint64_t getRawSizeFromRowVector(
528
529
if ((*childRangesPtr).size ()) {
529
530
const auto childrenSize = rowVector->childrenSize ();
530
531
for (size_t i = 0 ; i < childrenSize; ++i) {
531
- rawSize + =
532
+ auto childRawSize =
532
533
getRawSizeFromVector (rowVector->childAt (i), *childRangesPtr, context);
534
+ rawSize += childRawSize;
535
+ if (topLevel) {
536
+ context.appendSize (childRawSize);
537
+ }
533
538
}
534
539
}
535
540
Original file line number Diff line number Diff line change @@ -32,4 +32,9 @@ uint64_t getRawSizeFromVector(
32
32
const velox::VectorPtr& vector,
33
33
const velox::common::Ranges& ranges);
34
34
35
+ uint64_t getRawSizeFromRowVector (
36
+ const velox::VectorPtr& vector,
37
+ const velox::common::Ranges& ranges,
38
+ RawSizeContext& context,
39
+ const bool topLevel = false );
35
40
} // namespace facebook::nimble
You can’t perform that action at this time.
0 commit comments