You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Benson Margulies (JIRA)" <ji...@apache.org> on 2009/12/19 03:18:18 UTC
[jira] Created: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Velocity-based code generation support to support more primitive type collections
---------------------------------------------------------------------------------
Key: MAHOUT-226
URL: https://issues.apache.org/jira/browse/MAHOUT-226
Project: Mahout
Issue Type: Task
Components: Matrix
Affects Versions: 0.4
Reporter: Benson Margulies
Attachments: codegen.patch
We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Drew Farris (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792851#action_12792851 ]
Drew Farris commented on MAHOUT-226:
------------------------------------
bq. Oh, heck. I misread you to have actually checked it in, and I didn't answer all your questions.
Yes, I'm not a committer, I just review things when I can -- I'll keep an eye out, I'm stuck in a hotel trying to get a flight out this morning.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Drew Farris (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792847#action_12792847 ]
Drew Farris commented on MAHOUT-226:
------------------------------------
Patch applied cleanly.
When building, mvn complained that the source level on the compiler was not set properly for the collections-codegen-plugin project, but adding a maven-complier-plugin configuration stanza to the pom resolved this problem. The parent pom (maven/pom.xml) should be fixed to add this so that the children are not required to, but I suspect that should be handled as a separate issue, so perhaps for now it could be added to the collections-codegen-plugin pom?
Must the template and generated classes retain the cern copyright message?
Would we want to generate things {type}Object{class} and Object{type}{class} (e.g: LongObjectProcedure or ObjectIntProcedure) using this approach as well?
I really like the plugin approach. I wonder if we should name it something more generic so that it would be a natural location other mahout-specific maven goals could be realized in that submodule, e.g: mahout-maven-plugin with a goal of mahout:generate-collections-sources, for example to build the mahout .job file - but perhaps that's worth a separate discussion for the dev list, so I would also say this is ok the way it is.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies updated MAHOUT-226:
------------------------------------
Attachment: (was: codegen.patch)
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792850#action_12792850 ]
Benson Margulies commented on MAHOUT-226:
-----------------------------------------
Oh, heck. I misread you to have actually checked it in, and I didn't answer all your questions.
According to Legal, it is best to be conservative in retaining CERN copyrights unless we get a grant from CERN. Since I created that template by very light editing of the original, it's a derived work, and the rule applies.
Yes, I will be generating the Object guys, but as that involves a larger transition to generics, I didn't go there yet.
I'll add another patch file for the compiler plugin.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792880#action_12792880 ]
Benson Margulies commented on MAHOUT-226:
-----------------------------------------
OK, time to turn up the persuasion device.
The goal here is to extend the code from Colt, not to leave it as-is and build next to it. If you really want to preserve the original colt code unscathed, you should ask me to go back and rework my first commit, since I added several new functions to the IntIntHashMap to provide functionality comparable to Trove.
Note that, ignoring my mistake of last evening, this patch any 'functions'. So far, its all interfaces. I don't really see any value in preserving an older copy of the very same interface (if examined at the .class level) under another package name.
The first really interesting commit in this project would, according to my idea, remove the checked-in AbstractIntIntMap and OpenIntIntHashMap and replace them with templates, and thus get the complete set.
That's why I started with unit tests for that stack of code, so that I could prove to everyone, including myself, that I don't bust the IntInt map when adding all the others via the template trick.
SInce I can't imagine any way to unit test an interface, let alone an interface consisting of a single function that takes two parameters and returns a boolean, I didn't write specific a specific unit test for IntIntProcedure. But there are uses of that interface and implementations of it in the unit tests I wrote for the int-int map. So, I think I could claim with some justification that there are now tests that would catch bad things on these items. Not so for the 'Function' thing that I mistakenly put in the initial patch, and which I have no intention of touching at all, ever, as part of the hash table extensions.
The pattern I'm proposing here is:
1) create adequate unit tests
2) enhance
3) rinse, lather, repeat
I'm claiming that I've got tests for the IntInt hash map, and so I can tackle it.
Next will come the Object-* case, which will need tests before I change anything, and then the *-Object case.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Drew Farris (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792857#action_12792857 ]
Drew Farris commented on MAHOUT-226:
------------------------------------
compileroptions.patch looks good too. When it is all said it done it is probably worth wrapping it up into a single final patch.
It appears you can use the @goal annotation to setup multiple goals per maven plugin project, but I haven't done it myself.
see: http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Ted Dunning (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792867#action_12792867 ]
Ted Dunning commented on MAHOUT-226:
------------------------------------
I would still like to see these in a special package. Right now, they sit in:
+package org.apache.mahout.math.function;
But there are already several colt-ish things in that directory.
My worry is that the code that uses these pre-existing functions is untested and thus we are likely to not notice when something gets bunged by the code generator over-writing them.
Would it be possible to use org.apache.mahout.math.generated?
Or to relocate all former residents of math.function to math.function.old before generating the code?
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies updated MAHOUT-226:
------------------------------------
Status: Patch Available (was: Open)
OK, here we are again with the generation output left in target, and initial foray into generation redirected to the IntIntProcedure and cousins instead of IntIntFunction.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792861#action_12792861 ]
Benson Margulies commented on MAHOUT-226:
-----------------------------------------
We'll see if some committer is willing to take it in two pieces. My tree is a little wonky and so I feel safer with the two patches as they are.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792849#action_12792849 ]
Benson Margulies commented on MAHOUT-226:
-----------------------------------------
Drew,
I'm going to make a patch to make some improvements to the parent POM, next.
At CXF, we have one Maven module per plugin, but we group them in a subdirectory. However, I think that it is supposedly possible to have multiple mojo classes in a project, so your proposal to rename this one might work. On the other hand, the goal of keeping 'math' relatively self-contained might argue for keeping this to itself, or even moving it and math to a subdirectory.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies updated MAHOUT-226:
------------------------------------
Attachment: codegen.patch
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792769#action_12792769 ]
Benson Margulies commented on MAHOUT-226:
-----------------------------------------
I see what went wrong. I meant to templatize IntIntProcedure, and hit IntIntFunction instead.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies updated MAHOUT-226:
------------------------------------
Attachment: compileroptions.patch
Standardize compiler plugin options. Use dependencyManagement for junit version.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Posted by "Sean Owen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sean Owen updated MAHOUT-226:
-----------------------------
Resolution: Fixed
Fix Version/s: 0.3
Assignee: Benson Margulies
Status: Resolved (was: Patch Available)
Committer, per Benson
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Assignee: Benson Margulies
> Fix For: 0.3
>
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792766#action_12792766 ]
Benson Margulies commented on MAHOUT-226:
-----------------------------------------
In this case, my intent is to replace existing trivial interfaces with generated trivial interfaces. However, what you are seeing is that I got it wrong in coding the template. Thanks for the catch.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies updated MAHOUT-226:
------------------------------------
Attachment: codegen.patch
Updated version that leaves generated sources under target/ and doesn't intend to check them in.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Sean Owen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792970#action_12792970 ]
Sean Owen commented on MAHOUT-226:
----------------------------------
FWIW I am also for extending or modifying Colt as appropriate. There is no particular need to preserve its original state.
We should have as a secondary goal keeping this Colt-derived module as general as makes sense for us, to maximize reusability on its own. But this change seems fine in that regard.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792987#action_12792987 ]
Benson Margulies commented on MAHOUT-226:
-----------------------------------------
Ted,
Here's an interesting thing. I do your your technique 'internally', but, at least this time around, the scaffolding was removed before I got to the point posting a patch.
--benson
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Ted Dunning (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792971#action_12792971 ]
Ted Dunning commented on MAHOUT-226:
------------------------------------
Benson,
I am completely down with you modifying rather than building beside Colt. I also understand the difficulty of testing interfaces.
What I was suggesting was possible ways to avoid silent errors. Putting generated code in one place and then removing references to the Colt code would be a path that would avoid some of the risk that I am seeing with the current approach.
But, hey, you are doing the work. That gives you the biggest vote.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793634#action_12793634 ]
Benson Margulies commented on MAHOUT-226:
-----------------------------------------
Thanks.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Assignee: Benson Margulies
> Fix For: 0.3
>
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies updated MAHOUT-226:
------------------------------------
Affects Version/s: (was: 0.4)
Status: Patch Available (was: Open)
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MAHOUT-226) Velocity-based code generation support
to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benson Margulies updated MAHOUT-226:
------------------------------------
Status: Open (was: Patch Available)
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (MAHOUT-226) Velocity-based code
generation support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792880#action_12792880 ]
Benson Margulies edited comment on MAHOUT-226 at 12/19/09 6:35 PM:
-------------------------------------------------------------------
OK, time to turn up the persuasion device.
The goal here is to extend the code from Colt, not to leave it as-is and build next to it. If you really want to preserve the original colt code unscathed, you should ask me to go back and rework my first commit, since I added several new functions to the IntIntHashMap to provide functionality comparable to Trove.
Note that, ignoring my mistake of last evening, this patch doesn't change any 'functions'. So far, it's all interfaces. I don't really see any value in preserving an older copy of the very same interface (as examined at the .class level) under another package name.
The first really interesting commit in this project would, according to my idea, remove the checked-in AbstractIntIntMap and OpenIntIntHashMap and replace them with templates, and thus get the complete set.
That's why I started with unit tests for that stack of code, so that I could prove to everyone, including myself, that I don't bust the IntInt map when adding all the others via the template trick.
SInce I can't imagine any way to unit test an interface, let alone an interface consisting of a single function that takes two parameters and returns a boolean, I didn't write specific a specific unit test for IntIntProcedure. But there are uses of that interface and implementations of it in the unit tests I wrote for the int-int map. So, I think I could claim with some justification that there are now tests that would catch bad things on these items. Not so for the 'Function' thing that I mistakenly put in the initial patch, and which I have no intention of touching at all, ever, as part of the hash table extensions.
The pattern I'm proposing here is:
1) create adequate unit tests
2) enhance
3) rinse, lather, repeat
I'm claiming that I've got tests for the IntInt hash map, and so I can tackle it.
Next will come the Object-* case, which will need tests before I change anything, and then the *-Object case.
was (Author: bmargulies):
OK, time to turn up the persuasion device.
The goal here is to extend the code from Colt, not to leave it as-is and build next to it. If you really want to preserve the original colt code unscathed, you should ask me to go back and rework my first commit, since I added several new functions to the IntIntHashMap to provide functionality comparable to Trove.
Note that, ignoring my mistake of last evening, this patch any 'functions'. So far, its all interfaces. I don't really see any value in preserving an older copy of the very same interface (if examined at the .class level) under another package name.
The first really interesting commit in this project would, according to my idea, remove the checked-in AbstractIntIntMap and OpenIntIntHashMap and replace them with templates, and thus get the complete set.
That's why I started with unit tests for that stack of code, so that I could prove to everyone, including myself, that I don't bust the IntInt map when adding all the others via the template trick.
SInce I can't imagine any way to unit test an interface, let alone an interface consisting of a single function that takes two parameters and returns a boolean, I didn't write specific a specific unit test for IntIntProcedure. But there are uses of that interface and implementations of it in the unit tests I wrote for the int-int map. So, I think I could claim with some justification that there are now tests that would catch bad things on these items. Not so for the 'Function' thing that I mistakenly put in the initial patch, and which I have no intention of touching at all, ever, as part of the hash table extensions.
The pattern I'm proposing here is:
1) create adequate unit tests
2) enhance
3) rinse, lather, repeat
I'm claiming that I've got tests for the IntInt hash map, and so I can tackle it.
Next will come the Object-* case, which will need tests before I change anything, and then the *-Object case.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MAHOUT-226) Velocity-based code generation
support to support more primitive type collections
Posted by "Ted Dunning (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792762#action_12792762 ]
Ted Dunning commented on MAHOUT-226:
------------------------------------
This bit looks a bit odd:
{noformat}
public interface IntDoubleFunction {
/**
* Applies a function to two arguments.
*
- * @param first first argument passed to the function.
- * @param second second argument passed to the function.
+ * @param x the first argument passed to the function.
+ * @param y the second argument passed to the function.
* @return the result of the function.
*/
- double apply(int first, double second);
+ int apply(int x, double y);
}
{noformat}
Looks like the new code conflicts with some previous code.
Shouldn't the generated code all be in a separate package.
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (MAHOUT-226) Velocity-based code
generation support to support more primitive type collections
Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MAHOUT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12792987#action_12792987 ]
Benson Margulies edited comment on MAHOUT-226 at 12/20/09 11:49 AM:
--------------------------------------------------------------------
Ted,
Here's an interesting thing. I do use your your technique 'internally', but, at least this time around, the scaffolding was removed before I got to the point posting a patch. I have considered moving all the 'to be replaced' code to a separate directory which can be incorporated with the build-helper-plugin (or not) to allow comparing things.
--benson
was (Author: bmargulies):
Ted,
Here's an interesting thing. I do your your technique 'internally', but, at least this time around, the scaffolding was removed before I got to the point posting a patch.
--benson
> Velocity-based code generation support to support more primitive type collections
> ---------------------------------------------------------------------------------
>
> Key: MAHOUT-226
> URL: https://issues.apache.org/jira/browse/MAHOUT-226
> Project: Mahout
> Issue Type: Task
> Components: Matrix
> Reporter: Benson Margulies
> Attachments: codegen.patch, compileroptions.patch
>
>
> We want the complete set of hash maps on the primitive types. The code can be generated. So here's a code generator to do it, and, to show it off, the TypeTypeFunction.java family set up to be generated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.