本文整理汇总了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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}