-
Notifications
You must be signed in to change notification settings - Fork 91
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
Use RexExecutor to evaluate projections and filters #198
Conversation
I like the general idea of what you are doing. It might help someone write an interpreter (i.e. implementations of A further step could be to create an interpreter for a Regarding Is it really what you want, to store data values in That said, I'm OK with the idea of adding numbered slots into Thanks for submitting an early draft for feedback. It's generally useful feature, and I think we can get this into a shape where I'd accept it. |
Hi Julian, I stumbled across the For the Please give me a few days to rework the |
I now think you're right to use RexInputRef. If you're implementing ProjectRel and FilterRel, then you'll want to access "fields of the incoming record", and that is precisely what RexInputRef is for. I don't think you should add Also, this isn't such a big deal, but I think we can avoid making changes to DataContext. Rather than storing all of the input fields in separately, we can store the array, and the array only needs to be accessed once. In your code: RelDataType inputRowType;
DataContext dataContext;
Object[] slots = new Object[inputRowType.getFieldCount()];
dataContext.set("inputRecord", slots); Inside generated code: final DataContext root;
Integer x = (Integer) ((Object[]) root.get("inputRecord"))[0];
Integer y = (Integer) ((Object[]) root.get("inputRecord"))[1];
Integer result = x + y; and later we can optimize by generating final Object[] slots = (Object[]) root.get("inputRecord"); |
Hi Julian, thank you very much for your guidance! I would prefer to do the optimizations you've suggested at a later point since I'm still in a "prototyping" phase for my implementation and I want to focus on other parts of the implementation. |
Looks good -- I have committed to master. Glad to see that using Let me know whether you approve of my "tidying up" in the following commit. In particular removing RexExecutor.rexBuilder. |
By the way, best of luck with the Stratosphere incubation! |
Thanks for merging my pull request. Your cleanup is fine. And yeah, the incubation is very exciting. |
Hi,
I was asking on the mailing list if there is a way to use the existing code-generation infrastructure to evaluate projections and filters: https://groups.google.com/forum/#!topic/optiq-dev/-97ONPmDTB4.
This pull request contains my first approach to change the Rex* components to allow that.
My change includes the following:
RexExecutable
class that allows toreduce()
andexecute()
(given a DataContext)DataContext
interface to allow direct access (using an int-index) to the data (instead of using a HashMap)isExternal
-flag on theRexInputRef
which indicates that the Ref refers to a variable accessible from the DataContext.I'm very happy about any feedback regarding my pull request. I know its certainly not the cleanest approach to implement this feature. But I didn't want to spend too much time working on it without any feedback. (Maybe adding something like a
RexContextRef
is cleaner? (I probably have to shuttle through replacing all InputRefs by RexContextRefs then))I know that the pull request is a bit messed up (4 commits and I accidentally changed some code formattings while working with (/fighting against) the checkstyle plugin. Once I got feedback, I'll clean those things up and update the PR (using force push).