From ba4394877d69a5985e559560b444261b2a04a551 Mon Sep 17 00:00:00 2001 From: Joe Giardino Date: Mon, 16 Dec 2024 11:51:38 -0800 Subject: [PATCH] Fix copyPreserveEncodings for LazyVector (#11855) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/11855 When loading data without a predicate we can the hive connector can return some LazyVectors. Currently the data sink attempts a call to copyPreserveEncodings (which is unsupported by LazyVector) to get a long lived owned copy of the data against its own memory pool. Putting this aside, we actually want to see impulse preload this data ahead of time for reliable query perf. This diff patches LazyVector::copyPreserveEncodings and ensures Impulse preloads data prior to obtaining a copy. Reviewed By: Yuhta Differential Revision: D67204919 fbshipit-source-id: 189a0877824872f355c5a7677be0219318722460 --- velox/vector/LazyVector.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/velox/vector/LazyVector.h b/velox/vector/LazyVector.h index 3957002a1d31..4ef1b0054ef2 100644 --- a/velox/vector/LazyVector.h +++ b/velox/vector/LazyVector.h @@ -364,8 +364,9 @@ class LazyVector : public BaseVector { void validate(const VectorValidateOptions& options) const override; VectorPtr copyPreserveEncodings( - velox::memory::MemoryPool* /* pool */ = nullptr) const override { - VELOX_UNSUPPORTED("copyPreserveEncodings not defined for LazyVector"); + velox::memory::MemoryPool* pool = nullptr) const override { + VELOX_CHECK(isLoaded()); + return loadedVector()->copyPreserveEncodings(pool); } private: