/**
 * Copyright (C) 2014-2015 LinkedIn Corp. (pinot-core@linkedin.com)
 *
 * Licensed 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 com.linkedin.pinot.integration.tests;

import java.util.List;
import org.json.JSONObject;
import org.testng.Assert;


/**
 * Integration test that converts avro data for 12 segments and runs queries against it.
 */
public class Pql2OfflineClusterIntegrationTest extends OfflineClusterIntegrationTest {
  @Override
  protected void runQuery(String pqlQuery, List<String> sqlQueries) throws Exception {
    JSONObject pql1Response = postQuery(pqlQuery, BROKER_BASE_API_URL, false);
    JSONObject pql2Response = postQuery(pqlQuery, BROKER_BASE_API_URL, true);
    Assert.assertEquals(pql2Response.getInt("numDocsScanned"), pql1Response.getInt("numDocsScanned"));
  }

  @Override
  protected String getHelixClusterName() {
    return "OfflineClusterIntegrationTest";
  }
}

@@ -744,208 +744,512 @@
 org.
-testng.Assert;%0A%0A%0A/**%0A * Integration test that converts avro data for 12 segments and runs queries against it.%0A */%0Apublic class Pql2OfflineClusterIntegrationTest extends OfflineClusterIntegrationTest %7B
+slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.testng.Assert;%0Aimport org.testng.annotations.Test;%0A%0A%0A/**%0A * Integration test that converts avro data for 12 segments and runs queries against it.%0A */%0A@Test(enabled = false) // jfim: This is disabled because the new parser exposes some bugs in the old one%0Apublic class Pql2OfflineClusterIntegrationTest extends OfflineClusterIntegrationTest %7B%0A  private static final Logger LOGGER = LoggerFactory.getLogger(Pql2OfflineClusterIntegrationTest.class);%0A
 %0A  @
@@ -1344,16 +1344,28 @@
 ption %7B%0A
+    try %7B%0A  
     JSON
@@ -1431,24 +1431,26 @@
 RL, false);%0A
+  
     JSONObje
@@ -1519,16 +1519,18 @@
 e);%0A    
+  
 Assert.a
@@ -1620,16 +1620,173 @@
 ned%22));%0A
+    %7D catch (AssertionError assertionError) %7B%0A      LOGGER.error(%22Num docs scanned did not match for query %7B%7D%22, pqlQuery);%0A      throw assertionError;%0A    %7D%0A
   %7D%0A%0A  @

Disable PQL2 integration test, as it fails in a limited set of conditions where the old query parser would incorrectly merge query predicates due to using lexicographic comparison instead of integer comparison (eg. WHERE TotalAddGTime BETWEEN '4' AND '103' AND TotalAddGTime BETWEEN '24' AND '30' or WHERE SecurityDelay BETWEEN '10' AND '15' AND SecurityDelay < '3')