use of org.pentaho.di.trans.steps.tableinput.TableInputMeta in project pdi-dataservice-server-plugin by pentaho.
the class TableInputValidation method checkMissingDefinedParam.
private void checkMissingDefinedParam(CheckStepsExtension checkStepExtension, DataServiceMeta dataServiceMeta) {
StepMeta checkedStepMeta = checkStepExtension.getStepMetas()[0];
TableInputMeta tableInputMeta = (TableInputMeta) checkedStepMeta.getStepMetaInterface();
for (ParameterGeneration paramGen : getParameterGenerationsForStep(dataServiceMeta, checkedStepMeta.getName())) {
if (Const.isEmpty(tableInputMeta.getSQL()) || !tableInputMeta.getSQL().contains(paramGen.getParameterName())) {
checkStepExtension.getRemarks().add(warn(BaseMessages.getString(PKG, "TableInputValidation.MissingDefinedParam.Message", checkedStepMeta.getName(), paramGen.getParameterName()), checkedStepMeta));
}
}
}
use of org.pentaho.di.trans.steps.tableinput.TableInputMeta in project pdi-dataservice-server-plugin by pentaho.
the class TableInputValidation method checkPushdownParameter.
private void checkPushdownParameter(CheckStepsExtension checkStepExtension) {
StepMeta checkedStepMeta = checkStepExtension.getStepMetas()[0];
TableInputMeta tableInputMeta = (TableInputMeta) checkedStepMeta.getStepMetaInterface();
String sql = tableInputMeta.getSQL();
if (Const.isEmpty(sql) || !paramSubstitutionModifiesString(sql, checkStepExtension.getVariableSpace())) {
// No change after variable substitution, so no parameter must have been present
checkStepExtension.getRemarks().add(warn(BaseMessages.getString(PKG, "TableInputValidation.NoParameters.Message", checkedStepMeta.getName()), checkedStepMeta));
}
}
use of org.pentaho.di.trans.steps.tableinput.TableInputMeta in project pdi-dataservice-server-plugin by pentaho.
the class TableInputParameterGenerationTest method testPreview.
@Test
public void testPreview() throws KettleValueException, PushDownOptimizationException {
ParameterGeneration param = factory.createPushDown();
param.setParameterName("param");
Condition employeeFilter = newCondition("fooField", "barValue");
when(stepInterface.getStepMeta()).thenReturn(mock(StepMeta.class));
TableInputMeta mockTableInput = mock(TableInputMeta.class);
String origQuery = "SELECT * FROM TABLE WHERE ${param}";
when(mockTableInput.getSQL()).thenReturn("SELECT * FROM TABLE WHERE ${param}");
when(stepInterface.getStepMeta().getStepMetaInterface()).thenReturn(mockTableInput);
when(stepInterface.getStepname()).thenReturn("testStepName");
OptimizationImpactInfo impact = service.preview(employeeFilter, param, stepInterface);
assertThat(impact.getQueryBeforeOptimization(), equalTo(origQuery));
assertThat(impact.getStepName(), equalTo("testStepName"));
assertThat(impact.getQueryAfterOptimization(), equalTo("Parameterized SQL: SELECT * FROM TABLE WHERE fooField = ? {1: barValue}"));
assertTrue(impact.isModified());
}
Aggregations