@Test public void getDelimiterCode() { Integer delimiterCode = hiveClientWrapper.getDelimiterCode(null); char defaultDelim = ','; assertEquals((int) delimiterCode, (int) defaultDelim); char expectedDelim = '%'; StorageDescriptor sd = new StorageDescriptor(); SerDeInfo si = new SerDeInfo(); si.setParameters(Collections.singletonMap(serdeConstants.FIELD_DELIM, String.valueOf(expectedDelim))); sd.setSerdeInfo(si); delimiterCode = hiveClientWrapper.getDelimiterCode(sd); assertEquals((int) delimiterCode, (int) expectedDelim); sd = new StorageDescriptor(); si = new SerDeInfo(); si.setParameters(Collections.singletonMap(serdeConstants.SERIALIZATION_FORMAT, String.valueOf((int) expectedDelim))); sd.setSerdeInfo(si); delimiterCode = hiveClientWrapper.getDelimiterCode(sd); assertEquals((int) delimiterCode, (int) expectedDelim); }
public Integer getDelimiterCode(StorageDescriptor sd) { Integer delimiterCode; String delimiter = getSerdeParameter(sd, serdeConstants.FIELD_DELIM); if (delimiter != null) { delimiterCode = (int) delimiter.charAt(0); return delimiterCode; } delimiter = getSerdeParameter(sd, serdeConstants.SERIALIZATION_FORMAT); if (delimiter != null) { delimiterCode = Integer.parseInt(delimiter); return delimiterCode; } return DEFAULT_DELIMITER_CODE; }
HiveClientWrapper { public Integer getDelimiterCode(StorageDescriptor sd) { Integer delimiterCode; String delimiter = getSerdeParameter(sd, serdeConstants.FIELD_DELIM); if (delimiter != null) { delimiterCode = (int) delimiter.charAt(0); return delimiterCode; } delimiter = getSerdeParameter(sd, serdeConstants.SERIALIZATION_FORMAT); if (delimiter != null) { delimiterCode = Integer.parseInt(delimiter); return delimiterCode; } return DEFAULT_DELIMITER_CODE; } }
HiveClientWrapper { public Integer getDelimiterCode(StorageDescriptor sd) { Integer delimiterCode; String delimiter = getSerdeParameter(sd, serdeConstants.FIELD_DELIM); if (delimiter != null) { delimiterCode = (int) delimiter.charAt(0); return delimiterCode; } delimiter = getSerdeParameter(sd, serdeConstants.SERIALIZATION_FORMAT); if (delimiter != null) { delimiterCode = Integer.parseInt(delimiter); return delimiterCode; } return DEFAULT_DELIMITER_CODE; } private  HiveClientWrapper();   HiveClientWrapper(HiveClientFactory hiveClientFactory); }
HiveClientWrapper { public Integer getDelimiterCode(StorageDescriptor sd) { Integer delimiterCode; String delimiter = getSerdeParameter(sd, serdeConstants.FIELD_DELIM); if (delimiter != null) { delimiterCode = (int) delimiter.charAt(0); return delimiterCode; } delimiter = getSerdeParameter(sd, serdeConstants.SERIALIZATION_FORMAT); if (delimiter != null) { delimiterCode = Integer.parseInt(delimiter); return delimiterCode; } return DEFAULT_DELIMITER_CODE; } private  HiveClientWrapper();   HiveClientWrapper(HiveClientFactory hiveClientFactory); static HiveClientWrapper getInstance(); IMetaStoreClient initHiveClient(RequestContext context, Configuration configuration); Table getHiveTable(IMetaStoreClient client, Metadata.Item itemName); void getSchema(Table tbl, Metadata metadata); byte[] makeUserData(String fragmenterClassName,
                               HiveTablePartition partData,
                               boolean filterInFragmenter,
                               List<Integer> hiveIndexes,
                               String allColumnNames,
                               String allColumnTypes); Metadata.Item extractTableFromName(String qualifiedName); boolean hasComplexTypes(Metadata metadata); List<Metadata.Item> extractTablesFromPattern(IMetaStoreClient client, String pattern); Integer getDelimiterCode(StorageDescriptor sd); }
HiveClientWrapper { public Integer getDelimiterCode(StorageDescriptor sd) { Integer delimiterCode; String delimiter = getSerdeParameter(sd, serdeConstants.FIELD_DELIM); if (delimiter != null) { delimiterCode = (int) delimiter.charAt(0); return delimiterCode; } delimiter = getSerdeParameter(sd, serdeConstants.SERIALIZATION_FORMAT); if (delimiter != null) { delimiterCode = Integer.parseInt(delimiter); return delimiterCode; } return DEFAULT_DELIMITER_CODE; } private  HiveClientWrapper();   HiveClientWrapper(HiveClientFactory hiveClientFactory); static HiveClientWrapper getInstance(); IMetaStoreClient initHiveClient(RequestContext context, Configuration configuration); Table getHiveTable(IMetaStoreClient client, Metadata.Item itemName); void getSchema(Table tbl, Metadata metadata); byte[] makeUserData(String fragmenterClassName,
                               HiveTablePartition partData,
                               boolean filterInFragmenter,
                               List<Integer> hiveIndexes,
                               String allColumnNames,
                               String allColumnTypes); Metadata.Item extractTableFromName(String qualifiedName); boolean hasComplexTypes(Metadata metadata); List<Metadata.Item> extractTablesFromPattern(IMetaStoreClient client, String pattern); Integer getDelimiterCode(StorageDescriptor sd);  }