-
Notifications
You must be signed in to change notification settings - Fork 52
feat(schema): scan context support set table schema #394
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
base: main
Are you sure you want to change the base?
Changes from all commits
82d21d0
cf6a47f
2a9e8a9
00ce0cf
ebde115
ec8328c
29b23fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,6 +153,7 @@ PrefetchFileBatchReaderImpl::~PrefetchFileBatchReaderImpl() { | |
| Status PrefetchFileBatchReaderImpl::SetReadSchema( | ||
| ::ArrowSchema* read_schema, const std::shared_ptr<Predicate>& predicate, | ||
| const std::optional<RoaringBitmap32>& selection_bitmap) { | ||
| PAIMON_RETURN_NOT_OK(CleanUp()); | ||
| PAIMON_ASSIGN_OR_RAISE_FROM_ARROW(std::shared_ptr<arrow::Schema> schema, | ||
| arrow::ImportSchema(read_schema)); | ||
| for (const auto& reader : readers_) { | ||
|
|
@@ -162,11 +163,15 @@ Status PrefetchFileBatchReaderImpl::SetReadSchema( | |
| } | ||
| selection_bitmap_ = selection_bitmap; | ||
| predicate_ = predicate; | ||
| return RefreshReadRanges(); | ||
| return RefreshReadRangesAfterCleanUp(); | ||
| } | ||
|
|
||
| Status PrefetchFileBatchReaderImpl::RefreshReadRanges() { | ||
| PAIMON_RETURN_NOT_OK(CleanUp()); | ||
| return RefreshReadRangesAfterCleanUp(); | ||
| } | ||
|
|
||
| Status PrefetchFileBatchReaderImpl::RefreshReadRangesAfterCleanUp() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why split out the RefreshReadRangesAfterCleanUp() function?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I split out RefreshReadRangesAfterCleanUp() because SetReadSchema() needs a different ordering now: CleanUp(); The original RefreshReadRanges() always calls CleanUp() internally. If SetReadSchema() called it directly after stopping the prefetch thread, we would either reset schemas before cleanup, which caused the ORC crash, or call CleanUp() twice. So the split keeps the behavior clear: RefreshReadRanges() SetReadSchema() This lets us reuse the range-refresh logic while guaranteeing that schema reset happens only after the background prefetch thread has fully stopped. |
||
| bool need_prefetch; | ||
| PAIMON_ASSIGN_OR_RAISE(auto read_ranges, readers_[0]->GenReadRanges(&need_prefetch)); | ||
|
|
||
|
|
@@ -279,6 +284,7 @@ Status PrefetchFileBatchReaderImpl::CleanUp() { | |
| read_ranges_.clear(); | ||
| read_ranges_in_group_.clear(); | ||
| current_batch_global_row_ids_.clear(); | ||
| read_ranges_freshed_ = false; | ||
| clean_prefetch_queue(); | ||
| for (size_t i = 0; i < readers_pos_.size(); i++) { | ||
| readers_pos_[i]->store(0); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.