private void fillMappingDetails(ColumnSchema column, Map<String, Set<ColumnSchema>> map) { List<ParentColumnTableRelation> parentColumnTableRelations = column.getParentColumnTableRelations(); if (null != parentColumnTableRelations && parentColumnTableRelations.size() == 1) { String columnName = column.getParentColumnTableRelations().get(0).getColumnName(); Set<ColumnSchema> columnSchemas = map.get(columnName); if (null == columnSchemas) { columnSchemas = new HashSet<>(); map.put(columnName, columnSchemas); } columnSchemas.add(column); } }
/** * Below method will be used to get the column schema based on parent column name * @param columName * parent column name * @return child column schema */ public ColumnSchema getChildColByParentColName(String columName) { List<ColumnSchema> listOfColumns = childSchema.getListOfColumns(); for (ColumnSchema columnSchema : listOfColumns) { List<ParentColumnTableRelation> parentColumnTableRelations = columnSchema.getParentColumnTableRelations(); if (null != parentColumnTableRelations && parentColumnTableRelations.size() == 1 && parentColumnTableRelations.get(0).getColumnName().equalsIgnoreCase(columName) && columnSchema.getColumnName().endsWith(columName)) { return columnSchema; } } return null; }
/** * Below method will be used to get the column schema based on parent column name * @param columName * parent column name * @param timeseriesFunction * timeseries function applied on column * @return child column schema */ public ColumnSchema getTimeseriesChildColByParent(String columName, String timeseriesFunction) { List<ColumnSchema> listOfColumns = childSchema.getListOfColumns(); for (ColumnSchema columnSchema : listOfColumns) { List<ParentColumnTableRelation> parentColumnTableRelations = columnSchema.getParentColumnTableRelations(); if (null != parentColumnTableRelations && parentColumnTableRelations.size() == 1 && parentColumnTableRelations.get(0).getColumnName().equalsIgnoreCase(columName) && timeseriesFunction.equalsIgnoreCase(columnSchema.getTimeSeriesFunction())) { return columnSchema; } } return null; }
/** * Method to prepare mapping of parent to list of aggregation function applied on that column * @param listOfColumns * child column schema list */ private void fillParentNameToAggregationMapping(List<ColumnSchema> listOfColumns) { parentColumnToAggregationsMapping = new HashMap<>(); for (ColumnSchema column : listOfColumns) { if (null != column.getAggFunction() && !column.getAggFunction().isEmpty()) { List<ParentColumnTableRelation> parentColumnTableRelations = column.getParentColumnTableRelations(); if (null != parentColumnTableRelations && parentColumnTableRelations.size() == 1) { String columnName = column.getParentColumnTableRelations().get(0).getColumnName(); Set<String> aggFunctions = parentColumnToAggregationsMapping.get(columnName); if (null == aggFunctions) { aggFunctions = new HashSet<>(); parentColumnToAggregationsMapping.put(columnName, aggFunctions); } aggFunctions.add(column.getAggFunction()); } } } }
if (null != column.getAggFunction() && !column.getAggFunction().isEmpty()) { if (null == aggregationDataMapSchema .getAggChildColByParent(parentColumnTableRelations.get(0).getColumnName(), column.getAggFunction())) { return false; parentColumnTableRelations.get(0).getColumnName())) { return false;
private List<org.apache.carbondata.format.ParentColumnTableRelation> wrapperToThriftRelationList( List<ParentColumnTableRelation> wrapperColumnRelations) { List<org.apache.carbondata.format.ParentColumnTableRelation> thriftColumnRelationList = new ArrayList<>(); for (ParentColumnTableRelation wrapperColumnRelation : wrapperColumnRelations) { org.apache.carbondata.format.ParentColumnTableRelation thriftColumnTableRelation = new org.apache.carbondata.format.ParentColumnTableRelation(); thriftColumnTableRelation.setColumnId(wrapperColumnRelation.getColumnId()); thriftColumnTableRelation.setColumnName(wrapperColumnRelation.getColumnName()); org.apache.carbondata.format.RelationIdentifier thriftRelationIdentifier = new org.apache.carbondata.format.RelationIdentifier(); thriftRelationIdentifier .setDatabaseName(wrapperColumnRelation.getRelationIdentifier().getDatabaseName()); thriftRelationIdentifier .setTableName(wrapperColumnRelation.getRelationIdentifier().getTableName()); thriftRelationIdentifier .setTableId(wrapperColumnRelation.getRelationIdentifier().getTableId()); thriftColumnTableRelation.setRelationIdentifier(thriftRelationIdentifier); thriftColumnRelationList.add(thriftColumnTableRelation); } return thriftColumnRelationList; }