hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gianmarco De Francisci Morales (JIRA)" <j...@apache.org>
Subject [jira] Created: (PIG-1440) Refactor org.apache.pig.data.DataType to use Enums instead of integer constants
Date Sat, 05 Jun 2010 14:09:53 GMT
Refactor org.apache.pig.data.DataType to use Enums instead of integer constants
-------------------------------------------------------------------------------

                 Key: PIG-1440
                 URL: https://issues.apache.org/jira/browse/PIG-1440
             Project: Pig
          Issue Type: Improvement
            Reporter: Gianmarco De Francisci Morales


Refactoring DataType to use Enums instead of integer constants would provide many benefits,
including:

* Cleaner code
* Easier to iterate over Enums
* Easier to add new Enums without braking backwards compatibility
* Can use EnumMaps for easily link values to Enums
* Better support for translation from Enums to Strings and viceversa

Int (or byte in Pig's case) Enum pattern has several drawbacks as summarized here http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html

Drawbacks:
We have to explicitly convert Enum values to bytes when serializing. This can be done in DataReaderWriter.
Possibly higher overhead than simply using bytes.
Refactoring might be difficult.


Thoughts?

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


Mime
View raw message