Search in sources :

Example 1 with QuerySource

use of com.linkedin.pinot.common.request.QuerySource in project pinot by linkedin.

the class InstanceServerStarter method sendQueryToQueryExecutor.

private static void sendQueryToQueryExecutor(BrokerRequest brokerRequest, QueryExecutor queryExecutor, QueryScheduler queryScheduler, ServerMetrics metrics) {
    QuerySource querySource = new QuerySource();
    querySource.setTableName("midas");
    brokerRequest.setQuerySource(querySource);
    InstanceRequest instanceRequest = new InstanceRequest(0, brokerRequest);
    try {
        QueryRequest queryRequest = new QueryRequest(instanceRequest, metrics);
        DataTable instanceResponse = queryExecutor.processQuery(queryRequest, queryScheduler.getWorkerExecutorService());
        System.out.println(instanceResponse.toString());
        System.out.println("Query Time Used : " + instanceResponse.getMetadata().get(DataTable.TIME_USED_MS_METADATA_KEY));
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : DataTable(com.linkedin.pinot.common.utils.DataTable) QueryRequest(com.linkedin.pinot.common.query.QueryRequest) QuerySource(com.linkedin.pinot.common.request.QuerySource) InstanceRequest(com.linkedin.pinot.common.request.InstanceRequest)

Example 2 with QuerySource

use of com.linkedin.pinot.common.request.QuerySource in project pinot by linkedin.

the class IntegrationTest method testCountQuery.

@Test
public void testCountQuery() {
    BrokerRequest brokerRequest = getCountQuery();
    QuerySource querySource = new QuerySource();
    querySource.setTableName("testTable");
    brokerRequest.setQuerySource(querySource);
    InstanceRequest instanceRequest = new InstanceRequest(0, brokerRequest);
    addTestTableSearchSegmentsToInstanceRequest(instanceRequest);
    try {
        QueryRequest queryRequest = new QueryRequest(instanceRequest, _serverInstance.getServerMetrics());
        DataTable instanceResponse = _queryExecutor.processQuery(queryRequest, queryRunners);
    //      System.out.println(instanceResponse.getLong(0, 0));
    //      System.out.println(instanceResponse.getMetadata().get(DataTable.TIME_USED_MS_METADATA_KEY));
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : DataTable(com.linkedin.pinot.common.utils.DataTable) QueryRequest(com.linkedin.pinot.common.query.QueryRequest) QuerySource(com.linkedin.pinot.common.request.QuerySource) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) InstanceRequest(com.linkedin.pinot.common.request.InstanceRequest) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 3 with QuerySource

use of com.linkedin.pinot.common.request.QuerySource in project pinot by linkedin.

the class IntegrationTest method testWvmpQuery.

@Test
public void testWvmpQuery() {
    BrokerRequest brokerRequest = getCountQuery();
    brokerRequest.setFilterQuery(null);
    brokerRequest.setFilterQueryIsSet(false);
    QuerySource querySource = new QuerySource();
    querySource.setTableName("testTable");
    brokerRequest.setQuerySource(querySource);
    InstanceRequest instanceRequest = new InstanceRequest(0, brokerRequest);
    List<String> searchSegments = new ArrayList<String>();
    searchSegments.add("testTable_0_9_");
    instanceRequest.setSearchSegments(searchSegments);
    try {
        QueryRequest queryRequest = new QueryRequest(instanceRequest, _serverInstance.getServerMetrics());
        DataTable instanceResponse = _queryExecutor.processQuery(queryRequest, queryRunners);
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : DataTable(com.linkedin.pinot.common.utils.DataTable) QueryRequest(com.linkedin.pinot.common.query.QueryRequest) ArrayList(java.util.ArrayList) QuerySource(com.linkedin.pinot.common.request.QuerySource) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) InstanceRequest(com.linkedin.pinot.common.request.InstanceRequest) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 4 with QuerySource

use of com.linkedin.pinot.common.request.QuerySource in project pinot by linkedin.

the class IntegrationTest method testMinQuery.

@Test
public void testMinQuery() {
    BrokerRequest brokerRequest = getMinQuery();
    QuerySource querySource = new QuerySource();
    querySource.setTableName("testTable");
    brokerRequest.setQuerySource(querySource);
    InstanceRequest instanceRequest = new InstanceRequest(0, brokerRequest);
    addTestTableSearchSegmentsToInstanceRequest(instanceRequest);
    try {
        QueryRequest queryRequest = new QueryRequest(instanceRequest, _serverInstance.getServerMetrics());
        DataTable instanceResponse = _queryExecutor.processQuery(queryRequest, queryRunners);
    //      System.out.println(instanceResponse.getDouble(0, 0));
    //      System.out.println(instanceResponse.getMetadata().get(DataTable.TIME_USED_MS_METADATA_KEY));
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : DataTable(com.linkedin.pinot.common.utils.DataTable) QueryRequest(com.linkedin.pinot.common.query.QueryRequest) QuerySource(com.linkedin.pinot.common.request.QuerySource) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) InstanceRequest(com.linkedin.pinot.common.request.InstanceRequest) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Example 5 with QuerySource

use of com.linkedin.pinot.common.request.QuerySource in project pinot by linkedin.

the class IntegrationTest method testSumQuery.

@Test
public void testSumQuery() {
    BrokerRequest brokerRequest = getSumQuery();
    QuerySource querySource = new QuerySource();
    querySource.setTableName("testTable");
    brokerRequest.setQuerySource(querySource);
    InstanceRequest instanceRequest = new InstanceRequest(0, brokerRequest);
    addTestTableSearchSegmentsToInstanceRequest(instanceRequest);
    try {
        QueryRequest queryRequest = new QueryRequest(instanceRequest, _serverInstance.getServerMetrics());
        DataTable instanceResponse = _queryExecutor.processQuery(queryRequest, queryRunners);
    //      System.out.println(instanceResponse.getDouble(0, 0));
    //      System.out.println(instanceResponse.getMetadata().get(DataTable.TIME_USED_MS_METADATA_KEY));
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : DataTable(com.linkedin.pinot.common.utils.DataTable) QueryRequest(com.linkedin.pinot.common.query.QueryRequest) QuerySource(com.linkedin.pinot.common.request.QuerySource) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) InstanceRequest(com.linkedin.pinot.common.request.InstanceRequest) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) AfterTest(org.testng.annotations.AfterTest)

Aggregations

QuerySource (com.linkedin.pinot.common.request.QuerySource)20 QueryRequest (com.linkedin.pinot.common.query.QueryRequest)18 BrokerRequest (com.linkedin.pinot.common.request.BrokerRequest)18 InstanceRequest (com.linkedin.pinot.common.request.InstanceRequest)18 DataTable (com.linkedin.pinot.common.utils.DataTable)18 Test (org.testng.annotations.Test)18 IndexSegment (com.linkedin.pinot.core.indexsegment.IndexSegment)12 ServerInstance (com.linkedin.pinot.common.response.ServerInstance)8 BrokerResponseNative (com.linkedin.pinot.common.response.broker.BrokerResponseNative)8 HashMap (java.util.HashMap)8 AggregationResult (com.linkedin.pinot.common.response.broker.AggregationResult)5 AfterTest (org.testng.annotations.AfterTest)5 BeforeTest (org.testng.annotations.BeforeTest)5 GroupBy (com.linkedin.pinot.common.request.GroupBy)2 Selection (com.linkedin.pinot.common.request.Selection)2 ArrayList (java.util.ArrayList)2 AggregationInfo (com.linkedin.pinot.common.request.AggregationInfo)1 FilterQuery (com.linkedin.pinot.common.request.FilterQuery)1 FilterQueryMap (com.linkedin.pinot.common.request.FilterQueryMap)1 QueryType (com.linkedin.pinot.common.request.QueryType)1