Source:
private void convertSelectList(PinotQuery pinotQuery, BrokerRequest brokerRequest) { Selection selection = null; List<AggregationInfo> aggregationInfoList = null; for (Expression expression : pinotQuery.getSelectList()) { ExpressionType type = expression.getType(); if (type == ExpressionType.FUNCTION && expression.getFunctionCall().getOperator() .equalsIgnoreCase(SqlKind.AS.toString())) { expression = expression.getFunctionCall().getOperands().get(0); type = expression.getType(); } switch (type) { case LITERAL: if (selection == null) { selection = new Selection(); } selection.addToSelectionColumns(String.format("'%s'", expression.getLiteral().getFieldValue().toString())); break; case IDENTIFIER: if (selection == null) { selection = new Selection(); } selection.addToSelectionColumns(expression.getIdentifier().getName()); break; case FUNCTION: Function functionCall = expression.getFunctionCall(); String functionName = functionCall.getOperator(); if (FunctionDefinitionRegistry.isAggFunc(functionName)) { AggregationInfo aggInfo = buildAggregationInfo(functionCall); if (aggregationInfoList == null) { aggregationInfoList = new ArrayList<>(); } aggregationInfoList.add(aggInfo); } else { if (selection == null) { selection = new Selection(); } selection.addToSelectionColumns(ParserUtils.standardizeExpression(expression, false)); } break; } } if (aggregationInfoList != null && aggregationInfoList.size() > 0) { brokerRequest.setAggregationsInfo(aggregationInfoList); } else if (selection != null) { if (pinotQuery.isSetOffset()) { selection.setOffset(pinotQuery.getOffset()); } if (pinotQuery.isSetLimit()) { selection.setSize(pinotQuery.getLimit()); } brokerRequest.setSelections(selection); } }

Target:
private void convertSelectList(PinotQuery pinotQuery, BrokerRequest brokerRequest) { Selection selection = null; List<AggregationInfo> aggregationInfoList = null; for (Expression expression : pinotQuery.getSelectList()) { ExpressionType type = expression.getType(); if (type == ExpressionType.FUNCTION && expression.getFunctionCall().getOperator() .equalsIgnoreCase(SqlKind.AS.toString())) { expression = expression.getFunctionCall().getOperands().get(0); type = expression.getType(); } switch (type) { case LITERAL: if (selection == null) { selection = new Selection(); } selection.addToSelectionColumns('\'' + expression.getLiteral().getFieldValue().toString() + '\''); break; case IDENTIFIER: if (selection == null) { selection = new Selection(); } selection.addToSelectionColumns(expression.getIdentifier().getName()); break; case FUNCTION: Function functionCall = expression.getFunctionCall(); String functionName = functionCall.getOperator(); if (FunctionDefinitionRegistry.isAggFunc(functionName)) { AggregationInfo aggInfo = buildAggregationInfo(functionCall); if (aggregationInfoList == null) { aggregationInfoList = new ArrayList<>(); } aggregationInfoList.add(aggInfo); } else { if (selection == null) { selection = new Selection(); } selection.addToSelectionColumns(ParserUtils.standardizeExpression(expression, false)); } break; } } if (aggregationInfoList != null && aggregationInfoList.size() > 0) { brokerRequest.setAggregationsInfo(aggregationInfoList); } else if (selection != null) { if (pinotQuery.isSetOffset()) { selection.setOffset(pinotQuery.getOffset()); } if (pinotQuery.isSetLimit()) { selection.setSize(pinotQuery.getLimit()); } brokerRequest.setSelections(selection); } }