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


Java Tuple.isNull方法代码示例

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


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

示例1: putNext

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void putNext(Tuple tuple) throws IOException {
    if (tuple == null || tuple.size() == 0) {
        return;
    }

    String data = null;
    if (createDocOp) {
        data = createDocumentOperation(tuple);
    } else if (!tuple.isNull(0)) {
        data = tuple.get(0).toString(); // assume single field with correctly formatted doc op.
    }

    if (data == null || data.length() == 0) {
        return;
    }

    try {
        recordWriter.write(0, data);
    } catch (InterruptedException e) {
        throw new IOException(e);
    }
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:25,代码来源:VespaStorage.java

示例2: exec

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public Tuple exec(Tuple tuple) throws IOException {
    if (tuple == null || tuple.size() != 1) {
        return null;
    }
    
    Tuple first = (Tuple) tuple.get(0);
    if (first == null) {
        return null;
    } 
    for (int i = 0; i < first.size(); i++) {
        if (!first.isNull(i)) {
            return first;
        }
    }
    return null;
}
 
开发者ID:openaire,项目名称:iis,代码行数:18,代码来源:NullTupleFieldsToNull.java

示例3: accumulate

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public void accumulate(final Tuple inputTuple) throws IOException {
  if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
    return;
  }

  final DataBag samples = (DataBag) inputTuple.get(0);

  if (sketch_ == null) {
    sketch_ = VarOptItemsSketch.newInstance(targetK_);
  }

  for (final Tuple t : samples) {
    final double weight = (double) t.get(weightIdx_);
    sketch_.update(t, weight);
  }
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:18,代码来源:VarOptSampling.java

示例4: accumulate

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public void accumulate(final Tuple inputTuple) throws IOException {
  if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
    return;
  }

  final DataBag samples = (DataBag) inputTuple.get(0);

  if (reservoir_ == null) {
    reservoir_ = ReservoirItemsSketch.newInstance(targetK_);
  }

  for (Tuple t : samples) {
    reservoir_.update(t);
  }
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:17,代码来源:ReservoirSampling.java

示例5: accumulate

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public void accumulate(final Tuple inputTuple) throws IOException {
  if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
    return;
  }

  final DataBag reservoirs = (DataBag) inputTuple.get(0);

  if (union_ == null) {
    union_ = ReservoirItemsUnion.newInstance(maxK_);
  }

  try {
    for (Tuple t : reservoirs) {
      // if t == null or t.size() < 3, we'll throw an exception
      final long n = (long) t.get(0);
      final int k = (int) t.get(1);
      final DataBag sampleBag = (DataBag) t.get(2);
      final ArrayList<Tuple> samples = ReservoirSampling.dataBagToArrayList(sampleBag);
      union_.update(n, k, samples);
    }
  } catch (final IndexOutOfBoundsException e) {
    throw new ExecException("Cannot update union with given reservoir", e);
  }
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:26,代码来源:ReservoirUnion.java

示例6: accumulate

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public void accumulate(final Tuple inputTuple) throws IOException {
  if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
    return;
  }

  final DataBag sketches = (DataBag) inputTuple.get(0);

  if (union_ == null) {
    union_ = VarOptItemsUnion.newInstance(maxK_);
  }

  for (Tuple t : sketches) {
    final DataByteArray dba = (DataByteArray) t.get(0);
    final Memory sketch = Memory.wrap(dba.get());
    union_.update(sketch, SERDE);
  }
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:19,代码来源:VarOptUnion.java

示例7: exec

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public Tuple exec(final Tuple inputTuple) throws IOException {
  if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
    return null;
  }

  final VarOptItemsSketch<Tuple> sketch = rawTuplesToSketch(inputTuple, targetK_, weightIdx_);
  return wrapSketchInTuple(sketch);
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:10,代码来源:VarOptCommonImpl.java

示例8: exec

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public DataBag exec(final Tuple inputTuple) throws IOException {
  if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
    return null;
  }

  final VarOptItemsUnion<Tuple> union = unionSketches(inputTuple, targetK_);
  return createDataBagFromSketch(union.getResult());
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:10,代码来源:VarOptSampling.java

示例9: exec

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public Tuple exec(final Tuple inputTuple) throws IOException {
  if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
    return null;
  }

  final DataBag samples = (DataBag) inputTuple.get(0);

  // if entire input data fits in reservoir, shortcut result
  if (samples.size() <= targetK_) {
    return createResultTuple(samples.size(), targetK_, samples);
  }
  return super.exec(inputTuple);
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:15,代码来源:ReservoirSampling.java

示例10: exec

import org.apache.pig.data.Tuple; //导入方法依赖的package包/类
@Override
public DataBag exec(final Tuple inputTuple) throws IOException {
  if (inputTuple == null || inputTuple.size() < 1 || inputTuple.isNull(0)) {
    return null;
  }

  final DataByteArray dba = (DataByteArray) inputTuple.get(0);
  final Memory mem = Memory.wrap(dba.get());
  final VarOptItemsSketch<Tuple> sketch = VarOptItemsSketch.heapify(mem, SERDE);

  return createDataBagFromSketch(sketch);
}
 
开发者ID:DataSketches,项目名称:sketches-pig,代码行数:13,代码来源:GetVarOptSamples.java


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