kishoreg commented on a change in pull request #4216: PQL -> SQL enhancement - phase 1 - new Pinot Query Struct URL: https://github.com/apache/incubator-pinot/pull/4216#discussion_r292141084
########## File path: pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java ########## @@ -0,0 +1,362 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pinot.pql.parsers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.pinot.common.request.AggregationInfo; +import org.apache.pinot.common.request.BrokerRequest; +import org.apache.pinot.common.request.Expression; +import org.apache.pinot.common.request.ExpressionType; +import org.apache.pinot.common.request.FilterOperator; +import org.apache.pinot.common.request.FilterQuery; +import org.apache.pinot.common.request.FilterQueryMap; +import org.apache.pinot.common.request.Function; +import org.apache.pinot.common.request.GroupBy; +import org.apache.pinot.common.request.Literal; +import org.apache.pinot.common.request.PinotQuery; +import org.apache.pinot.common.request.QuerySource; +import org.apache.pinot.common.request.QueryType; +import org.apache.pinot.common.request.Selection; +import org.apache.pinot.common.request.SelectionSort; +import org.apache.pinot.pql.parsers.pql2.ast.FilterKind; + + +public class PinotQuery2BrokerRequestConverter { + + static Map<FilterKind, FilterOperator> filterOperatorMapping; + + public BrokerRequest convert(PinotQuery pinotQuery) { + BrokerRequest brokerRequest = new BrokerRequest(); + + //Query Source + QuerySource querySource = new QuerySource(); + querySource.setTableName(pinotQuery.getDataSource().getTableName()); + brokerRequest.setQuerySource(querySource); + + handleFilter(pinotQuery, brokerRequest); + + //Handle select list + handleSelectList(pinotQuery, brokerRequest); + + //Handle order by + handleOrderBy(pinotQuery, brokerRequest); + + //Handle group by + handleGroupBy(pinotQuery, brokerRequest); + + //Query Type + QueryType queryType = new QueryType(); Review comment: I was planning to delete it. We don't set this in the current parsing code. We derive the query type again in the Planning phase. I had to comment out the part where I see the queryType in brokerRequest. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org