当前位置: 首页>>代码示例>>Java>>正文


Java TupleEntry.getObject方法代码示例

本文整理汇总了Java中cascading.tuple.TupleEntry.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java TupleEntry.getObject方法的具体用法?Java TupleEntry.getObject怎么用?Java TupleEntry.getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cascading.tuple.TupleEntry的用法示例。


在下文中一共展示了TupleEntry.getObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import cascading.tuple.TupleEntry; //导入方法依赖的package包/类
@Override
public void write(TupleEntry record) {
  recordConsumer.startMessage();
  final List<Type> fields = rootSchema.getFields();

  for (int i = 0; i < fields.size(); i++) {
    Type field = fields.get(i);

    if (record == null || record.getObject(field.getName()) == null) {
      continue;
    }
    recordConsumer.startField(field.getName(), i);
    if (field.isPrimitive()) {
      writePrimitive(record, field.asPrimitiveType());
    } else {
      throw new UnsupportedOperationException("Complex type not implemented");
    }
    recordConsumer.endField(field.getName(), i);
  }
  recordConsumer.endMessage();
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:22,代码来源:TupleWriteSupport.java

示例2: sink

import cascading.tuple.TupleEntry; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void sink(FlowProcess<JobConf> fp, SinkCall<Object[], OutputCollector> sc)
    throws IOException {
  TupleEntry tuple = sc.getOutgoingEntry();

  if (tuple.size() != 1) {
    throw new RuntimeException("ParquetValueScheme expects tuples with an arity of exactly 1, but found " + tuple.getFields());
  }

  T value = (T) tuple.getObject(0);
  OutputCollector output = sc.getOutput();
  output.collect(null, value);
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:15,代码来源:ParquetValueScheme.java

示例3: operate

import cascading.tuple.TupleEntry; //导入方法依赖的package包/类
@Override
public void operate(FlowProcess flowProcess, FunctionCall functionCall) {
  TupleEntry arguments = functionCall.getArguments();
  Tuple result = new Tuple();

  Name name = (Name) arguments.getObject(0);
  result.add(name.firstName());
  result.add(name.lastName().get());
  functionCall.getOutputCollector().add(result);
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:11,代码来源:ParquetScroogeSchemeTest.java

示例4: sink

import cascading.tuple.TupleEntry; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void sink(FlowProcess<? extends JobConf> fp, SinkCall<Object[], OutputCollector> sc)
    throws IOException {
  TupleEntry tuple = sc.getOutgoingEntry();

  if (tuple.size() != 1) {
    throw new RuntimeException("ParquetValueScheme expects tuples with an arity of exactly 1, but found " + tuple.getFields());
  }

  T value = (T) tuple.getObject(0);
  OutputCollector output = sc.getOutput();
  output.collect(null, value);
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:15,代码来源:ParquetValueScheme.java

示例5: operate

import cascading.tuple.TupleEntry; //导入方法依赖的package包/类
@Override
public void operate(FlowProcess flowProcess, FunctionCall functionCall) {
  TupleEntry arguments = functionCall.getArguments();
  Tuple result = new Tuple();

  Name name = (Name) arguments.getObject(0);
  result.add(name.getFirst_name());
  result.add(name.getLast_name());
  functionCall.getOutputCollector().add(result);
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:11,代码来源:TestParquetTBaseScheme.java

示例6: matchesSafely

import cascading.tuple.TupleEntry; //导入方法依赖的package包/类
@Override
protected boolean matchesSafely(TupleEntry actual, Description description) {
  Set<Comparable<?>> actualNames = extractFieldNames(actual.getFields());
  Set<Comparable<?>> expectedNames = extractFieldNames(expected.getFields());

  Set<Comparable<?>> allNames = new HashSet<Comparable<?>>();
  allNames.addAll(actualNames);
  allNames.addAll(expectedNames);

  boolean result = true;
  for (Comparable<?> name : allNames) {
    Fields field = new Fields(name);
    if (!actual.getFields().contains(field)) {
      description.appendText(format("%s was expected, but was not present%n", name));
      result = false;
      continue;
    }
    if (!expected.getFields().contains(field)) {
      description.appendText(format("%s was not expected, but was present%n", name));
      result = false;
      continue;
    }
    int actualPos = actual.getFields().getPos(name);
    int expectedPos = expected.getFields().getPos(name);
    if (actualPos != expectedPos) {
      description.appendText(format("%s expected position was %s, but was %s%n", name, expectedPos, actualPos));
      result = false;
    }
    Type actualType = actual.getFields().getType(name);
    Type expectedType = expected.getFields().getType(name);
    if (!equal(actualType, expectedType)) {
      description.appendText(format("%s expected type was %s, but was %s%n", name, expectedType, actualType));
      result = false;
      continue;
    }
    Object actualValue = actual.getObject(name);
    Object expectedValue = expected.getObject(name);
    if (!equal(actualValue, expectedValue)) {
      description.appendText(format("%s expected value was '%s', but was '%s'%n", name, expectedValue, actualValue));
      result = false;
    }
  }
  return result;
}
 
开发者ID:HotelsDotCom,项目名称:plunger,代码行数:45,代码来源:TupleEntryMatcher.java


注:本文中的cascading.tuple.TupleEntry.getObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。