[GitHub] carbondata pull request #1720: [WIP]fix the backword compatibility issue for...

classic Classic list List threaded Threaded
46 messages Options
123
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [WIP]fix the backword compatibility issue for...

qiuchenjian-2
GitHub user akashrn5 opened a pull request:

    https://github.com/apache/carbondata/pull/1720

    [WIP]fix the backword compatibility issue for tableInfo deserialization

    Be sure to do all of the following checklist to help us incorporate
    your contribution quickly and easily:
   
     - [ ] Any interfaces changed?
     
     - [ ] Any backward compatibility impacted?
     
     - [ ] Document update required?
   
     - [ ] Testing done
            Please provide details on
            - Whether new unit test cases have been added or why no new tests are required?
            - How it is tested? Please attach test report.
            - Is it a performance related change? Please attach the performance test report.
            - Any additional information to help reviewers in testing this change.
           
     - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
   


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/akashrn5/incubator-carbondata compatibility

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/carbondata/pull/1720.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1720
   
----
commit 3a3d67ce245541efb2608368c23b80eb57e63e94
Author: akashrn5 <akashnilugal@...>
Date:   2017-12-22T13:07:20Z

    fix the backword compatibility issue for tableInfo deserialization

----


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1720: [CARBONDATA-1935]fix the backword compatibility issu...

qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1720
 
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2274/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158511440
 
    --- Diff: core/pom.xml ---
    @@ -94,6 +94,11 @@
             </exclusion>
           </exclusions>
         </dependency>
    +    <dependency>
    +      <groupId>com.google.code.gson</groupId>
    --- End diff --
   
    Why this is needed? core module also uses GSON already right?


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158511629
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java ---
    @@ -31,7 +31,7 @@
       // size of the value of this data type, negative value means variable length
       private int sizeInBytes;
     
    -  DataType(int id, int precedenceOrder, String name, int sizeInBytes) {
    +  public DataType(int id, int precedenceOrder, String name, int sizeInBytes) {
    --- End diff --
   
    public is not needed, since DataTypes class is in same package


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158511675
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -112,6 +118,40 @@ public static DataType valueOf(int id) {
         }
       }
     
    +  public static DataType valueOf(String name) {
    --- End diff --
   
    add comment


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158511774
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -112,6 +118,40 @@ public static DataType valueOf(int id) {
         }
       }
     
    +  public static DataType valueOf(String name) {
    +    if (STRING.getName().equalsIgnoreCase(name)) {
    +      return STRING;
    +    } else if (DATE.getName().equalsIgnoreCase(name)) {
    +      return DATE;
    +    } else if (TIMESTAMP.getName().equalsIgnoreCase(name)) {
    +      return TIMESTAMP;
    +    } else if (BOOLEAN.getName().equalsIgnoreCase(name)) {
    +      return BOOLEAN;
    +    } else if (BYTE.getName().equalsIgnoreCase(name)) {
    +      return BYTE;
    +    } else if (SHORT.getName().equalsIgnoreCase(name)) {
    +      return SHORT;
    +    } else if (SHORT_INT.getName().equalsIgnoreCase(name)) {
    +      return SHORT_INT;
    +    } else if (INT.getName().equalsIgnoreCase(name)) {
    +      return INT;
    +    } else if (LONG.getName().equalsIgnoreCase(name)) {
    +      return LONG;
    +    } else if (LEGACY_LONG.getName().equalsIgnoreCase(name)) {
    +      return LEGACY_LONG;
    +    } else if (FLOAT.getName().equalsIgnoreCase(name)) {
    +      return FLOAT;
    +    } else if (DOUBLE.getName().equalsIgnoreCase(name)) {
    +      return DOUBLE;
    +    } else if (NULL.getName().equalsIgnoreCase(name)) {
    +      return NULL;
    +    } else if (BYTE_ARRAY.getName().equalsIgnoreCase(name)) {
    +      return BYTE_ARRAY;
    +    } else {
    +      throw new RuntimeException("create DataType with invalid name: " + name);
    --- End diff --
   
    how about struct and array?


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158512233
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -184,4 +224,58 @@ public static boolean isMapType(DataType dataType) {
         return dataType.getId() == MAP_TYPE_ID;
       }
     
    +  /**
    +   * This class is added to support backword compatibility with table info object, where DATATYPE
    +   * is string in old version and OBJECT in new version
    --- End diff --
   
    mention which version explicitly


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158512534
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java ---
    @@ -1938,6 +1939,12 @@ public static TableInfo convertGsonToTableInfo(Map<String, String> properties) {
           }
           builder.append(part);
         }
    +
    +    // Datatype GSON adapter is added to support backward compatibility for tableInfo desrialization
    +    GsonBuilder gsonBuilder = new GsonBuilder();
    +    gsonBuilder.registerTypeAdapter(DataType.class, DataTypes.DataTypeAdapter.getInstance());
    --- End diff --
   
    I am not sure whether it has concurrent issue if we use singleton here, I think it is acceptable to new a DataTypeAdapter


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158512632
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -184,4 +224,58 @@ public static boolean isMapType(DataType dataType) {
         return dataType.getId() == MAP_TYPE_ID;
       }
     
    +  /**
    +   * This class is added to support backword compatibility with table info object, where DATATYPE
    +   * is string in old version and OBJECT in new version
    --- End diff --
   
    It is better to make it an separate java file


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user akashrn5 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158512806
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -112,6 +118,40 @@ public static DataType valueOf(int id) {
         }
       }
     
    +  public static DataType valueOf(String name) {
    --- End diff --
   
    ok


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158515028
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -184,4 +224,60 @@ public static boolean isMapType(DataType dataType) {
         return dataType.getId() == MAP_TYPE_ID;
       }
     
    +  /**
    +   * This class is added to support backword compatibility with table info object, where DATATYPE
    +   * is string in old version and OBJECT in new version
    +   */
    +  public static class DataTypeAdapter extends TypeAdapter<Object> {
    +
    +    private static DataTypeAdapter dataTypeAdapter = new DataTypeAdapter();
    +
    +    private DataTypeAdapter() {
    +    }
    +
    +    public static DataTypeAdapter getInstance() {
    +      return dataTypeAdapter;
    +    }
    +
    +    @Override public void write(JsonWriter jsonWriter, Object o) throws IOException {
    --- End diff --
   
    move @Override to previous line


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158515043
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -184,4 +224,60 @@ public static boolean isMapType(DataType dataType) {
         return dataType.getId() == MAP_TYPE_ID;
       }
     
    +  /**
    +   * This class is added to support backword compatibility with table info object, where DATATYPE
    +   * is string in old version and OBJECT in new version
    +   */
    +  public static class DataTypeAdapter extends TypeAdapter<Object> {
    +
    +    private static DataTypeAdapter dataTypeAdapter = new DataTypeAdapter();
    +
    +    private DataTypeAdapter() {
    +    }
    +
    +    public static DataTypeAdapter getInstance() {
    +      return dataTypeAdapter;
    +    }
    +
    +    @Override public void write(JsonWriter jsonWriter, Object o) throws IOException {
    +    }
    +
    +    @Override public Object read(JsonReader jsonReader) throws IOException {
    --- End diff --
   
    move @Override to previous line


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user akashrn5 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158515688
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java ---
    @@ -1938,6 +1939,12 @@ public static TableInfo convertGsonToTableInfo(Map<String, String> properties) {
           }
           builder.append(part);
         }
    +
    +    // Datatype GSON adapter is added to support backward compatibility for tableInfo desrialization
    +    GsonBuilder gsonBuilder = new GsonBuilder();
    +    gsonBuilder.registerTypeAdapter(DataType.class, DataTypes.DataTypeAdapter.getInstance());
    --- End diff --
   
    ok


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158515750
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -184,4 +224,60 @@ public static boolean isMapType(DataType dataType) {
         return dataType.getId() == MAP_TYPE_ID;
       }
     
    +  /**
    +   * This class is added to support backword compatibility with table info object, where DATATYPE
    +   * is string in old version and OBJECT in new version
    +   */
    +  public static class DataTypeAdapter extends TypeAdapter<Object> {
    +
    +    private static DataTypeAdapter dataTypeAdapter = new DataTypeAdapter();
    +
    +    private DataTypeAdapter() {
    +    }
    +
    +    public static DataTypeAdapter getInstance() {
    +      return dataTypeAdapter;
    +    }
    +
    +    @Override public void write(JsonWriter jsonWriter, Object o) throws IOException {
    +    }
    +
    +    @Override public Object read(JsonReader jsonReader) throws IOException {
    +      DataType newObj;
    --- End diff --
   
    change newObj to dataType


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158515927
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -184,4 +224,60 @@ public static boolean isMapType(DataType dataType) {
         return dataType.getId() == MAP_TYPE_ID;
       }
     
    +  /**
    +   * This class is added to support backword compatibility with table info object, where DATATYPE
    +   * is string in old version and OBJECT in new version
    +   */
    +  public static class DataTypeAdapter extends TypeAdapter<Object> {
    +
    +    private static DataTypeAdapter dataTypeAdapter = new DataTypeAdapter();
    +
    +    private DataTypeAdapter() {
    +    }
    +
    +    public static DataTypeAdapter getInstance() {
    +      return dataTypeAdapter;
    +    }
    +
    +    @Override public void write(JsonWriter jsonWriter, Object o) throws IOException {
    +    }
    +
    +    @Override public Object read(JsonReader jsonReader) throws IOException {
    +      DataType newObj;
    +      JsonToken token = jsonReader.peek();
    +
    --- End diff --
   
    remove empty line


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1720: [CARBONDATA-1935]fix the backword compatibili...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1720#discussion_r158516073
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataTypes.java ---
    @@ -184,4 +224,60 @@ public static boolean isMapType(DataType dataType) {
         return dataType.getId() == MAP_TYPE_ID;
       }
     
    +  /**
    +   * This class is added to support backword compatibility with table info object, where DATATYPE
    +   * is string in old version and OBJECT in new version
    +   */
    +  public static class DataTypeAdapter extends TypeAdapter<Object> {
    +
    +    private static DataTypeAdapter dataTypeAdapter = new DataTypeAdapter();
    +
    +    private DataTypeAdapter() {
    +    }
    +
    +    public static DataTypeAdapter getInstance() {
    +      return dataTypeAdapter;
    +    }
    +
    +    @Override public void write(JsonWriter jsonWriter, Object o) throws IOException {
    +    }
    +
    +    @Override public Object read(JsonReader jsonReader) throws IOException {
    +      DataType newObj;
    +      JsonToken token = jsonReader.peek();
    +
    +      if (token == JsonToken.STRING) {
    +        newObj = DataTypes.valueOf(jsonReader.nextString());
    +      } else {
    +        jsonReader.beginObject();
    +
    +        int id = 0;
    +        int precedenceOrder = 0;
    +        String name = "";
    +        int sizeInBytes = 0;
    +
    +        while (jsonReader.hasNext()) {
    +          switch (jsonReader.nextName()) {
    +            case "id":
    +              id = jsonReader.nextInt();
    +              break;
    +            case "precedenceOrder":
    +              precedenceOrder = jsonReader.nextInt();
    +              break;
    +            case "name":
    +              name = jsonReader.nextString();
    +              break;
    +            case "sizeInBytes":
    +              sizeInBytes = jsonReader.nextInt();
    +              break;
    +            default:
    +              break;
    --- End diff --
   
    I think we should throw IOException here


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1720: [CARBONDATA-1935]fix the backword compatibility issu...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1720
 
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2278/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1720: [CARBONDATA-1935]fix the backword compatibility issu...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1720
 
    Build Failed with Spark 2.2.0, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/1053/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1720: [CARBONDATA-1935]fix the backword compatibility issu...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/1720
 
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/2280/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1720: [CARBONDATA-1935]fix the backword compatibility issu...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1720
 
    SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/2526/



---
123