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

Add expressions for Map/Struct types and columns #1166

Closed
wants to merge 6 commits into from

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented Oct 12, 2017

No description provided.

@cpcloud cpcloud self-assigned this Oct 12, 2017
@cpcloud cpcloud requested a review from wesm October 12, 2017 22:51
@cpcloud cpcloud added feature Features or general enhancements expressions Issues or PRs related to the expression API labels Oct 12, 2017
@cpcloud cpcloud added this to the 0.11.3 milestone Oct 12, 2017
Copy link
Member

@wesm wesm left a comment

Choose a reason for hiding this comment

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

Looked through this pretty carefully, looks good to me. Will be cool to see this working on engines that support it

(list('abc'), 'array<string>', ir.ArrayScalar),
([1, 2, 3], 'array<int8>', ir.ArrayScalar),
({'a': 1, 'b': 2, 'c': 3}, 'map<string, int8>', ir.MapScalar),
({1: 2, 3: 4, 5: 6}, 'map<int8, int8>', ir.MapScalar),
Copy link
Member

Choose a reason for hiding this comment

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

Aside: I wonder how much we benefit / are hurt overall from aggressively choosing the smallest type integer that will fit the literal values vs. using int32 (unless some values are larger than INT32_MAX)

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting, I tried to compute (2 ** 20) ** 200000 and got an overflow error. I think we should not try to infer the smallest integer type containing the result of an integer operation since it could take an unreasonably long amount of time to raise OverflowError.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, the question is what is the benefit or cost (if any) of literal([1, 2, 3]) returning an array<int8> vs. array<int32>

def factory(arg, name=None):
return ArrayScalar(arg, self.type(), name=name)
return factory

Copy link
Member

Choose a reason for hiding this comment

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

Nice code removal here and above!

@cpcloud
Copy link
Member Author

cpcloud commented Oct 16, 2017

Merging on green.

@cpcloud cpcloud closed this in b01c533 Oct 16, 2017
@cpcloud cpcloud deleted the complex-type-columns branch October 16, 2017 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expressions Issues or PRs related to the expression API feature Features or general enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants