[GitHub] [carbondata] vikramahuja1001 commented on a change in pull request #3906: Added test cases for hive read complex types and handled other issues

2020-08-31 Thread GitBox


vikramahuja1001 commented on a change in pull request #3906:
URL: https://github.com/apache/carbondata/pull/3906#discussion_r480233177



##
File path: 
integration/hive/src/main/java/org/apache/carbondata/hive/util/DataTypeUtil.java
##
@@ -64,13 +69,23 @@ public static DataType convertHiveTypeToCarbon(String type) 
throws SQLException
   return DataTypes.createArrayType(convertHiveTypeToCarbon(subType));
 } else if (type.startsWith("map<")) {
   String[] subType = (type.substring(type.indexOf("<") + 1, 
type.indexOf(">"))).split(",");
+  for (int i = 0; i < subType.length; i++) {
+if (subType[i].startsWith("decimal")) {
+  subType[i] += ',' + subType[++i];

Review comment:
   Use CarbonCommonConstants.COMMA instead of ','

##
File path: 
integration/hive/src/main/java/org/apache/carbondata/hive/util/DataTypeUtil.java
##
@@ -64,13 +69,23 @@ public static DataType convertHiveTypeToCarbon(String type) 
throws SQLException
   return DataTypes.createArrayType(convertHiveTypeToCarbon(subType));
 } else if (type.startsWith("map<")) {
   String[] subType = (type.substring(type.indexOf("<") + 1, 
type.indexOf(">"))).split(",");
+  for (int i = 0; i < subType.length; i++) {
+if (subType[i].startsWith("decimal")) {
+  subType[i] += ',' + subType[++i];
+  subType = (String[]) ArrayUtils.removeElement(subType, subType[i]);
+}
+  }
   return DataTypes
   .createMapType(convertHiveTypeToCarbon(subType[0]), 
convertHiveTypeToCarbon(subType[1]));
 } else if (type.startsWith("struct<")) {
   String[] subTypes =
   (type.substring(type.indexOf("<") + 1, 
type.indexOf(">"))).split(",");
   List structFieldList = new ArrayList<>();
-  for (String subType : subTypes) {
+  for (int i = 0; i < subTypes.length; i++) {
+String subType = subTypes[i];
+if (subType.startsWith("decimal")) {
+  subType += ',' + subTypes[++i];

Review comment:
   Use CarbonCommonConstants.COMMA





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] vikramahuja1001 commented on a change in pull request #3906: Added test cases for hive read complex types and handled other issues

2020-08-31 Thread GitBox


vikramahuja1001 commented on a change in pull request #3906:
URL: https://github.com/apache/carbondata/pull/3906#discussion_r480230761



##
File path: 
integration/hive/src/test/java/org/apache/carbondata/hive/HiveTestUtils.java
##
@@ -65,7 +74,12 @@ public boolean checkAnswer(ResultSet actual, ResultSet 
expected) throws SQLExcep
   Assert.assertTrue(numOfColumnsExpected > 0);
   Assert.assertEquals(actual.getMetaData().getColumnCount(), 
numOfColumnsExpected);
   for (int i = 1; i <= numOfColumnsExpected; i++) {
-Assert.assertEquals(actual.getString(i), actual.getString(i));
+if (actual.getString(i).contains(":")) {
+  Assert.assertTrue(checkMapPairsIgnoringOrder(actual.getString(i), 
expected.getString(i)));
+} else {
+  Assert.assertEquals(actual.getString(i), expected.getString(i));
+}
+// System.out.println(actual.getString(i));

Review comment:
   Remove this comment





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org