Skip to content

chore: revert generate unique partitions added in #508 #510

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

Merged

Conversation

lazebnyi
Copy link
Contributor

@lazebnyi lazebnyi commented Apr 26, 2025

This revert changes added in #508

PR #508 attempted to address an issue where some parent streams could return duplicate record IDs, resulting in multiple identical partitions. Once one partition was processed and closed, subsequent attempts to process a duplicate partition would cause errors.

Summary by CodeRabbit

  • Refactor
    • Updated partition generation to include all stream slices, removing previous duplicate filtering logic.

@github-actions github-actions bot added the chore label Apr 26, 2025
@lazebnyi lazebnyi requested a review from maxi297 April 26, 2025 15:49
Copy link
Contributor

coderabbitai bot commented Apr 26, 2025

📝 Walkthrough

Walkthrough

The changes remove the logic that filtered out duplicate stream slices in the StreamSlicerPartitionGenerator class. The _make_hashable static method and the seen_slices set, previously used to identify and skip duplicate partitions, have been deleted. Now, the generate method yields all partitions from the underlying stream_slicer without deduplication. The import of Hashable from typing was also removed as it is no longer used.

Changes

File(s) Change Summary
airbyte_cdk/sources/declarative/stream_slicers/declarative_partition_generator.py Removed duplicate filtering logic in StreamSlicerPartitionGenerator.generate; deleted _make_hashable method and unused Hashable import.

Possibly related PRs

  • airbytehq/airbyte-python-cdk#508: This PR originally introduced the duplicate filtering logic and the _make_hashable method, which are now being removed in the current changes.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d665ca0 and 3f4fe05.

📒 Files selected for processing (1)
  • airbyte_cdk/sources/declarative/stream_slicers/declarative_partition_generator.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Analyze (python)
🔇 Additional comments (2)
airbyte_cdk/sources/declarative/stream_slicers/declarative_partition_generator.py (2)

3-3: Import of Hashable removed - is this intentional?

I notice the import of Hashable from typing was removed. This seems to be related to the removal of duplicate slice filtering logic mentioned in the PR objectives. Just confirming this is an intentional part of reverting PR #508, wdyt?


91-93:

✅ Verification successful

Reversion of duplicate slice filtering - potential implications?

The generate method has been simplified to yield all partitions without filtering duplicates. According to the PR objectives, this reverts PR #508 which fixed an issue where duplicate partitions caused errors in processing.

Have you considered the following potential implications:

  1. The original issue with duplicate record IDs might resurface
  2. Errors when processing duplicate partitions might occur again
  3. There may be unnecessary computational overhead from processing the same partition multiple times

Is there an alternative approach being considered to address the original issue, or is there a reason why the previous fix is no longer needed? wdyt?


🏁 Script executed:

#!/bin/bash
# Search for references to error handling related to duplicate partitions
echo "Searching for error handling related to duplicate partitions..."
rg -A 5 -B 5 "duplicate|already processed|partition.*error" --type py

Length of output: 67456


I don't see any explicit duplicate‐filtering logic around DeclarativePartitionGenerator.generate() and no new tests expecting duplicates to be removed at that layer—most deduplication happens earlier (e.g. in the slicers themselves or in downstream processors). It looks like reverting the inline dedupe in generate() is safe as long as upstream slicers don’t emit identical slices.

Do you think we should instead ensure slicers themselves never return duplicate slices (and add a test for that), or would you prefer to reintroduce a simple dedupe step here (e.g. track seen slice keys in generate()) to be extra safe? wdyt?

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@maxi297 maxi297 left a comment

Choose a reason for hiding this comment

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

:shipit:

@lazebnyi lazebnyi merged commit 2fd2492 into main Apr 26, 2025
26 of 28 checks passed
@lazebnyi lazebnyi deleted the lazebnyi/revert-generate-partiitons-only-for-unique-slices branch April 26, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants