Esempio n. 1
0
  public SeasonalAthlete getMostRecentSeasonalAthlete() {

    return Query.from(SeasonalAthlete.class)
        .where("athlete = ? && year <= ?", this, StatsUtils.determineSeason(new Date()))
        .sortDescending("year")
        .first();
  }
  @Test
  public void testIndexPattern() throws Exception {
    Properties props = HdpBootstrap.asProperties(CascadingHadoopSuite.configuration);

    Tap in = sourceTap();
    Tap out =
        new EsTap("cascading-hadoop/pattern-{id}", new Fields("id", "name", "url", "picture"));
    Pipe pipe = new Pipe("copy");
    StatsUtils.proxy(new HadoopFlowConnector(props).connect(in, out, pipe)).complete();
  }
  @Test
  public void testWriteToES() throws Exception {
    Tap in = sourceTap();
    Tap out = new EsTap("cascading-hadoop/artists", new Fields("name", "url", "picture"));
    Pipe pipe = new Pipe("copy");

    FlowDef flowDef = FlowDef.flowDef().addSource(pipe, in).addTailSink(pipe, out);
    StatsUtils.proxy(
            new HadoopFlowConnector(HdpBootstrap.asProperties(CascadingHadoopSuite.configuration))
                .connect(flowDef))
        .complete();
  }
  @Test
  public void testWriteToESWithAlias() throws Exception {
    Tap in = sourceTap();
    Tap out = new EsTap("cascading-hadoop/alias", "", new Fields("name", "url", "picture"));
    Pipe pipe = new Pipe("copy");

    // rename "id" -> "garbage"
    pipe = new Each(pipe, new Identity(new Fields("garbage", "name", "url", "picture", "ts")));

    Properties props = HdpBootstrap.asProperties(CascadingHadoopSuite.configuration);
    props.setProperty("es.mapping.names", "url:address");
    StatsUtils.proxy(new HadoopFlowConnector(props).connect(in, out, pipe)).complete();
  }
 private void build(Properties cfg, Tap in, Tap out, Pipe pipe) {
   StatsUtils.proxy(new LocalFlowConnector(cfg).connect(in, out, pipe)).complete();
 }
Esempio n. 6
0
  public SeasonalAthlete getCurrentSeasonalAthlete() {

    return Query.from(SeasonalAthlete.class)
        .where("athlete = ? && year = ?", this, StatsUtils.determineSeason(new Date()))
        .first();
  }