-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fix COPY; rework Reader op #1963
+915
−821
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/processor/operator/copy_from/copy_rel.h → .../processor/operator/persistent/copy_rel.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#pragma once | ||
|
||
#include "processor/operator/physical_operator.h" | ||
#include "storage/copier/reader_state.h" | ||
|
||
namespace kuzu { | ||
namespace processor { | ||
|
||
struct ReaderInfo { | ||
DataPos nodeOffsetPos; | ||
std::vector<DataPos> dataColumnPoses; | ||
bool isOrderPreserving; | ||
storage::read_rows_func_t readFunc; | ||
storage::init_reader_data_func_t initFunc; | ||
}; | ||
|
||
class Reader : public PhysicalOperator { | ||
public: | ||
Reader(ReaderInfo readerInfo, std::shared_ptr<storage::ReaderSharedState> sharedState, | ||
uint32_t id, const std::string& paramsString) | ||
: PhysicalOperator{PhysicalOperatorType::READER, id, paramsString}, readerInfo{std::move( | ||
readerInfo)}, | ||
sharedState{std::move(sharedState)}, leftNumRows{0}, readFuncData{nullptr} {} | ||
|
||
inline void initGlobalStateInternal(ExecutionContext* context) final { | ||
sharedState->validate(); | ||
sharedState->countBlocks(); | ||
} | ||
inline bool isSource() const final { return true; } | ||
|
||
inline std::unique_ptr<PhysicalOperator> clone() final { | ||
return make_unique<Reader>(readerInfo, sharedState, getOperatorID(), paramsString); | ||
} | ||
|
||
protected: | ||
bool getNextTuplesInternal(ExecutionContext* context) final; | ||
|
||
private: | ||
void getNextNodeGroupInSerial(std::shared_ptr<arrow::Table>& table); | ||
void getNextNodeGroupInParallel(std::shared_ptr<arrow::Table>& table); | ||
|
||
private: | ||
ReaderInfo readerInfo; | ||
std::shared_ptr<storage::ReaderSharedState> sharedState; | ||
std::vector<std::shared_ptr<arrow::RecordBatch>> leftRecordBatches; | ||
common::row_idx_t leftNumRows; | ||
|
||
// For parallel reading. | ||
std::unique_ptr<storage::ReaderFunctionData> readFuncData; | ||
}; | ||
|
||
} // namespace processor | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we always put constructor and deconstructor below the fields for structs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm ok. Will make the change.
Was this style coming from some standard? I wasn't aware of that. why do we have to make struct so different from class?