Skip to content

Adding kafka offset support for period and timestamp#9193

Merged
Jackie-Jiang merged 1 commit intoapache:masterfrom
ravishankar15:kafka-offset
Aug 17, 2022
Merged

Adding kafka offset support for period and timestamp#9193
Jackie-Jiang merged 1 commit intoapache:masterfrom
ravishankar15:kafka-offset

Conversation

@ravishankar15
Copy link
Contributor

Fix #7250

@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2022

Codecov Report

Merging #9193 (4afafc9) into master (a4e3adb) will decrease coverage by 45.21%.
The diff coverage is 3.57%.

❗ Current head 4afafc9 differs from pull request most recent head 79535ee. Consider uploading reports for the commit 79535ee to get more accurate results

@@              Coverage Diff              @@
##             master    #9193       +/-   ##
=============================================
- Coverage     69.98%   24.76%   -45.22%     
+ Complexity     5007       53     -4954     
=============================================
  Files          1854     1843       -11     
  Lines         98871    98572      -299     
  Branches      15043    15015       -28     
=============================================
- Hits          69191    24415    -44776     
- Misses        24799    71725    +46926     
+ Partials       4881     2432     -2449     
Flag Coverage Δ
integration1 ?
integration2 24.76% <3.57%> (-0.06%) ⬇️
unittests1 ?
unittests2 ?

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

Impacted Files Coverage Δ
...ry/rules/PinotLogicalSortFetchEliminationRule.java 0.00% <0.00%> (ø)
...g/apache/pinot/query/rules/PinotQueryRuleSets.java 0.00% <ø> (-100.00%) ⬇️
...va/org/apache/pinot/spi/stream/OffsetCriteria.java 0.00% <0.00%> (-90.00%) ⬇️
...ain/java/org/apache/pinot/spi/utils/TimeUtils.java 0.00% <0.00%> (-97.44%) ⬇️
...in/stream/kafka20/KafkaStreamMetadataProvider.java 40.00% <5.55%> (-31.43%) ⬇️
...ava/org/apache/pinot/core/plan/FilterPlanNode.java 56.39% <50.00%> (-26.06%) ⬇️
...in/java/org/apache/pinot/spi/utils/BytesUtils.java 0.00% <0.00%> (-100.00%) ⬇️
.../java/org/apache/pinot/spi/utils/BooleanUtils.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/spi/trace/BaseRecording.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pinot/spi/trace/NoOpRecording.java 0.00% <0.00%> (-100.00%) ⬇️
... and 1359 more

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

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

Mostly good!

Copy link
Contributor

Choose a reason for hiding this comment

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

Modify the exception message

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems we want to go back a certain period from the passed in time. IMO this method is a little bit confusing, so suggest removing it and make the caller use convertPeriodToMillis() instead

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest not adding this extra check. Negative period should also be valid

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static Long convertDateTimeToMillis(String timeStr) {
public static Long convertTimestampToMillis(String timeStr) {

@ravishankar15 ravishankar15 force-pushed the kafka-offset branch 2 times, most recently from 6d54cb0 to 680b8f7 Compare August 16, 2022 16:16
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: in both cases, log a warn if offsetAndTimestamp == null?

Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

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

LGTM otherwise

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we already check if the period is valid, we should just remove the try-catch

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest also logging the topic partition and offset string to provide more info for debugging

Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@ravishankar15 ravishankar15 force-pushed the kafka-offset branch 2 times, most recently from 22a4392 to 20e0d74 Compare August 17, 2022 11:03
Add date format to comment

Fixing the review comments

Add warn logs for better observability

Remove the try catch and enhance the log statement

Fix checkstyle
@Jackie-Jiang Jackie-Jiang merged commit c1bdd10 into apache:master Aug 17, 2022
@Jackie-Jiang Jackie-Jiang added feature release-notes Referenced by PRs that need attention when compiling the next release notes labels Aug 17, 2022
@Jackie-Jiang
Copy link
Contributor

@ravishankar15 Thanks for contributing the feature! Can you help also update the Pinot documentation to include the new config options? The documentation is backed by this repo: https://github.com/pinot-contrib/pinot-docs

@npawar
Copy link
Contributor

npawar commented Aug 27, 2022

@ravishankar15
Copy link
Contributor Author

Fix #7250

@ravishankar15 would you please update the docs? Right now it reads incorrect: https://docs.pinot.apache.org/basics/data-import/pinot-stream-ingestion/import-from-apache-kafka#creating-a-table-configuration

Here as well: https://docs.pinot.apache.org/configuration-reference/table#indexing-config

Thanks in advance!

@npawar I think the master changes in the doc is not reflecting in the official documentation I have made the doc changes to the master Ref: pinot-contrib/pinot-docs#115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature release-notes Referenced by PRs that need attention when compiling the next release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure Kafka consumption from a specific timestamp

4 participants