Skip to content
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

refactor(sql): automatically add simple ops implementations #8349

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented Feb 14, 2024

Follow up to #8338 to clean up the SIMPLE_OPS boilerplate.

@cpcloud cpcloud added this to the 9.0 milestone Feb 14, 2024
@cpcloud cpcloud added refactor Issues or PRs related to refactoring the codebase sql Backends that generate SQL labels Feb 14, 2024
@cpcloud cpcloud requested a review from kszucs February 14, 2024 13:00
@cpcloud
Copy link
Member Author

cpcloud commented Feb 14, 2024

Looks like I'm on the road to breaking ... everything!

@cpcloud cpcloud force-pushed the cleanup-simple-ops branch 4 times, most recently from 394450d to bee593f Compare February 14, 2024 13:31
ops.IntervalMultiply: sge.Mul,
ops.IntervalSubtract: sge.Sub,
}

def __init__(self) -> None:
self.agg = AggGen(aggfunc=self._aggregate)
self.f = FuncGen()
self.v = VarGen()

def __init_subclass__(cls, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

So the only reason we need to construct and attach methods here is because of has_operation looks for the method? Couldn't we move this logic into a handler which would compile all value nodes if those are not explicitly overwritten?

Copy link
Member

Choose a reason for hiding this comment

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

like

def visit(...):
    method_name = ...
    if self.hasattr(method_name):
        call that specific method
    else:
        self.visit_Value()  # which would handle simple ops

then has_operation would condier the cls.SIMPLE_OPS mapping

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe, but I don't want to spend time making this improvement perfect here. If you have an idea for a further improvement, that can be done in a follow up.

@cpcloud cpcloud added ci-run-cloud Add this label to trigger a run of Bigquery and Snowflake in CI docs-preview Add this label to trigger a docs preview labels Feb 14, 2024
@ibis-docs-bot ibis-docs-bot bot removed docs-preview Add this label to trigger a docs preview ci-run-cloud Add this label to trigger a run of Bigquery and Snowflake in CI labels Feb 14, 2024
@cpcloud cpcloud added the docs-preview Add this label to trigger a docs preview label Feb 14, 2024
@ibis-docs-bot ibis-docs-bot bot removed the docs-preview Add this label to trigger a docs preview label Feb 14, 2024
@cpcloud
Copy link
Member Author

cpcloud commented Feb 14, 2024

Doesn't seem like my CI fixes for label running helped 😞

@ibis-docs-bot
Copy link

ibis-docs-bot bot commented Feb 14, 2024

@cpcloud cpcloud added the ci-run-cloud Add this label to trigger a run of Bigquery and Snowflake in CI label Feb 14, 2024
@ibis-docs-bot ibis-docs-bot bot removed the ci-run-cloud Add this label to trigger a run of Bigquery and Snowflake in CI label Feb 14, 2024
@kszucs kszucs merged commit 2c64b3f into ibis-project:main Feb 14, 2024
87 of 88 checks passed
ncclementi pushed a commit to ncclementi/ibis that referenced this pull request Feb 21, 2024
@cpcloud cpcloud deleted the cleanup-simple-ops branch May 10, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Issues or PRs related to refactoring the codebase sql Backends that generate SQL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants