use of org.pentaho.di.core.row.ValueMeta in project pdi-dataservice-server-plugin by pentaho.
the class ValueMetaResolverTest method getTestRowMeta.
private RowMeta getTestRowMeta(String[] fieldNames, int[] types) {
assert fieldNames.length == types.length;
RowMeta rowMeta = new RowMeta();
for (int i = 0; i < fieldNames.length; i++) {
int type = types[i];
String fieldName = fieldNames[i];
rowMeta.addValueMeta(new ValueMeta(fieldName, type));
}
return rowMeta;
}
use of org.pentaho.di.core.row.ValueMeta in project pdi-dataservice-server-plugin by pentaho.
the class ValueMetaResolver method convertToType.
private Object convertToType(ValueMetaInterface valueMeta, int originalType, Object value) throws PushDownOptimizationException {
try {
final ValueMeta meta = new ValueMeta(null, originalType);
meta.setConversionMask(valueMeta.getConversionMask());
return valueMeta.convertData(meta, value);
} catch (KettleValueException valueException) {
Object val = tryAnsiFormatConversion(valueMeta, originalType, value);
if (val == null) {
throw new PushDownOptimizationException("Failed to convert type", valueException);
}
return val;
}
}
Aggregations