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

[Refactoring] Generalize the ColumnReader and SelectiveColumnReader classes #1620

Closed
yingsu00 opened this issue May 14, 2022 · 1 comment
Closed

Comments

@yingsu00
Copy link
Collaborator

This is a sub issue of #1533

ColumnReader, SelectiveColumnReader and SelectiveStructColumnReader classes need to be moved to facebook::velox::dwio::common::reader. However we need to note that some of their contents are just related to DWRF and ORC. For example:

  • StripeStream and FlatMapContext are specific to DWRF
SelectiveColumnReader(
  	std::shared_ptr<const dwio::common::TypeWithId> requestedType,
  	StripeStreams& stripe,
  	common::ScanSpec* scanSpec,
  	const TypePtr& type,
  	FlatMapContext flatMapContext = FlatMapContext::nonFlatMapContext());

static std::unique_ptr<SelectiveColumnReader> build(
  	const std::shared_ptr<const dwio::common::TypeWithId>& requestedType,
  	const std::shared_ptr<const dwio::common::TypeWithId>& dataType,
  	StripeStreams& stripe,
  	common::ScanSpec* scanSpec,
  	FlatMapContext flatMapContext = FlatMapContext::nonFlatMapContext());
  • RowIndex is DWRF specific
mutable std::unique_ptr<SeekableInputStream> indexStream_;
mutable std::unique_ptr<proto::RowIndex> index_;
  • filterRowGroups means different in Parquet
std::vector<uint32_t> SelectiveColumnReader::filterRowGroups(
	uint64_t rowGroupSize,
	const StatsContext& context)
  • ColumnStatistics means different in Parquet
	const auto& entry = index_->entry(i);
	auto columnStats =
        buildColumnStatisticsFromProto(entry.statistics(), context);
	if (!testFilter(filter, columnStats.get(), rowGroupSize, type_))

Here buildColumnStatisticsFromProto() is DWRF specific.
For Parquet, the columnstats are per RowGroup, and stored together in the footer. Filtering will be done in ParquetRowReader::filterRowGroups(). The file level ColumnStats from all ColumnChunk statistics need to be merged manually.

  • null handling
    ColumnReader null handling doesn't apply to Parquet. Move out from
SelectiveColumnReader::prepareRead(
	vector_size_t offset,
	RowSet rows,
	const uint64_t* incomingNulls) 

Since We moved ColumnReader and SelectiveColumnReader, there are some leftover Dwrf specific leftovers and we may need to create a new level of ColumnReader super classes for Dwrf only. These will be DwrfColumnReader and DwrfSelectiveColumnReader in dwio::dwrf::reader. However If the leftovers are not too much we may also merge them in each Dwrf child XXXColumnReader classes.

@stale
Copy link

stale bot commented Sep 14, 2022

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Sep 14, 2022
@stale stale bot closed this as completed Sep 28, 2022
marin-ma pushed a commit to marin-ma/velox-oap that referenced this issue Dec 15, 2023
…g hash agg (facebookincubator#1827)

Fix error 'attribute binding failed.' when executing hash agg

Close facebookincubator#1620.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants