[ 
https://issues.apache.org/jira/browse/GIRAPH-277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13428513#comment-13428513
 ] 

Jaeho Shin commented on GIRAPH-277:
-----------------------------------

@Eli, In fact, the preprocessing is already used within the patch several times 
for {{AdjacencyListTextVertexReader}}, {{JsonBase64VertexReader}}, and 
{{JsonLongDoubleFloatDoubleVertexReader}} to name a few. (We are discusssing 
the {{TextVertexReaderFromEachLineProcessed}} class, right?)
To make it clearer, let me explain how I came up with the design.  First I 
started rewriting existing readers based on the plain 
{{TextVertexReaderFromEachLine}}, but found there was a pattern in most of 
them.  They were processing each line to yield an intermediate object, such as 
String[], JSONObject, or JSONArray, then create vertex id, value and edges out 
of it.  Without the {{TextVertexReaderFromEachLineProcessed}} base class, it 
was going to force users to do the String#split() or JSON parsing from the Text 
object multiple times (in getId/Value/Edges), or make them hacking the base 
classes for performance.  I hope this convinces you.
As my patch gets committed, I will update the wiki and try to impress new users 
showing how simple it is to load their custom data to Giraph. :)

@Jakob, I tried with the reviewboard web form, but getting 500 server error 
every time I submit the patch.  I tried post-review from my git-svn tree, but 
also failed multiple times.  It left some empty review requests, but I still 
can't upload my diff there.  It complains about my patch having "No valid 
separator after the filename was found in the diff header"  What's the right 
way to generate the patch for RB?  Shouldn't {{git diff}} work?
                
> Text Vertex Input/Output Format base classes overhaul
> -----------------------------------------------------
>
>                 Key: GIRAPH-277
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-277
>             Project: Giraph
>          Issue Type: Improvement
>          Components: examples, lib
>            Reporter: Jaeho Shin
>         Attachments: GIRAPH-277.patch
>
>
> The current way of implementing {{VertexInputFormat}} and {{VertexReader}} 
> had bad smell.  It required users to understand how these two classes are 
> glued together, and forced similar codes to be duplicated in every new input 
> format.  (Similarly for the VertexOutputFormat and VertexWriter.)  Anyone who 
> wants to create a new format should create an underlying record reader or 
> writer at the right moment and delegate some calls to it, which seemed 
> unnecessary detail being exposed.  Besides, type parameters had to appear all 
> over every new format code, which was extremely annoying for both reading 
> existing code and writing a new one.  I was very frustrated writing my first 
> format code especially when I compared it to writing a new vertex code.  I 
> thought writing a new input/output format should be as simple as vertex.
> So, I have refactored {{TextVertexInputFormat}} and {{OutputFormat}} into new 
> forms that have no difference in their interfaces, but remove a lot of burden 
> for subclassing.  Instead of providing static VertexReader base classes, I 
> made it a non-static inner-class of its format class, which helps eliminate 
> the repeated code for gluing these two, already tightly coupled classes.  
> This has additional advantage of eliminating all the Generics type variables 
> on the VertexReader side, which makes overall code much more concise.  I 
> added several useful TextVertexReader base classes that can save efforts for 
> implementing line-oriented formats.
> Please comment if you see my proposed change have any impact on other 
> aspects.  I'm unsure of how these additional layers of abstraction could 
> affect performance.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to