virajjasani commented on a change in pull request #1363:
URL: https://github.com/apache/phoenix/pull/1363#discussion_r766550840
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
##########
@@ -247,6 +247,58 @@ public String toString() {
},
}
+ public enum TransformType {
+ METADATA_TRANSFORM((byte)1);
+
+ private final byte[] byteValue;
+ private final int serializedValue;
+
+ TransformType(int serializedValue) {
+ this.serializedValue = serializedValue;
+ this.byteValue = Bytes.toBytes(this.name());
+ }
+
+ public byte[] getBytes() {
+ return byteValue;
+ }
+
+ public int getSerializedValue() {
+ return this.serializedValue;
+ }
+ public static TransformType getDefault() {
+ return METADATA_TRANSFORM;
+ }
+ public static TransformType fromSerializedValue(int serializedValue) {
+ if (serializedValue < 1 || serializedValue >
TaskType.values().length) {
Review comment:
I was wondering how TransformIT didn't fail due to this but then
realized that since we have only one Enum value available for TransformType
i.e. `METADATA_TRANSFORM` with value 1, so when we deserialize, it will anyways
result into `TransformType.values()[0]` so we were good. Only if we had
multiple enum values, we might have faced some issues. Is that correct?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]