diff --git a/velox/dwio/common/Closeable.h b/velox/dwio/common/Closeable.h index 4572e08cf98a..bdb825437889 100644 --- a/velox/dwio/common/Closeable.h +++ b/velox/dwio/common/Closeable.h @@ -18,10 +18,7 @@ #include "velox/dwio/common/exception/Exception.h" -namespace facebook { -namespace velox { -namespace dwio { -namespace common { +namespace facebook::velox::dwio::common { // Base class for closeable object which need to be explicitly closed before // being destructed @@ -67,7 +64,4 @@ class Closeable { bool closed_; }; -} // namespace common -} // namespace dwio -} // namespace velox -} // namespace facebook +} // namespace facebook::velox::dwio::common diff --git a/velox/dwio/common/FormatData.h b/velox/dwio/common/FormatData.h index d0d37006a2a8..bff3c420bc50 100644 --- a/velox/dwio/common/FormatData.h +++ b/velox/dwio/common/FormatData.h @@ -17,8 +17,8 @@ #pragma once #include "velox/common/memory/Memory.h" +#include "velox/dwio/common/PositionProvider.h" #include "velox/dwio/common/ScanSpec.h" -#include "velox/dwio/common/SeekableInputStream.h" #include "velox/dwio/common/Statistics.h" #include "velox/dwio/common/TypeWithId.h" #include "velox/type/Filter.h" @@ -40,7 +40,7 @@ class FormatData { /// data. If there are no nulls, 'nulls' is set to nullptr, else to /// a suitable sized and padded Buffer. 'incomingNulls' may be given /// if there are enclosing level nulls that should be merged into - /// the read reasult. If provided, this has 'numValues' bits and + /// the read result. If provided, this has 'numValues' bits and /// each zero marks an incoming null for which no bit is read from /// the nulls stream of 'this'. For Parquet, 'nulls' is always set /// to nullptr because nulls are represented by the data pages diff --git a/velox/dwio/common/PositionProvider.h b/velox/dwio/common/PositionProvider.h new file mode 100644 index 000000000000..7be3bc7a1602 --- /dev/null +++ b/velox/dwio/common/PositionProvider.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace facebook::velox::dwio::common { + +class PositionProvider { + public: + explicit PositionProvider(const std::vector& positions) + : position_{positions.begin()}, end_{positions.end()} {} + + uint64_t next(); + + bool hasNext() const; + + private: + std::vector::const_iterator position_; + std::vector::const_iterator end_; +}; + +} // namespace facebook::velox::dwio::common diff --git a/velox/dwio/common/SeekableInputStream.h b/velox/dwio/common/SeekableInputStream.h index 021d78493ab6..ab402753b8c5 100644 --- a/velox/dwio/common/SeekableInputStream.h +++ b/velox/dwio/common/SeekableInputStream.h @@ -16,30 +16,15 @@ #pragma once -#include - #include "velox/dwio/common/DataBuffer.h" #include "velox/dwio/common/InputStream.h" +#include "velox/dwio/common/PositionProvider.h" #include "velox/dwio/common/wrap/zero-copy-stream-wrapper.h" namespace facebook::velox::dwio::common { void printBuffer(std::ostream& out, const char* buffer, uint64_t length); -class PositionProvider { - public: - explicit PositionProvider(const std::vector& positions) - : position_{positions.begin()}, end_{positions.end()} {} - - uint64_t next(); - - bool hasNext() const; - - private: - std::vector::const_iterator position_; - std::vector::const_iterator end_; -}; - /** * A subclass of Google's ZeroCopyInputStream that supports seek. * By extending Google's class, we get the ability to pass it directly