Source:
private void handleCaseSensitivity(BrokerRequest brokerRequest) { String inputTableName = brokerRequest.getQuerySource().getTableName(); String actualTableName = _tableCache.getActualTableName(inputTableName); brokerRequest.getQuerySource().setTableName(actualTableName); if (brokerRequest.getFilterSubQueryMap() != null) { Collection<FilterQuery> values = brokerRequest.getFilterSubQueryMap().getFilterQueryMap().values(); for (FilterQuery filterQuery : values) { if (filterQuery.getNestedFilterQueryIdsSize() == 0) { String expression = filterQuery.getColumn(); filterQuery.setColumn(fixColumnNameCase(actualTableName, expression)); } } } if (brokerRequest.isSetAggregationsInfo()) { for (AggregationInfo info : brokerRequest.getAggregationsInfo()) { if (!info.getAggregationType().equalsIgnoreCase(AggregationFunctionType.COUNT.getName())) { String[] expressions = AggregationFunctionUtils.getArguments(info); List<String> newExpressions = new ArrayList<>(expressions.length); for (String expression : expressions) { newExpressions.add(fixColumnNameCase(actualTableName, expression)); } info.setExpressions(newExpressions); } } if (brokerRequest.isSetGroupBy()) { List<String> expressions = brokerRequest.getGroupBy().getExpressions(); for (int i = 0; i < expressions.size(); i++) { expressions.set(i, fixColumnNameCase(actualTableName, expressions.get(i))); } } } else { Selection selection = brokerRequest.getSelections(); List<String> selectionColumns = selection.getSelectionColumns(); for (int i = 0; i < selectionColumns.size(); i++) { String expression = selectionColumns.get(i); if (!expression.equals("*")) { selectionColumns.set(i, fixColumnNameCase(actualTableName, expression)); } } } if (brokerRequest.isSetOrderBy()) { List<SelectionSort> orderBy = brokerRequest.getOrderBy(); for (SelectionSort selectionSort : orderBy) { String expression = selectionSort.getColumn(); selectionSort.setColumn(fixColumnNameCase(actualTableName, expression)); } } }

Target:
private void handleCaseSensitivity(BrokerRequest brokerRequest) { String inputTableName = brokerRequest.getQuerySource().getTableName(); String actualTableName = _tableCache.getActualTableName(inputTableName); brokerRequest.getQuerySource().setTableName(actualTableName); if (brokerRequest.getFilterSubQueryMap() != null) { Collection<FilterQuery> values = brokerRequest.getFilterSubQueryMap().getFilterQueryMap().values(); for (FilterQuery filterQuery : values) { if (filterQuery.getNestedFilterQueryIdsSize() == 0) { String expression = filterQuery.getColumn(); filterQuery.setColumn(fixColumnNameCase(actualTableName, expression)); } } } if (brokerRequest.isSetAggregationsInfo()) { for (AggregationInfo info : brokerRequest.getAggregationsInfo()) { if (!info.getAggregationType().equalsIgnoreCase(AggregationFunctionType.COUNT.getName())) { List<String> arguments = AggregationFunctionUtils.getArguments(info); arguments.replaceAll(e -> fixColumnNameCase(actualTableName, e)); info.setExpressions(arguments); } } if (brokerRequest.isSetGroupBy()) { List<String> expressions = brokerRequest.getGroupBy().getExpressions(); for (int i = 0; i < expressions.size(); i++) { expressions.set(i, fixColumnNameCase(actualTableName, expressions.get(i))); } } } else { Selection selection = brokerRequest.getSelections(); List<String> selectionColumns = selection.getSelectionColumns(); for (int i = 0; i < selectionColumns.size(); i++) { String expression = selectionColumns.get(i); if (!expression.equals("*")) { selectionColumns.set(i, fixColumnNameCase(actualTableName, expression)); } } } if (brokerRequest.isSetOrderBy()) { List<SelectionSort> orderBy = brokerRequest.getOrderBy(); for (SelectionSort selectionSort : orderBy) { String expression = selectionSort.getColumn(); selectionSort.setColumn(fixColumnNameCase(actualTableName, expression)); } } }