// This will be the counter.
Long rowCount;
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
if (first) {
rowCount = 0l;
first=false;
}
Object[] r = getRow();
if (r == null) {
setOutputDone();
return false;
}
// Increment of the counter.
rowCount++;
// Check ouf the counter. Doesn't output the current row if it's less than 4501.
if (rowCount>4500l) {
Object[] outputRow = createOutputRow(r, data.outputRowMeta.size());
// Adds the row count to a stream field.
get(Fields.Out, "Count").setValue(outputRow, rowCount);
putRow(data.outputRowMeta, outputRow);
}
return true;
}
2条答案
按热度按时间k4emjkb11#
我还没有找到一个计算处理的行数的步骤,但是您可以使用“用户定义的java类”步骤来计算行数并删除前4500行,代码如下:
tpgth1q72#
我用了下面的水壶文件,解决了我的问题。感谢@workinghard..和@jxc