Skip to content

Conversation

@ZENOTME
Copy link
Contributor

@ZENOTME ZENOTME commented Dec 29, 2022

I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.

What's changed and what's your intention?

fix:

  • process start offset correctly
  • check empty range correctly

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

If your pull request contains user-facing changes, please specify the types of the changes, and create a release note. Otherwise, please feel free to remove this section.

Types of user-facing changes

Please keep the types that apply to your changes, and remove those that do not apply.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

Please create a release note for your changes. In the release note, focus on the impact on users, and mention the environment or conditions where the impact may occur.

Refer to a related PR or issue link (optional)

@github-actions github-actions bot added the type/fix Type: Bug fix. Only for pull requests. label Dec 29, 2022
Comment on lines +127 to +133
if let Some(start_offset) = self.start_offset && start_offset == stop_offset {
yield Vec::new();
return Ok(());
} else if stop_offset == 0 {
yield Vec::new();
return Ok(());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it returns nothing. Consider refusing to create a reader in such case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we refuse to create a reader and return a error, there are two option:

  1. We directly report error if the range return nothing. This behavior seems weird because we will not report error if a table is empty.
  2. We compare the error and transfer it from bottom to top. Because SplitReaderImpl::create return as a AnyError, we compare the error by comparing string, I'm not sure whether is a good way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We directly report error if the range return nothing.

I vote for this solution. Table is an internal concept, which is easy to handle but querying from kafka has more overhead than from table. If we know the result is empty deterministically, why do we waste resources on it?
@liurenjie1024 @fuyufjh what do you think?

Copy link
Contributor Author

@ZENOTME ZENOTME Dec 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will create batch source executor each split which means that we can't create source executor if all split is empty and they both be filtered. So for now we directly return error in this case.
This behavior maybe cause the problem: If we left join a table and a empty source, e.g.select * from table left join empty_source ,directly return error will cause error return. But this scenario is rare I think...

If we want the user to see the empty result instead of a error, maybe we can:

  • create a empty batch vlaue executor

@liurenjie1024 @fuyufjh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should return error here and it feels like abusing of error reporting to me since empty result is common in query. I think just return empty vec is good enough.

@codecov
Copy link

codecov bot commented Dec 29, 2022

Codecov Report

Merging #7112 (1954dc4) into main (7de49c0) will decrease coverage by 0.00%.
The diff coverage is 18.18%.

❗ Current head 1954dc4 differs from pull request most recent head aac5f1b. Consider uploading reports for the commit aac5f1b to get more accurate results

@@            Coverage Diff             @@
##             main    #7112      +/-   ##
==========================================
- Coverage   73.15%   73.15%   -0.01%     
==========================================
  Files        1052     1052              
  Lines      167399   167424      +25     
==========================================
+ Hits       122467   122477      +10     
- Misses      44932    44947      +15     
Flag Coverage Δ
rust 73.15% <18.18%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/common/src/error.rs 70.55% <ø> (ø)
src/connector/src/error.rs 0.00% <ø> (ø)
...rc/connector/src/source/kafka/enumerator/client.rs 0.00% <0.00%> (ø)
src/connector/src/source/kafka/source/reader.rs 0.00% <0.00%> (ø)
src/source/src/connector_source.rs 69.11% <42.85%> (-1.34%) ⬇️
src/meta/src/hummock/mock_hummock_meta_client.rs 64.21% <0.00%> (-1.06%) ⬇️
src/common/src/types/ordered_float.rs 31.05% <0.00%> (-0.20%) ⬇️
src/storage/src/hummock/compactor/mod.rs 83.10% <0.00%> (-0.16%) ⬇️
src/meta/src/hummock/manager/mod.rs 79.37% <0.00%> (-0.12%) ⬇️
src/common/src/cache.rs 97.54% <0.00%> (+0.22%) ⬆️
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ZENOTME ZENOTME force-pushed the zj/fix_reader branch 3 times, most recently from 930428c to aac5f1b Compare December 30, 2022 07:00
@ZENOTME ZENOTME closed this Dec 30, 2022
@ZENOTME
Copy link
Contributor Author

ZENOTME commented Dec 30, 2022

This PR is included in #7150

@ZENOTME ZENOTME deleted the zj/fix_reader branch January 4, 2023 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/fix Type: Bug fix. Only for pull requests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants