[GitHub] [carbondata] kumarvishal09 commented on a change in pull request #3188: [CARBONDATA-3358] Support configurable decode for loading binary data, support base64 and Hex decode.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] kumarvishal09 commented on a change in pull request #3188: [CARBONDATA-3358] Support configurable decode for loading binary data, support base64 and Hex decode.

GitBox
kumarvishal09 commented on a change in pull request #3188: [CARBONDATA-3358] Support configurable decode for loading binary data, support base64 and Hex decode.
URL: https://github.com/apache/carbondata/pull/3188#discussion_r288080366
 
 

 ##########
 File path: processing/src/main/java/org/apache/carbondata/processing/loading/converter/impl/BinaryFieldConverterImpl.java
 ##########
 @@ -43,33 +47,57 @@
   private String nullformat;
   private boolean isEmptyBadRecord;
   private DataField dataField;
+  private String  binaryEncoder;
   public BinaryFieldConverterImpl(DataField dataField, String nullformat, int index,
-      boolean isEmptyBadRecord) {
+      boolean isEmptyBadRecord,String binaryEncoder) {
     this.dataType = dataField.getColumn().getDataType();
     this.dimension = (CarbonDimension) dataField.getColumn();
     this.nullformat = nullformat;
     this.index = index;
     this.isEmptyBadRecord = isEmptyBadRecord;
     this.dataField = dataField;
+    this.binaryEncoder = binaryEncoder;
   }
 
   @Override
   public void convert(CarbonRow row, BadRecordLogHolder logHolder)
       throws CarbonDataLoadingException {
-    if (row.getObject(index) instanceof String) {
-      row.update((((String) row.getObject(index)))
-          .getBytes(Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET)), index);
-    } else if (row.getObject(index) instanceof byte[]) {
-      row.update(row.getObject(index), index);
-    } else {
-      throw new CarbonDataLoadingException("Binary only support String and byte[] data type");
-    }
+    row.update(convert(row.getObject(index), logHolder), index);
   }
 
   @Override
   public Object convert(Object value, BadRecordLogHolder logHolder)
       throws RuntimeException {
-    return null;
+    if (value instanceof String) {
+      if (binaryEncoder.equalsIgnoreCase(
 
 Review comment:
   it will  be expensive because for each cell value we are comparing string, please handle the same as commented earlier  

----------------------------------------------------------------
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:
[hidden email]


With regards,
Apache Git Services