use of org.pentaho.di.trans.steps.samplerows.SampleRowsMeta in project pdi-dataservice-server-plugin by pentaho.
the class SqlTransGenerator method generateSampleStep.
private StepMeta generateSampleStep() {
SampleRowsMeta meta = new SampleRowsMeta();
meta.setLinesRange("1.." + rowLimit);
StepMeta stepMeta = new StepMeta("Sample rows", meta);
stepMeta.setLocation(xLocation, 50);
xLocation += 100;
stepMeta.setDraw(true);
return stepMeta;
}
use of org.pentaho.di.trans.steps.samplerows.SampleRowsMeta in project pdi-dataservice-server-plugin by pentaho.
the class SqlTransGeneratorTest method testServiceLimit.
@Test
public void testServiceLimit() throws KettleException {
SQL sql = new SQL("SELECT * FROM table");
RowMetaInterface rowMeta = new RowMeta();
rowMeta.addValueMeta(new ValueMetaString("foo"));
sql.parse(rowMeta);
final String genLimitStep = "Limit input rows";
SqlTransGenerator generator = new SqlTransGenerator(sql, 0, 2);
TransMeta transMeta = generator.generateTransMeta();
SampleRowsMeta limitInput = (SampleRowsMeta) getStepByName(transMeta, genLimitStep);
assertEquals("limit not generated", "1..2", limitInput.getLinesRange());
// bad value
generator = new SqlTransGenerator(sql, 0, -3);
transMeta = generator.generateTransMeta();
assertTrue("limit<=0 not ignored", Arrays.asList(transMeta.getStepNames()).indexOf(genLimitStep) < 0);
}
use of org.pentaho.di.trans.steps.samplerows.SampleRowsMeta in project pdi-dataservice-server-plugin by pentaho.
the class SqlTransGenerator method generateLimitStep.
private StepMeta generateLimitStep(final String name, int offset, int limit) {
SampleRowsMeta meta = new SampleRowsMeta();
meta.setLinesRange((offset + 1) + ".." + (offset + limit));
StepMeta stepMeta = new StepMeta(name, meta);
stepMeta.setLocation(xLocation, 50);
xLocation += 100;
stepMeta.setDraw(true);
return stepMeta;
}
Aggregations