You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Scott Banachowski (JIRA)" <ji...@apache.org> on 2009/07/03 20:31:47 UTC

[jira] Created: (AVRO-71) Followup - making some C++ object APIs more generic

Followup - making some C++ object APIs more generic
---------------------------------------------------

                 Key: AVRO-71
                 URL: https://issues.apache.org/jira/browse/AVRO-71
             Project: Avro
          Issue Type: Improvement
          Components: c++
            Reporter: Scott Banachowski
            Assignee: Scott Banachowski
             Fix For: 1.0.0


This is a patch I made for the serializer.  In the original version, the Serializer object has functions like putInt(), putLong(),..., i.e. each put* function has a different name.  

This is not convenient for generic template code, because each type requires a different function call.  I moved the Serializer code to a class called Writer, that has only putValue overridden for each type, e.g. putValue(int32_t), putValue(int64_t), putValue(bool) etc.

Generic code, such as in AvroSerializer.hh can use the generic API.  To preserve the explicit calls, Serializer still exists, but has become a thin wrapper for Writer.  The explicit calls are still useful for when you don't want implicit conversion to accidentally choose the wrong type.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Scott Banachowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Banachowski updated AVRO-71:
----------------------------------

    Attachment: AVRO-71.patch

Updated patch

> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>         Attachments: AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Scott Banachowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Banachowski updated AVRO-71:
----------------------------------

    Status: Patch Available  (was: Open)

> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>             Fix For: 1.0.0
>
>         Attachments: AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-71:
-----------------------------

    Fix Version/s:     (was: 1.0.0)
           Status: Open  (was: Patch Available)

This patch attempts to patch two files no longer in the repo, ValidatingReader.{cc,hh}.

Compilation fails for me with:
{quote}
g++ -Wall -Werror -g  -I./api -I./parser -I. -isystem/usr/include/boost -o unittest test/unittest.cc obj/avrolib.a /usr/lib/libboost_regex-gcc42-mt-1_34_1.a
In file included from test/unittest.cc:30:
./api/Parser.hh:22:21: error: Reader.hh: No such file or directory
./api/Parser.hh:23:31: error: ValidatingReader.hh: No such file or directory
In file included from test/unittest.cc:30:
{quote}


> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>         Attachments: AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Scott Banachowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727369#action_12727369 ] 

Scott Banachowski commented on AVRO-71:
---------------------------------------

I made the patch again (the original patch was missing Reader.hh but shouldn't have been missing ValidatingReader.hh).  

When I made the patch this time, svn diff reports:

[liedriveglad-lm ~/avro-trunk] svn status -q
M      src/c++/test/unittest.cc
M      src/c++/test/testgen.cc
D      src/c++/impl/ValidatingSerializer.cc
D      src/c++/impl/ValidatingParser.cc
A  +   src/c++/impl/ValidatingReader.cc
M      src/c++/api/Parser.hh
D      src/c++/api/ValidatingParser.hh
A      src/c++/api/Reader.hh
M      src/c++/api/AvroParse.hh
A  +   src/c++/api/ValidatingReader.hh
M      src/c++/api/ValidatingWriter.hh
M      src/c++/Makefile

Hopefully, applying it should add Reader.hh and ValidatingReader.cc/hh and remove ValidatingParser.cc/hh and ValidatingSerializer.cc



> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>         Attachments: AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12728882#action_12728882 ] 

Doug Cutting commented on AVRO-71:
----------------------------------

Subversion diff files are not sufficient when renaming files.  The best thing to do is attach a small shell script that performs the required renamings.  In an unmodified workspace, one should be able to run the script then apply the patch.  For example, see AVRO-25.

> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>         Attachments: AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Scott Banachowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Banachowski updated AVRO-71:
----------------------------------

    Description: 
This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.



  was:
This is a patch I made for the serializer.  In the original version, the Serializer object has functions like putInt(), putLong(),..., i.e. each put* function has a different name.  

This is not convenient for generic template code, because each type requires a different function call.  I moved the Serializer code to a class called Writer, that has only putValue overridden for each type, e.g. putValue(int32_t), putValue(int64_t), putValue(bool) etc.

Generic code, such as in AvroSerializer.hh can use the generic API.  To preserve the explicit calls, Serializer still exists, but has become a thin wrapper for Writer.  The explicit calls are still useful for when you don't want implicit conversion to accidentally choose the wrong type.




> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>             Fix For: 1.0.0
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Scott Banachowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Banachowski updated AVRO-71:
----------------------------------

    Attachment:     (was: AVRO-71.patch)

> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>         Attachments: AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting resolved AVRO-71.
------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0.1

I just committed this.  Thanks, Scott!

> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>             Fix For: 1.0.1
>
>         Attachments: apply.sh, AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Scott Banachowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Banachowski updated AVRO-71:
----------------------------------

    Attachment: apply.sh

Here's a shell script that should apply the patch.

I tried this on my mac on a clean checkout of trunk, and all went well.

I copied the patch "AVRO-71.patch" and the script "apply.sh" to root of the trunk directory, and from there ran:

sh apply.sh

After the script ran things looked as I expected.

Hope this works for you as well.



> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>         Attachments: apply.sh, AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-71) Followup - making some C++ object APIs more generic

Posted by "Scott Banachowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-71?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Banachowski updated AVRO-71:
----------------------------------

    Attachment: AVRO-71.patch

This is the svn diff for the patch.

Last time I renamed files in a patch, in the repository it left 0 size files instead of removing them.
This patch has also renamed files, so after applying the patch, if any 0 size files remain instead of getting deleted, please remove them.


> Followup - making some C++ object APIs more generic
> ---------------------------------------------------
>
>                 Key: AVRO-71
>                 URL: https://issues.apache.org/jira/browse/AVRO-71
>             Project: Avro
>          Issue Type: Improvement
>          Components: c++
>            Reporter: Scott Banachowski
>            Assignee: Scott Banachowski
>             Fix For: 1.0.0
>
>         Attachments: AVRO-71.patch
>
>
> This is a followup to issue AVRO-59.  In that change, a more generic version of Writer class was created to support templates.
> I now have done the same kind of refactor for the Reader version, to make Reader and Writer more symmetric.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.