Examples of TupleN


Examples of org.apache.crunch.TupleN

    assertThat(sapply(a, input), is(Tuple4.of(17.29f, 14.5, -0.98, 6)));
  }

  @Test
  public void testTupleN() {
    List<TupleN> input = ImmutableList.of(new TupleN(1, 3.0, 1, 2.0, 4L), new TupleN(4, 17.0, 1, 9.7, 12L));
    Aggregator<TupleN> a = Aggregators.tupleAggregator(
        MIN_INTS(), SUM_DOUBLES(), MAX_INTS(), MIN_DOUBLES(), MAX_LONGS());

    assertThat(sapply(a, input), is(new TupleN(1, 20.0, 1, 2.0, 12L)));
  }
View Full Code Here

Examples of org.apache.crunch.TupleN

      this.extractors = extractors;
    }
   
    @Override
    protected TupleN doCreate(Object[] values) {
      return new TupleN(values);
    }
View Full Code Here

Examples of org.apache.crunch.TupleN

  }
 
  @Test
  public void testTupleN() {
    TokenizerFactory sf = TokenizerFactory.builder().delimiter(",").build();
    assertEquals(new TupleN(1, false, true, 2, 3),
        xtupleN(sf, xint(), xboolean(), xboolean(), xint(), xint()).extract("1,false,true,2,3"));
  }
View Full Code Here

Examples of org.apache.crunch.TupleN

    Arrays.fill(types, typeFamily.strings());
    PCollection<TupleN> kv = input.parallelDo(new DoFn<String, TupleN>() {
      @Override
      public void process(String input, Emitter<TupleN> emitter) {
        String[] split = input.split("[\t]+");
        emitter.emit(new TupleN(split));
      }
    }, typeFamily.tuples(types));
    PCollection<TupleN> sorted = Sort.sortTuples(kv, orders);
    Iterable<TupleN> lines = sorted.materialize();
    TupleN l = lines.iterator().next();
    int i = 0;
    for (String field : fields) {
      assertEquals(field, l.get(i++));
    }
    pipeline.done();
  }
View Full Code Here

Examples of org.apache.crunch.TupleN

  @Test
  @SuppressWarnings("rawtypes")
  public void testTupleN() throws Exception {
    AvroType at = Avros.tuples(Avros.strings(), Avros.strings(), Avros.strings(), Avros.strings(), Avros.strings());
    TupleN j = new TupleN("a", "b", "c", "d", "e");
    GenericData.Record w = new GenericData.Record(at.getSchema());
    w.put(0, new Utf8("a"));
    w.put(1, new Utf8("b"));
    w.put(2, new Utf8("c"));
    w.put(3, new Utf8("d"));
View Full Code Here

Examples of org.apache.crunch.TupleN

 
  @Test
  public void testGetDetachedValue_TupleN(){
    Person person = createPerson();
    AvroType<TupleN> ptype = Avros.tuples(Avros.records(Person.class));
    TupleN tuple = new TupleN(person);
    TupleN detachedTuple = ptype.getDetachedValue(tuple);
   
    assertEquals(tuple, detachedTuple);
    assertNotSame(person, detachedTuple.get(0));
  }
View Full Code Here

Examples of org.python.pydev.core.TupleN

    protected Map<String, IToken> getCachedCompletions(String tok, IPythonNature nature, boolean searchSameLevelMods,
            ICompletionCache completionCache, String generateTokensFor) throws CompletionRecursionException {
        //now, check if it's cached in a way we can use it (we cache it not as raw tokens, but as representation --> token)
        //to help in later searches.
        String name = this.getName();
        Object key = new TupleN("isInGlobalTokens", name != null ? name : "", generateTokensFor, tok,
                searchSameLevelMods);
        Map<String, IToken> cachedTokens = (Map<String, IToken>) completionCache.getObj(key);

        if (cachedTokens == null) {
            cachedTokens = internalGenerateCachedTokens(nature, completionCache, generateTokensFor, searchSameLevelMods);
View Full Code Here

Examples of org.python.pydev.core.TupleN

     * removed and if __all__ is available, only the tokens contained in __all__ are returned)
     */
    public IToken[] getCompletionsForModule(IModule module, ICompletionState state, boolean searchSameLevelMods,
            boolean lookForArgumentCompletion, boolean handleAsWildImport) throws CompletionRecursionException {
        String name = module.getName();
        Object key = new TupleN("getCompletionsForModule", name != null ? name : "", state.getActivationToken(),
                searchSameLevelMods, lookForArgumentCompletion, state.getBuiltinsGotten(),
                state.getLocalImportsGotten(), handleAsWildImport);

        IToken[] ret = (IToken[]) state.getObj(key);
        if (ret != null) {
View Full Code Here

Examples of org.python.pydev.core.TupleN

     * not exist and
     * False if we're sure it does not exist
     */
    private boolean isDefinitionUnknown(IModule m, String repToCheck) throws Exception {
        String name = m.getName();
        TupleN key = new TupleN("isDefinitionUnknown", name != null ? name : "", repToCheck);
        Boolean isUnknown = (Boolean) this.completionCache.getObj(key);
        if (isUnknown == null) {
            isUnknown = internalGenerateIsDefinitionUnknown(m, repToCheck);
            this.completionCache.add(key, isUnknown);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.