Skip to content

Conversation

@rdblue
Copy link
Contributor

@rdblue rdblue commented Jul 29, 2022

This makes some minor changes to the expression hierarchy, mostly making the classes only implement what they need to. For example, Bound and Unbound don't need to carry a bound type. A Term has an associated generic type instead. This also:

  • Refactors And, Or, and Not to be data classes
  • Adds a default for case_sensitive everywhere

Copy link
Contributor

@dramaticlly dramaticlly left a comment

Choose a reason for hiding this comment

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

LGTM!

(base.Not(ExpressionA()), "Not(testexpra)"),
(base.And(ExpressionA(), ExpressionB()), "And(left=ExpressionA(), right=ExpressionB())"),
(base.Or(ExpressionA(), ExpressionB()), "Or(left=ExpressionA(), right=ExpressionB())"),
(base.Not(ExpressionA()), "Not(child=ExpressionA())"),
Copy link
Contributor

@dramaticlly dramaticlly Jul 29, 2022

Choose a reason for hiding this comment

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

nit: since updating this file, maybe worth try simply LINE 220 to 245 as Sam suggested in https://github.com/apache/iceberg/pull/5362/files#r932825540

def test_ref_binding_case_sensitive(request):
    schema = request.getfixturevalue("table_schema_simple")

can be replaced by python

def test_ref_binding_case_sensitive(table_schema_simple):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't make that change because I think it is easier to understand what's happening when we use less magic. Using getfixturevalue makes it clear that this is getting a fixture called "table_schema_simple". Otherwise where that comes from is magic and confusing (at least to me).

return self


class UnboundTerm(Term[T], Unbound[BoundTerm[T]], ABC):
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit / non-blocking: An Unbound[BoundTerm[T]] is somewhat of a confusing type signature (particularly coming more from the Java side).

However UnboundTerm itself is clear as day so that's not particularly a concern.

Copy link
Contributor

@kbendick kbendick left a comment

Choose a reason for hiding this comment

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

The inclusion of Term makes a lot of sense to me (coming from more experience on the Java side). Overall this LGTM and is a welcomed update. 🙂

@danielcweeks danielcweeks merged commit 5f2ce6e into apache:master Aug 1, 2022
abmo-x pushed a commit to abmo-x/iceberg that referenced this pull request Aug 2, 2022
* Convert And, Or, and Not to dataclasses.

* Refactor base expression types.
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.

5 participants