-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-36924: [Java] support offset/length and filter in scan option #36967
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
Changes from all commits
347ad39
c414990
d998fa7
fdd1457
bbc83b2
c8f68b9
94366a7
1500a18
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 |
|---|---|---|
|
|
@@ -607,6 +607,29 @@ TEST_P(TestParquetFileFormatScan, PredicatePushdown) { | |
| kNumRowGroups - 5); | ||
| } | ||
|
|
||
| TEST_P(TestParquetFileFormatScan, RangeScan) { | ||
| constexpr int64_t kNumRowGroups = 16; | ||
| constexpr int64_t kTotalNumRows = kNumRowGroups * (kNumRowGroups + 1) / 2; | ||
|
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. any specific reason for this exact number?
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. following existing tests
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. Noted. |
||
|
|
||
| auto reader = ArithmeticDatasetFixture::GetRecordBatchReader(kNumRowGroups); | ||
| auto source = GetFileSource(reader.get()); | ||
|
|
||
| SetSchema(reader->schema()->fields()); | ||
| ASSERT_OK_AND_ASSIGN(auto fragment, format_->MakeFragment(*source)); | ||
|
|
||
| SetFilter(literal(true)); | ||
| SetRange(0, std::numeric_limits<int64_t>::max()); | ||
| CountRowsAndBatchesInScan(fragment, kTotalNumRows, kNumRowGroups); | ||
|
|
||
| SetFilter(literal(true)); | ||
| SetRange(0, 0); | ||
| CountRowsAndBatchesInScan(fragment, 0, 0); | ||
|
|
||
| SetFilter(literal(true)); | ||
| SetRange(0, 2048); | ||
| CountRowsAndBatchesInScan(fragment, 6, 3); | ||
| } | ||
|
|
||
| TEST_P(TestParquetFileFormatScan, PredicatePushdownRowGroupFragments) { | ||
| constexpr int64_t kNumRowGroups = 16; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,7 @@ constexpr int64_t kDefaultBatchSize = 1 << 17; // 128Ki rows | |
| constexpr int32_t kDefaultBatchReadahead = 16; | ||
| constexpr int32_t kDefaultFragmentReadahead = 4; | ||
| constexpr int32_t kDefaultBytesReadahead = 1 << 25; // 32MiB | ||
| constexpr int64_t kDefaultStartOffset = -1; | ||
zinking marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /// Scan-specific options, which can be changed between scans of the same dataset. | ||
| struct ARROW_DS_EXPORT ScanOptions { | ||
|
|
@@ -136,6 +137,14 @@ struct ARROW_DS_EXPORT ScanOptions { | |
| /// Parameters which control when the plan should pause for a slow consumer | ||
| acero::BackpressureOptions backpressure = | ||
| acero::BackpressureOptions::DefaultBackpressure(); | ||
|
|
||
| /// Parameters which control where the scan starts. | ||
| /// This is used in reading a big file by splitting into multiple scanners. | ||
| int64_t start_offset = kDefaultStartOffset; | ||
|
|
||
| /// Parameters which control how long the scanner should read. | ||
| /// This is used in reading a big file by splitting into multiple scanners. | ||
| int64_t length; | ||
| }; | ||
|
|
||
| /// Scan-specific options, which can be changed between scans of the same dataset. | ||
|
|
@@ -496,6 +505,18 @@ class ARROW_DS_EXPORT ScannerBuilder { | |
| /// Schema. | ||
| Status Filter(const compute::Expression& filter); | ||
|
|
||
| /// \brief set the start offset of the scanner | ||
| /// \param[in] start_offset start offset for the scan | ||
| /// | ||
| /// \return Failure if the start_offset is not greater than 0 | ||
| Status StartOffset(int64_t start_offset); | ||
|
Member
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. For changes in the dataset api, I'd request @westonpace to take a look. |
||
|
|
||
| /// \brief set the length of the scanner | ||
| /// \param[in] length length for the scan | ||
| /// | ||
| /// \return Failure if the length is not greater than 0 | ||
| Status Length(int64_t length); | ||
|
|
||
| /// \brief Indicate if the Scanner should make use of the available | ||
| /// ThreadPool found in ScanOptions; | ||
| Status UseThreads(bool use_threads = true); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.