@@ -47,6 +47,10 @@ namespace detail {
47
47
48
48
class WriterContext : public FieldWriterContext {
49
49
public:
50
+ struct ColumnStats {
51
+ uint64_t logicalSize{0 };
52
+ };
53
+
50
54
const VeloxWriterOptions options;
51
55
std::unique_ptr<FlushPolicy> flushPolicy;
52
56
velox::CpuWallTiming totalFlushTiming;
@@ -63,6 +67,7 @@ class WriterContext : public FieldWriterContext {
63
67
uint64_t stripeSize{0 };
64
68
uint64_t rawSize{0 };
65
69
std::vector<uint64_t > rowsPerStripe;
70
+ std::vector<ColumnStats> columnStats;
66
71
67
72
WriterContext (
68
73
velox::memory::MemoryPool& memoryPool,
@@ -516,10 +521,19 @@ bool VeloxWriter::write(const velox::VectorPtr& vector) {
516
521
auto size = vector->size ();
517
522
518
523
// Calculate raw size.
519
- auto rawSize = nimble::getRawSizeFromVector (
520
- vector, velox::common::Ranges::of (0 , size));
524
+ RawSizeContext context;
525
+ auto rawSize = nimble::getRawSizeFromRowVector (
526
+ vector, velox::common::Ranges::of (0 , size), context, /* topLevel=*/ true );
521
527
DWIO_ENSURE_GE (rawSize, 0 , " Invalid raw size" );
522
528
context_->rawSize += rawSize;
529
+ auto columnCount = context.columnCount ();
530
+ if (context_->columnStats .empty ()) {
531
+ context_->columnStats =
532
+ std::vector<detail::WriterContext::ColumnStats>(columnCount);
533
+ }
534
+ for (auto i = 0 ; i < columnCount; ++i) {
535
+ context_->columnStats [i].logicalSize += context.sizeAt (i);
536
+ }
523
537
524
538
if (context_->options .writeExecutor ) {
525
539
velox::dwio::common::ExecutorBarrier barrier{
0 commit comments