Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SeekableInputStream.h include from FormatData.h #10859

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions velox/dwio/common/Closeable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,7 +64,4 @@ class Closeable {
bool closed_;
};

} // namespace common
} // namespace dwio
} // namespace velox
} // namespace facebook
} // namespace facebook::velox::dwio::common
4 changes: 2 additions & 2 deletions velox/dwio/common/FormatData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
37 changes: 37 additions & 0 deletions velox/dwio/common/PositionProvider.h
Original file line number Diff line number Diff line change
@@ -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 <vector>

namespace facebook::velox::dwio::common {

class PositionProvider {
public:
explicit PositionProvider(const std::vector<uint64_t>& positions)
: position_{positions.begin()}, end_{positions.end()} {}

uint64_t next();

bool hasNext() const;

private:
std::vector<uint64_t>::const_iterator position_;
std::vector<uint64_t>::const_iterator end_;
};

} // namespace facebook::velox::dwio::common
17 changes: 1 addition & 16 deletions velox/dwio/common/SeekableInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,15 @@

#pragma once

#include <vector>

#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<uint64_t>& positions)
: position_{positions.begin()}, end_{positions.end()} {}

uint64_t next();

bool hasNext() const;

private:
std::vector<uint64_t>::const_iterator position_;
std::vector<uint64_t>::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
Expand Down
Loading