public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException { // Set the sorted properties: ascending/descending for (int i = 0; i < fieldName.length; i++) { int idx = inputRowMeta.indexOfValue(fieldName[i]); if (idx >= 0) { ValueMetaInterface valueMeta = inputRowMeta.getValueMeta(idx); valueMeta.setSortedDescending(!ascending[i]); valueMeta.setCaseInsensitive(!caseSensitive[i]); valueMeta.setCollatorDisabled(!collatorEnabled[i]); valueMeta.setCollatorStrength(collatorStrength[i]); // Also see if lazy conversion is active on these key fields. // If so we want to automatically convert them to the normal storage type. // This will improve performance, see also: PDI-346 // valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL); valueMeta.setStorageMetadata(null); } } }
public static ValueMetaInterface cloneValueMeta(ValueMetaInterface source, int targetType) throws KettlePluginException { ValueMetaInterface target = null; // If we're Cloneable and not changing types, call clone() if (source instanceof Cloneable && source.getType() == targetType) { target = source.clone(); } else { target = createValueMeta(source.getName(), targetType, source.getLength(), source.getPrecision()); } target.setConversionMask(source.getConversionMask()); target.setDecimalSymbol(source.getDecimalSymbol()); target.setGroupingSymbol(source.getGroupingSymbol()); target.setStorageType(source.getStorageType()); if (source.getStorageMetadata() != null) { target.setStorageMetadata( cloneValueMeta(source.getStorageMetadata(), source.getStorageMetadata().getType())); } target.setStringEncoding(source.getStringEncoding()); target.setTrimType(source.getTrimType()); target.setDateFormatLenient(source.isDateFormatLenient()); target.setDateFormatLocale(source.getDateFormatLocale()); target.setDateFormatTimeZone(source.getDateFormatTimeZone()); target.setLenientStringToNumber(source.isLenientStringToNumber()); target.setLargeTextField(source.isLargeTextField()); target.setComments(source.getComments()); target.setCaseInsensitive(source.isCaseInsensitive()); target.setIndex(source.getIndex()); target.setOrigin(source.getOrigin()); target.setOriginalAutoIncrement(source.isOriginalAutoIncrement()); target.setOriginalColumnType(source.getOriginalColumnType()); target.setOriginalColumnTypeName(source.getOriginalColumnTypeName()); target.setOriginalNullable(source.isOriginalNullable()); target.setOriginalPrecision(source.getOriginalPrecision()); target.setOriginalScale(source.getOriginalScale()); target.setOriginalSigned(source.isOriginalSigned()); return target; }