Skip to content

Conversation

@ostronaut
Copy link
Contributor

@ostronaut ostronaut commented Dec 12, 2024

What changes were proposed in this pull request?

This was missed when the default value of configuration is changed via the following.

KafkaMicroBatchSourceSuite consists of set of different suites, where KafkaMicroBatchSourceSuiteBase based suite is defined. There are 4 implementations of this abstract class for now:

  1. KafkaMicroBatchV1SourceSuite - V1 source that supposes to use KafkaOffsetReaderConsumer as KafkaOffsetReader.
  2. KafkaMicroBatchV2SourceSuite - V2 source that supposes to use KafkaOffsetReaderConsumer as KafkaOffsetReader.
  3. KafkaMicroBatchV1SourceWithAdminSuite - V1 source that uses KafkaOffsetReaderAdmin as KafkaOffsetReader.
  4. KafkaMicroBatchV2SourceWithAdminSuite - V2 source that uses KafkaOffsetReaderAdmin as KafkaOffsetReader.
    But KafkaMicroBatchV1SourceSuite and KafkaMicroBatchV2SourceSuite are still running based on KafkaOffsetReaderAdmin, as USE_DEPRECATED_KAFKA_OFFSET_FETCHING is false be default. By switching it to true in beforeAll, we make sure that corresponding KafkaOffsetReader is in use.

Why are the changes needed?

To improve unit tests coverage for KafkaOffsetReaderConsumer

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Unit Tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@dongjoon-hyun dongjoon-hyun changed the title [CONNECTOR] Fix KafkaMicroBatchSourceSuite to cover KafkaOffsetReaderConsumer with unit tests [SS][TESTS] Fix KafkaMicroBatchSourceSuite to cover KafkaOffsetReaderConsumer with unit tests Dec 13, 2024
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

Thank you for making a PR, @ostronaut . Could you file a JIRA issue and use it in the PR title with a prefix pattern, [SPARK-XXX]?

@HeartSaVioR
Copy link
Contributor

Nice finding! Shall we do this a bit differently? Let's leave the base test class as it is (using default), and rename the derived test class to refer to Consumer and set the flag explicitly. I'm even OK to have a base test class as abstract, and have two derived test classes having config set for each. Maybe this is much clearer?

@dongjoon-hyun
Copy link
Member

Copy link
Member

@viirya viirya left a comment

Choose a reason for hiding this comment

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

Good catch!

@gaborgsomogyi
Copy link
Contributor

Thanks for catching it! After adapting the suggestions from @HeartSaVioR it will be good to go.

@ostronaut ostronaut changed the title [SS][TESTS] Fix KafkaMicroBatchSourceSuite to cover KafkaOffsetReaderConsumer with unit tests [SPARK-50568][SS][TESTS] Fix KafkaMicroBatchSourceSuite to cover KafkaOffsetReaderConsumer with unit tests Dec 13, 2024
@ostronaut
Copy link
Contributor Author

Thank you @HeartSaVioR for the review! I've refactored KafkaMicroBatchV1SourceSuite and KafkaMicroBatchV2SourceSuite to be abstract classes. All further implementations are inherit unit tests from those and only change config.

@ostronaut
Copy link
Contributor Author

Hi @dongjoon-hyun. Good point, SPARK-50568 here it is!

@ostronaut ostronaut force-pushed the hotifx/KafkaMicroBatchSourceSuite-cover-KafkaOffsetReaderConsumer branch from affd2bf to 8086241 Compare December 13, 2024 15:52
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-50568][SS][TESTS] Fix KafkaMicroBatchSourceSuite to cover KafkaOffsetReaderConsumer with unit tests [SPARK-50568][SS][TESTS] Fix KafkaMicroBatchSourceSuite to cover KafkaOffsetReaderConsumer Dec 13, 2024
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM.

Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

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

+1

@HeartSaVioR
Copy link
Contributor

Thanks! Merging to master.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants