/** * Set the `tableInfo` in `configuration` */ public static void setTableInfo(Configuration configuration, TableInfo tableInfo) throws IOException { if (null != tableInfo) { configuration.set(TABLE_INFO, CarbonUtil.encodeToString(tableInfo.serialize())); } }
return CarbonUtil.encodeToString(baos.toByteArray());
/** * Below method will be used to build child schema object which will be stored in * parent table * */ public DataMapSchema buildChildSchema(String dataMapName, String className, String databaseName, String queryString, String queryType) throws UnsupportedEncodingException { RelationIdentifier relationIdentifier = new RelationIdentifier(databaseName, tableName, tableId); Map<String, String> properties = new HashMap<>(); if (queryString != null) { properties.put(DataMapProperty.CHILD_SELECT_QUERY, CarbonUtil.encodeToString(queryString.trim().getBytes( // replace = to with & as hive metastore does not allow = inside. For base 64 // only = is allowed as special character , so replace with & CarbonCommonConstants.DEFAULT_CHARSET)).replace("=", "&")); properties.put(DataMapProperty.QUERY_TYPE, queryType); } DataMapSchema dataMapSchema = new DataMapSchema(dataMapName, className); dataMapSchema.setProperties(properties); dataMapSchema.setChildSchema(this); dataMapSchema.setRelationIdentifier(relationIdentifier); return dataMapSchema; }