Package com.linkedin.helix.josql

Examples of com.linkedin.helix.josql.DataAccessorBasedTupleReader


  //@Test
  public void testClusterQuery() throws Exception
  {
    HelixManager manager = ((TestHelper.StartCMResult) (_startCMResultMap.values().toArray()[0]))._manager;

    DataAccessorBasedTupleReader tupleReader = new DataAccessorBasedTupleReader(manager.getHelixDataAccessor(), manager.getClusterName());

    ZNRecordQueryProcessor queryProcessor = new ZNRecordQueryProcessor();

    String partition = TEST_DB + "_4";
View Full Code Here


      Builder kb = accessor.keyBuilder();
      accessor.setProperty(kb.healthReport(instance, "scnTable"), new HealthStat(record));
    }

    String path = "INSTANCES/*/HEALTHREPORT/scnTable";
    DataAccessorBasedTupleReader tupleReader = new DataAccessorBasedTupleReader(accessor, manager.getClusterName());
    List<ZNRecord> tuples = tupleReader.get(path);
    System.out.println(tuples);
    Assert.assertEquals(tuples.size(), instancesInCluster.size());
  }
View Full Code Here

      Builder kb = accessor.keyBuilder();
      accessor.setProperty(kb.healthReport(instance, "scnTable"), new HealthStat(scnRecord));
    }

    ZNRecordQueryProcessor processor = new ZNRecordQueryProcessor();
    DataAccessorBasedTupleReader tupleReader = new DataAccessorBasedTupleReader(accessor, manager.getClusterName());

    String scnTableQuery = "SELECT T1.instance as instance, T1.mapField as partition, T1.gen as gen, T1.seq as seq " +
            "FROM explodeMap(`INSTANCES/*/HEALTHREPORT/scnTable`) AS T1" +
            " JOIN LIVEINSTANCES as T2 using (T1.instance, T2.id)";
    List<ZNRecord> scnTable = processor.execute(scnTableQuery, tupleReader);
    tupleReader.setTempTable("scnTable", scnTable);

    String rankQuery = "SELECT instance, partition, gen, seq, T1.listIndex AS instanceRank " +
            " FROM scnTable JOIN explodeList(`IDEALSTATES/" + TEST_DB + "`) AS T1 " +
                    "USING (scnTable.instance, T1.listVal) WHERE scnTable.partition=T1.listField";
    List<ZNRecord> rankTable = processor.execute(rankQuery, tupleReader);
    System.out.println(rankTable.size());
    tupleReader.setTempTable("rankTable", rankTable);

    String masterSelectionQuery = "SELECT instance, partition, instanceRank, gen, (T.maxSeq-seq) AS seqDiff, seq FROM rankTable JOIN " +
            " (SELECT partition, max(to_number(seq)) AS maxSeq FROM rankTable GROUP BY partition) AS T USING(rankTable.partition, T.partition) " +
            " WHERE to_number(seqDiff) < 10 " +
            " ORDER BY partition, to_number(gen) desc, to_number(instanceRank), to_number(seqDiff)";
View Full Code Here

TOP

Related Classes of com.linkedin.helix.josql.DataAccessorBasedTupleReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.