/*
 * 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.geode.cache.query;

import static org.apache.geode.cache.Region.SEPARATOR;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.io.FileUtils;

import org.apache.geode.LogWriter;
import org.apache.geode.cache.AttributesFactory;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheException;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.ExpirationAttributes;
import org.apache.geode.cache.PartitionAttributesFactory;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.RegionFactory;
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache30.CacheSerializableRunnable;
import org.apache.geode.test.dunit.SerializableRunnable;
import org.apache.geode.test.dunit.VM;

/**
 * Utility class for testing supported queries
 */
public class QueryTestUtils implements Serializable {

  private static Cache cache;

  public HashMap<String, String> queries;

  public HashMap<String, String> bindQueries;

  private static final QueryTestUtils instance = new QueryTestUtils();

  public static QueryTestUtils getInstance() {
    return instance;
  }

  public QueryTestUtils() {
    queries = new HashMap<>();
    bindQueries = new HashMap<>();
    initializeQueryMap();
    initializeBindQueryMap();
  }

  public void initializeBindQueryMap() {
    // BIND QUERIES
    bindQueries.put("1", "$1 AND $2");
    bindQueries.put("2", "$1 IN $2");
    bindQueries.put("3", "$1 IN $3");
    bindQueries.put("4", "$1 IN SET(1, 'a', $2, $3, $4, $5)");
    bindQueries.put("5", "$1 OR $2");
    bindQueries.put("6", "$1[$2]");
    bindQueries.put("7", "$1[0][0]");
    bindQueries.put("8", "$3 IN $2");
    bindQueries.put("9", "(SELECT DISTINCT * FROM " + SEPARATOR + "root" + SEPARATOR
        + "exampleRegion WHERE ID < $1).size");
    bindQueries.put("10", SEPARATOR + "exampleRegion.containsValue($1)");
    bindQueries.put("11",
        "IMPORT org.apache.geode.cache.\"query\".data.Student;IMPORT org.apache.geode.cache.\"query\".data.Student$Subject;Select distinct * from  $1 as it1 ,  it1.subjects  type Student$Subject  where subject='Hindi'");
    bindQueries.put("12",
        "IMPORT org.apache.geode.cache.\"query\".data.Student;IMPORT org.apache.geode.cache.\"query\".data.Student$Subject;Select distinct * from  $1 as it1 ,  it1.subjects x  type Student$Subject  where x.subject='Hindi'");
    bindQueries.put("13",
        "IMPORT org.apache.geode.cache.\"query\".data.Student;IMPORT org.apache.geode.cache.\"query\".data.Student$Subject;Select distinct * from  $1 as it1 , (list<Student$Subject>) it1.subjects   where subject='Hindi'");
    bindQueries.put("14",
        "IMPORT org.apache.geode.cache.\"query\".data.Student;IMPORT org.apache.geode.cache.\"query\".data.Student$Teacher;Select distinct * from  $1 as it1 ,  it1.teachers  type Student$Teacher  where teacher='Y'");
    bindQueries.put("15",
        "IMPORT org.apache.geode.cache.\"query\".data.Student;IMPORT org.apache.geode.cache.\"query\".data.Student$Teacher;Select distinct * from  $1 as it1 ,  it1.teachers x  type Student$Teacher  where x.teacher='Y'");
    bindQueries.put("16",
        "IMPORT org.apache.geode.cache.\"query\".data.Student;IMPORT org.apache.geode.cache.\"query\".data.Student$Teacher;Select distinct * from  $1 as it1 , (list<Student$Teacher>) it1.teachers  where teacher='Y'");
    bindQueries.put("17", "IS_DEFINED($1)");
    bindQueries.put("18", "IS_UNDEFINED($1)");
    bindQueries.put("19", "NOT $1");
    bindQueries.put("20", "NOT $2");
    bindQueries.put("21", "NOT $3");
    bindQueries.put("22", "NOT $4");
    bindQueries.put("23",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion1 pf1 where pf1.ID != $1 limit 10");
    bindQueries.put("24",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion1 pf1 where pf1.ID != $1 order by ID");
    bindQueries.put("25", "SELECT * FROM " + SEPARATOR + "exampleRegion pf WHERE pf = $1");
    bindQueries.put("26", "SELECT * FROM " + SEPARATOR + "exampleRegion pf WHERE pf > $1");
    bindQueries.put("27", "SELECT * FROM " + SEPARATOR + "exampleRegion.keys k WHERE k.ID = $1");
    bindQueries.put("28",
        "SELECT * FROM " + SEPARATOR + "exampleRegion.keys key WHERE key.ID > $1");
    bindQueries.put("29", "SELECT * FROM " + SEPARATOR + "exampleRegion.values pf WHERE pf < $1");
    bindQueries.put("30", "SELECT * FROM " + SEPARATOR + "root" + SEPARATOR
        + "exampleRegion WHERE ID < $1 and Ticker = $2");
    bindQueries.put("31", "SELECT * FROM " + SEPARATOR + "root" + SEPARATOR
        + "exampleRegion WHERE ID = $1 and Ticker = $2");
    bindQueries.put("32", "SELECT DISTINCT * FROM $1 z where z.status = 'active'");
    bindQueries.put("33",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion WHERE ID < $1 ORDER BY $2");
    bindQueries.put("34", "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion where ID = $1");
    bindQueries.put("35",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion where status = $1");
    bindQueries.put("36",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion where status.equals($1)");
    bindQueries.put("37", "SELECT DISTINCT * FROM " + SEPARATOR + "root" + SEPARATOR
        + "exampleRegion WHERE ID < $1 ORDER BY $2");
    bindQueries.put("38", "SELECT DISTINCT * FROM " + SEPARATOR + "root" + SEPARATOR
        + "exampleRegion WHERE ID < $1 ORDER BY ID");
    bindQueries.put("39", "SELECT DISTINCT booleanValue from $1 TYPE boolean");
    bindQueries.put("40", "SELECT DISTINCT booleanValue from (set<boolean>) $1");
    bindQueries.put("41", "SELECT DISTINCT byteValue from $1 TYPE byte");
    bindQueries.put("42", "SELECT DISTINCT byteValue from (set<byte>) $1");
    bindQueries.put("43", "SELECT DISTINCT charValue from $1 TYPE char");
    bindQueries.put("44", "SELECT DISTINCT charValue from (set<char>) $1");
    bindQueries.put("45", "SELECT DISTINCT doubleValue from $1 TYPE double");
    bindQueries.put("46", "SELECT DISTINCT doubleValue from (set<double>) $1");
    bindQueries.put("47", "SELECT DISTINCT floatValue from $1 TYPE float");
    bindQueries.put("48", "SELECT DISTINCT floatValue from (set<float>) $1");
    bindQueries.put("49", "SELECT DISTINCT intern from $1 TYPE string");
    bindQueries.put("50", "SELECT DISTINCT intern from (set<string>) $1");
    bindQueries.put("51", "SELECT DISTINCT longValue from $1 TYPE long");
    bindQueries.put("52", "SELECT DISTINCT longValue from (set<long>) $1");
    bindQueries.put("53", "SELECT DISTINCT shortValue from $1 TYPE short");
    bindQueries.put("54", "SELECT DISTINCT shortValue from (set<short>) $1");
    bindQueries.put("55",
        "SELECT ID, status FROM " + SEPARATOR + "exampleRegion.keys WHERE ID = $1");
    bindQueries.put("56",
        "SELECT distinct *  FROM " + SEPARATOR
            + "exampleRegion ps WHERE ps.status like $1 AND ps.ID > 2 AND ps.ID < 150");
    bindQueries.put("57",
        "SELECT distinct *  FROM " + SEPARATOR + "exampleRegion ps WHERE ps.status like $1");
    bindQueries.put("58",
        "SELECT e.key, e.value FROM " + SEPARATOR + "exampleRegion.entrySet e WHERE e.key IN $1");
    bindQueries.put("59",
        "SELECT e.value FROM " + SEPARATOR + "exampleRegion.entrySet e WHERE e.key IN $1");
    bindQueries.put("60",
        "SELECT itr.value FROM " + SEPARATOR + "root" + SEPARATOR
            + "exampleRegion.entries itr where itr.key = $1");
    bindQueries.put("61",
        "SELECT k.ID, k.status FROM " + SEPARATOR
            + "exampleRegion.keys k WHERE k.ID = $1 and k.status = $2");
    bindQueries.put("62",
        "SELECT key.ID FROM " + SEPARATOR + "exampleRegion.keys key WHERE key.ID = $1");
    bindQueries.put("63",
        "Select distinct * from " + SEPARATOR
            + "exampleRegion.keys keys where keys.hashCode >= $1");
    bindQueries.put("64", "Select distinct intValue from $1 TYPE int");
    bindQueries.put("65", "Select distinct intValue from (array<int>) $1");
    bindQueries.put("66", "Select distinct intValue from (list<int>) $1");
    bindQueries.put("67",
        "Select distinct keys.hashCode  from " + SEPARATOR
            + "exampleRegion.keys() keys where keys.hashCode >= $1");
    bindQueries.put("68",
        "Select distinct value.secId from " + SEPARATOR + "exampleRegion , getPositions($1)");
    bindQueries.put("69",
        "import org.apache.geode.cache.\"query\".data.Position;select distinct * from $1 r, r.positions.values pVal TYPE Position where r.status = 'active' AND pVal.mktValue >= 25.00");
    bindQueries.put("70",
        "import org.apache.geode.cache.\"query\".data.Position;select distinct r from $1 r, r.positions.values pVal TYPE Position where pVal.mktValue < $2");
    bindQueries.put("71",
        "import org.apache.geode.cache.\"query\".data.Position;select distinct r.ID, status, mktValue from $1 r, r.positions.values pVal TYPE Position where r.status = 'active' AND pVal.mktValue >= 25.00");
    bindQueries.put("72",
        "import java.util.Map$Entry as Entry;select distinct value.secId from " + SEPARATOR
            + "exampleRegion, getPositions(23) type Entry");
    bindQueries.put("73", "select * from $1");
    bindQueries.put("74", "select ALL * from $1");
    bindQueries.put("75", "select distinct * from $1 where status = 'active'");
    bindQueries.put("76", "select distinct * from $1");
    bindQueries.put("77",
        "select distinct * from " + SEPARATOR + "exampleRegion pf where pf.getCW(pf.ID) != $1");
    bindQueries.put("78",
        "select distinct * from " + SEPARATOR + "exampleRegion pf where pf.getCW(pf.ID) < $1");
    bindQueries.put("79",
        "select distinct * from " + SEPARATOR + "exampleRegion pf where pf.getCW(pf.ID) > $1");
    bindQueries.put("80", "select distinct * from " + SEPARATOR + "root" + SEPARATOR
        + "exampleRegion where ticker = $1");
    bindQueries.put("81", "select p from " + SEPARATOR + "exampleRegion.values p where p like $1");
    bindQueries.put("82", "select p.positions.get('acc') from $1 p");
  }

  public void initializeQueryMap() {
    queries.put("1",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion WHERE status = 'active'");
    queries.put("2", "SELECT * FROM " + SEPARATOR
        + "exampleRegion WHERE \"type\" = 'type1' and status = 'active'");
    queries.put("3",
        "SELECT key, positions FROM " + SEPARATOR
            + "exampleRegion.entrySet, value.positions.values positions WHERE positions.mktValue >= 25.00");
    queries.put("4",
        "SELECT DISTINCT entry.value FROM " + SEPARATOR
            + "exampleRegion.entries entry WHERE entry.key = '1'");
    queries.put("5",
        "SELECT * FROM " + SEPARATOR + "exampleRegion.entries entry WHERE entry.value.ID > 1");
    queries.put("6", "SELECT entry.value FROM " + SEPARATOR
        + "exampleRegion.entries entry WHERE entry.key = '1'");
    queries.put("7", "SELECT * FROM " + SEPARATOR + "exampleRegion.keySet key WHERE key = '1'");
    queries.put("8",
        "SELECT * FROM " + SEPARATOR
            + "exampleRegion.values portfolio WHERE portfolio.status = 'active'");
    queries.put("9",
        "SELECT entry.key, entry.value FROM " + SEPARATOR
            + "exampleRegion.entries entry WHERE entry.value['version'] = '100'");
    queries.put("10",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion WHERE ID < 101 ORDER BY ID");
    queries.put("11",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion WHERE ID < 101 ORDER BY ID asc");
    queries.put("12",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion WHERE ID < 101 ORDER BY ID desc");
    queries.put("13",
        "SELECT * FROM " + SEPARATOR + "exampleRegion p WHERE p.status LIKE 'active'");
    queries.put("14",
        "SELECT * FROM " + SEPARATOR + "exampleRegion p WHERE p.status LIKE 'activ%'");
    queries.put("15",
        "SELECT * FROM " + SEPARATOR
            + "exampleRegion p, p.positions.values AS pos WHERE pos.secId != '1'");
    queries.put("16", "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion WHERE TRUE");
    queries.put("17",
        "SELECT * FROM " + SEPARATOR + "exampleRegion portfolio WHERE portfolio.ID IN SET(1, 2)");
    queries.put("18",
        "SELECT * FROM " + SEPARATOR
            + "exampleRegion portfolio, portfolio.positions.values positions WHERE portfolio.Pk IN SET ('1', '2') AND positions.secId = '1'");
    queries.put("19",
        "SELECT * FROM " + SEPARATOR
            + "exampleRegion portfolio, portfolio.positions.values positions WHERE portfolio.Pk IN SET ('1', '2') OR positions.secId IN SET ('1', '2', '3')");
    queries.put("20",
        "SELECT * FROM " + SEPARATOR
            + "exampleRegion portfolio, portfolio.positions.values positions WHERE portfolio.Pk IN SET ('1', '2') OR positions.secId IN SET ('1', '2', '3') and portfolio.status = 'active'");
    queries.put("21",
        "SELECT * FROM " + SEPARATOR + "exampleRegion portfolio WHERE portfolio.ID <> 2");
    queries.put("22",
        "SELECT * FROM " + SEPARATOR + "exampleRegion portfolio WHERE portfolio.ID != 2");
    queries.put("23", "(SELECT * FROM " + SEPARATOR + "exampleRegion).size");
    queries.put("24", "(SELECT * FROM " + SEPARATOR + "exampleRegion p WHERE p.ID = 1).size");
    queries.put("25", "SELECT * FROM " + SEPARATOR + "exampleRegion p WHERE p.status.length > 1");
    queries.put("26",
        "select * from " + SEPARATOR + "exampleRegion sp where sp = set ('20', '21', '22')");
    queries.put("27",
        "select * from " + SEPARATOR
            + "exampleRegion sp where sp.containsAll(set('20', '21', '22'))");
    queries.put("28",
        "select * from " + SEPARATOR
            + "exampleRegion sp where sp IN SET (set('20', '21', '22'), set('10', '11', '12'))");
    queries.put("29",
        "select distinct r.name, pVal, r.\"type\"   from " + SEPARATOR
            + "exampleRegion r , r.positions.values pVal where  ( r.name IN Set('name_11' , 'name_12') OR false ) AND pVal.mktValue = 1.00");
    queries.put("30",
        "select distinct r.name, pVal, r.\"type\"   from " + SEPARATOR
            + "exampleRegion r , r.positions.values pVal where  ( r.undefinedTestField.toString = UNDEFINED  AND true ) AND pVal.mktValue = 1.00");
    queries.put("31",
        "select distinct r.name, pVal, r.\"type\"   from " + SEPARATOR
            + "exampleRegion r , r.positions.values pVal where  ( r.undefinedTestField.toString = UNDEFINED  OR false )");
    queries.put("32",
        "select distinct r.name, pVal, r.\"type\"   from " + SEPARATOR
            + "exampleRegion r , r.positions.values pVal where  (r.name='name_11' OR r.name='name_12') AND pVal.mktValue >=1.00");
    queries.put("33", "(select distinct * from " + SEPARATOR + "exampleRegion).size");
    queries.put("34", SEPARATOR + "exampleRegion.fullPath");
    queries.put("35", SEPARATOR + "exampleRegion.size > 0");
    queries.put("36", SEPARATOR + "exampleRegion.size");
    queries.put("37", "2 IN SET(1,2,3)");
    queries.put("38",
        "IMPORT org.apache.geode.cache.\"query\".data.Manager;SELECT DISTINCT manager_id FROM (set<Manager>)"
            + SEPARATOR + "exampleRegion where empId > 0");
    queries.put("39",
        "IMPORT org.apache.geode.cache.\"query\".data.Portfolio; SELECT DISTINCT * FROM (set<Portfolio>)"
            + SEPARATOR + "exampleRegion where iD > 0");
    queries.put("40",
        "IMPORT org.apache.geode.cache.\"query\".data.Position;IMPORT org.apache.geode.cache.\"query\".data.Portfolio;SELECT DISTINCT secId FROM (set<Portfolio>)"
            + SEPARATOR + "exampleRegion, (set<Position>)positions.values WHERE iD > 0");
    queries.put("41",
        "IMPORT org.apache.geode.cache.\"query\".data.Position;SELECT DISTINCT pos.secId FROM "
            + SEPARATOR + "exampleRegion, pos IN positions.values TYPE Position WHERE iD > 0");
    queries.put("42",
        "IMPORT org.apache.geode.cache.\"query\".data.Position;SELECT DISTINCT secId FROM "
            + SEPARATOR + "exampleRegion,  positions.values pos TYPE Position WHERE iD > 0");
    queries.put("43",
        "IMPORT org.apache.geode.cache.\"query\".data.Position;SELECT DISTINCT secId FROM "
            + SEPARATOR + "exampleRegion, (set<Position>)positions.values WHERE iD > 0");
    queries.put("44",
        "IMPORT org.apache.geode.cache.\"query\".data.Position;SELECT DISTINCT secId FROM "
            + SEPARATOR + "exampleRegion, positions.values AS pos TYPE Position WHERE iD > 0");
    queries.put("45",
        "SELECT   DISTINCT iD as portfolio_id, pos.secId as sec_id from " + SEPARATOR
            + "exampleRegion p , p.positions.values pos  where p.status= 'active'");
    queries.put("46", "SELECT  distinct * FROM " + SEPARATOR + "exampleRegion order by pkid desc");
    queries.put("47",
        "SELECT  distinct * FROM " + SEPARATOR + "exampleRegion pf1  order by pkid asc");
    queries.put("48", "SELECT  distinct * FROM " + SEPARATOR + "exampleRegion pf1 order by pkid");
    queries.put("49",
        "SELECT  distinct * FROM " + SEPARATOR
            + "exampleRegion pf1 where ID != 10 order by ID asc, pkid asc limit 10");
    queries.put("50", "SELECT  distinct * FROM " + SEPARATOR
        + "exampleRegion pf1 where ID != 10 order by ID desc");
    queries.put("51",
        "SELECT  distinct * FROM " + SEPARATOR
            + "exampleRegion pf1 where ID != 10 order by ID desc, pkid desc limit 10");
    queries.put("52", "SELECT  distinct * FROM " + SEPARATOR
        + "exampleRegion pf1 where ID > 0 order by pkid asc");
    queries.put("53",
        "SELECT  distinct * FROM " + SEPARATOR + "exampleRegion pf1 where ID > 0 order by pkid");
    queries.put("54",
        "SELECT  distinct * FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 10 and ID < 20 order by ID asc, pkid asc limit 5");
    queries.put("55",
        "SELECT  distinct * FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 10 and ID < 20 order by ID desc");
    queries.put("56",
        "SELECT  distinct * FROM " + SEPARATOR
            + "exampleRegion pf1 where pkid < '7' and ID > 10 and ID < 20 order by ID asc, pkid asc limit 5");
    queries.put("57",
        "SELECT  distinct * FROM " + SEPARATOR
            + "exampleRegion pf1 where pkid > '1' and pkid <='9' and ID >= 10 and ID <= 20 order by ID asc, pkid asc");
    queries.put("58",
        "SELECT  distinct * FROM " + SEPARATOR
            + "exampleRegion pf1 where pkid > '17' and ID > 10 order by ID asc, pkid desc limit 5");
    queries.put("59",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 10 and ID < 20 order by ID desc, pkid asc limit 5");
    queries.put("60",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 10 order by ID desc limit 5");
    queries.put("61",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 10 order by ID desc, pkid desc limit 5");
    queries.put("62",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 10 order by ID desc, pkid desc");
    queries.put("63",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where ID >= 10 and ID <= 20 order by ID asc, pkid desc");
    queries.put("64",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where ID >= 10 and ID <= 20 order by ID desc limit 5");
    queries.put("65",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where ID >= 10 and ID <= 20 order by ID desc");
    queries.put("66",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where ID >= 10 and ID <= 20 order by ID desc, pkid desc limit 5");
    queries.put("67",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where pf1.ID != '10' order by ID desc limit 5");
    queries.put("68",
        "SELECT  distinct ID, description, createTime FROM " + SEPARATOR
            + "exampleRegion pf1 where pkid > 'a' and ID >= 10 and ID <= 20 order by ID desc, pkid asc limit 5");
    queries.put("69",
        "SELECT  distinct ID, pkid FROM " + SEPARATOR
            + "exampleRegion pf1 where ID < 1000 order by pkid");
    queries.put("70",
        "SELECT  distinct ID, pkid FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 0 order by pkid");
    queries.put("71",
        "SELECT  distinct ID, pkid FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 0 order by pkid, ID asc");
    queries.put("72",
        "SELECT  distinct ID, pkid FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 0 order by pkid, ID desc");
    queries.put("73",
        "SELECT  distinct pkid FROM " + SEPARATOR + "exampleRegion pf1 order by pkid");
    queries.put("74",
        "SELECT  distinct pkid FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 0 order by pkid asc");
    queries.put("75",
        "SELECT  distinct pkid FROM " + SEPARATOR
            + "exampleRegion pf1 where ID > 0 order by pkid desc");
    queries.put("76",
        "SELECT  distinct pkid FROM " + SEPARATOR + "exampleRegion pf1 where ID > 0 order by pkid");
    queries.put("77",
        "SELECT  distinct pkid FROM " + SEPARATOR
            + "exampleRegion pf1 where pkid != 'XXXX' order by pkid asc");
    queries.put("78",
        "SELECT  distinct pkid FROM " + SEPARATOR
            + "exampleRegion pf1 where pkid != 'XXXX' order by pkid desc");
    queries.put("79", "SELECT * FROM " + SEPARATOR + "exampleRegion p where p.intVar < 9");
    queries.put("80", "SELECT * FROM " + SEPARATOR + "exampleRegion pf WHERE pf = 'XX1'");
    queries.put("81",
        "SELECT * FROM " + SEPARATOR + "exampleRegion pf WHERE pf IN SET( 'XX5', 'XX6', 'XX7')");
    queries.put("82", "SELECT * FROM " + SEPARATOR + "exampleRegion");
    queries.put("83", "SELECT * FROM " + SEPARATOR + "exampleRegion.keys k WHERE k.ID = 1");
    queries.put("84", "SELECT * FROM " + SEPARATOR + "exampleRegion.keys key WHERE key.ID = 1");
    queries.put("85", "SELECT * FROM " + SEPARATOR + "exampleRegion.keys key WHERE key.ID > 5");
    queries.put("86",
        "SELECT * FROM " + SEPARATOR
            + "exampleRegion.values pf WHERE pf IN SET( 'XX5', 'XX6', 'XX7')");
    queries.put("87", "SELECT * from " + SEPARATOR + "exampleRegion");
    queries.put("88", "SELECT ALL * FROM " + SEPARATOR + "exampleRegion");
    queries.put("89",
        "SELECT DISTINCT  q.cusip, q.quoteType, q.dealerPortfolio, q.channelName, q.dealerCode, q.priceType, q.price, q.lowerQty, q.upperQty, q.ytm, r.minQty, r.maxQty, r.incQty FROM "
            + SEPARATOR + "exampleRegion q, " + SEPARATOR
            + "exampleRegion r WHERE q.cusip = r.cusip AND q.quoteType = r.quoteType");
    queries.put("90",
        "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion AS ptf, positions AS pos) WHERE pos.value.secId = 'IBM'");
    queries.put("91",
        "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion ptf, positions pos) WHERE pos.value.secId = 'IBM'");
    queries.put("92",
        "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion ptf, positions pos) p WHERE p.get('pos').value.secId = 'IBM'");
    queries.put("93",
        "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion ptf, positions pos) p WHERE p.pos.value.secId = 'IBM'");
    queries.put("94",
        "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion ptf, positions pos) p WHERE pos.value.secId = 'IBM'");
    queries.put("95",
        "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion, positions) WHERE positions.value.secId = 'IBM'");
    queries.put("96",
        "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion, positions) p WHERE p.positions.value.secId = 'IBM'");
    queries.put("97",
        "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM ptf IN " + SEPARATOR
            + "exampleRegion, pos IN positions) WHERE pos.value.secId = 'IBM'");
    queries.put("98",
        "SELECT DISTINCT * FROM (SELECT DISTINCT pos AS myPos FROM " + SEPARATOR
            + "exampleRegion ptf, positions pos) WHERE myPos.value.secId = 'IBM'");
    queries.put("99",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion  pf WHERE pf.ID > 10 limit 5");
    queries.put("100",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion  pf, pf.collectionHolderMap.keySet  WHERE pf.ID > 10 limit 20");
    queries.put("101",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion WHERE NOT(SELECT DISTINCT * FROM positions.values p WHERE p.secId = 'IBM').isEmpty");
    queries.put("102",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion as a, a.collectionHolderMap['0'].arr as b where a.status = 'active' and a.ID = 0");
    queries.put("103",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion c WHERE c.name = 'INDIA'");
    queries.put("104",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion c, c.states s, s.districts d WHERE d.name = 'PUNEDIST' AND s.name = 'GUJARAT'");
    queries.put("105",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion c, c.states s, s.districts d, d.cities ct WHERE ct.name = 'MUMBAI'");
    queries.put("106",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion c, c.states s, s.districts d, d.cities ct, d.villages v WHERE c.name = 'INDIA'");
    queries.put("107",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion c, c.states s, s.districts d, d.villages v, d.cities ct WHERE ct.name = 'PUNE' AND s.name = 'MAHARASHTRA'");
    queries.put("108",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion c, c.states s, s.districts d, d.villages v, d.cities ct WHERE v.name = 'MAHARASHTRA_VILLAGE1'");
    queries.put("109",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion c, c.states s, s.districts d, d.villages v, d.cities ct WHERE v.name='MAHARASHTRA_VILLAGE1' AND ct.name = 'PUNE'");
    queries.put("110",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion itr1  WHERE itr1.liist[0] >= 2");
    queries.put("111",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion itr1  WHERE itr1.maap.get('key2') >= 16");
    queries.put("112",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion itr1  WHERE itr1.maap.get('key2') >= 3");
    queries.put("113", "SELECT DISTINCT * FROM " + SEPARATOR
        + "exampleRegion itr1  WHERE itr1.maap['key2'] >= 16");
    queries.put("114",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion itr1  WHERE itr1.maap['key2'] >= 3  and  itr1.maap['key3'] < 18");
    queries.put("115",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion itr1  WHERE itr1.maap['key2'] >= 3 and itr1.maap['key2'] <=18");
    queries.put("116",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion itr1  WHERE itr1.maap['key2'] >= 3");
    queries.put("117",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion itr1  WHERE itr1.maap['key3'] >= 3  and  itr1.maap['key3'] >= 13");
    queries.put("118",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion itr1  WHERE itr1.maap['key3'] >= 3");
    queries.put("119", "SELECT DISTINCT * FROM " + SEPARATOR
        + "exampleRegion itr1  WHERE itr1.maap['key4'] >= 16");
    queries.put("120",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion num WHERE num.id1 >= -200");
    queries.put("121",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion p  WHERE p.ID <= 10 order by p.ID asc limit 1");
    queries.put("122",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion p  WHERE p.ID <= 10 order by p.ID desc limit 1");
    queries.put("123",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion p  WHERE p.ID <= 10 order by p.pkid desc limit 1");
    queries.put("124",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion pf WHERE pf.ID > 0 limit 5");
    queries.put("125",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf where pf.description = 'XXXX'  and pf.status='active' and pf.createTime = 5");
    queries.put("126",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf where pf.description = 'XXXX'  and pf.status='active'");
    queries.put("127",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf,  positions.values pos where pf.ID > 0 and pf.ID < 250  and pf.status='active' and  pos.secId != null");
    queries.put("128",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf,  positions.values pos where pf.status='active' and pos.secId= 'IBM' and pf.ID = 0");
    queries.put("129",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion pf, " + SEPARATOR
            + "exampleRegion emp WHERE pf.ID = emp.empId");
    queries.put("130",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion pf, pf.positions pos, " + SEPARATOR
            + "exampleRegion emp WHERE pf.iD = emp.empId and pf.status='active' and emp.age > 900");
    queries.put("131",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion pf, pf.positions pos, " + SEPARATOR
            + "exampleRegion emp WHERE pf.iD = emp.empId");
    queries.put("132",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf, pf.positions.values WHERE pf.ID > 0 limit 5");
    queries.put("133",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf, pf.positions.values position WHERE (pf.ID > 0 OR position.secId = 'SUN') OR false");
    queries.put("134",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf, pf.positions.values position WHERE (true = null OR position.secId = 'SUN') AND true");
    queries.put("135",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf, pf.positions.values position WHERE (true = null OR position.secId = 'SUN') OR true");
    queries.put("136",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion pf, pf.positions.values position WHERE true = null OR position.secId = 'SUN'");
    queries.put("137",
        "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion value  where value.length > 6");
    queries.put("138", "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion value");
    queries.put("139",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion where (status = 'active' OR ID = 2) AND P1.secId  = 'IBM'");
    queries.put("140", "SELECT DISTINCT * FROM " + SEPARATOR + "exampleRegion where FALSE");
    queries.put("141",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion where NOT (status = 'active') AND ID = 2");
    queries.put("142",
        "SELECT DISTINCT * FROM " + SEPARATOR
            + "exampleRegion where NOT (status = 'active') OR ID = 2");
