本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.setStorageType方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.setStorageType方法的具体用法?Java ValueMetaInterface.setStorageType怎么用?Java ValueMetaInterface.setStorageType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.row.ValueMetaInterface
的用法示例。
在下文中一共展示了ValueMetaInterface.setStorageType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) 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]);
// 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);
}
}
}
示例2: initGroupMeta
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void initGroupMeta(RowMetaInterface previousRowMeta) throws KettleValueException
{
data.groupMeta=new RowMeta();
data.entryMeta = new RowMeta();
for (int i=0;i<data.groupnrs.length;i++)
{
ValueMetaInterface valueMeta = previousRowMeta.getValueMeta(data.groupnrs[i]);
data.groupMeta.addValueMeta(valueMeta);
ValueMetaInterface normalMeta = valueMeta.clone();
normalMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
}
return;
}
示例3: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
@Override
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
try {
inputRowMeta.clear(); // Start with a clean slate, eats the input
for (TextFileInputField field : inputFields) {
ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta(field.getName(), field.getType());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setLength(field.getLength());
valueMeta.setPrecision(field.getPrecision());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setDecimalSymbol(field.getDecimalSymbol());
valueMeta.setGroupingSymbol(field.getGroupSymbol());
valueMeta.setCurrencySymbol(field.getCurrencySymbol());
valueMeta.setTrimType(field.getTrimType());
valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
valueMeta.setDateFormatLenient(true);
valueMeta.setStringEncoding("UTF-8");
ValueMetaInterface storageMetadata = ValueMetaFactory.cloneValueMeta(valueMeta, ValueMetaInterface.TYPE_STRING);
storageMetadata.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
storageMetadata.setLength(-1, -1); // we don't really know the lengths of the strings read in advance.
valueMeta.setStorageMetadata(storageMetadata);
valueMeta.setOrigin(name);
inputRowMeta.addValueMeta(valueMeta);
}
} catch (Exception e) {
}
}
开发者ID:GlobalTechnology,项目名称:pdi-google-spreadsheet-plugin,代码行数:33,代码来源:GoogleSpreadsheetInputMeta.java
示例4: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
for (int i=0;i<fieldDefinition.length;i++) {
FixedFileInputField field = fieldDefinition[i];
ValueMetaInterface valueMeta = new ValueMeta(field.getName(), field.getType());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setTrimType(field.getTrimType());
valueMeta.setLength(field.getLength());
valueMeta.setPrecision(field.getPrecision());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setDecimalSymbol(field.getDecimal());
valueMeta.setGroupingSymbol(field.getGrouping());
valueMeta.setCurrencySymbol(field.getCurrency());
valueMeta.setStringEncoding(space.environmentSubstitute(encoding));
if (lazyConversionActive) valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
// In case we want to convert Strings...
//
ValueMetaInterface storageMetadata = valueMeta.clone();
storageMetadata.setType(ValueMetaInterface.TYPE_STRING);
storageMetadata.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
valueMeta.setStorageMetadata(storageMetadata);
valueMeta.setOrigin(origin);
rowMeta.addValueMeta(valueMeta);
}
}
示例5: processRow
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
meta=(FixedInputMeta)smi;
data=(FixedInputData)sdi;
if (first) {
first=false;
data.outputRowMeta = new RowMeta();
meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
// The conversion logic for when the lazy conversion is turned of is simple:
// Pretend it's a lazy conversion object anyway and get the native type during conversion.
//
data.convertRowMeta = data.outputRowMeta.clone();
for (ValueMetaInterface valueMeta : data.convertRowMeta.getValueMetaList())
{
valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
}
if (meta.isHeaderPresent()) {
readOneRow(false); // skip this row.
}
}
Object[] outputRowData=readOneRow(true);
if (outputRowData==null) // no more input to be expected...
{
setOutputDone();
return false;
}
putRow(data.outputRowMeta, outputRowData); // copy row to possible alternate rowset(s).
if (checkFeedback(getLinesInput())) logBasic(Messages.getString("FixedInput.Log.LineNumber", Long.toString(getLinesInput()))); //$NON-NLS-1$
return true;
}
示例6: processRow
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
meta=(FixedInputMeta)smi;
data=(FixedInputData)sdi;
if (first) {
first=false;
data.outputRowMeta = new RowMeta();
meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
// The conversion logic for when the lazy conversion is turned of is simple:
// Pretend it's a lazy conversion object anyway and get the native type during conversion.
//
data.convertRowMeta = data.outputRowMeta.clone();
for (ValueMetaInterface valueMeta : data.convertRowMeta.getValueMetaList())
{
valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
}
if (meta.isHeaderPresent()) {
readOneRow(false); // skip this row.
}
}
Object[] outputRowData=readOneRow(true);
if (outputRowData==null) // no more input to be expected...
{
setOutputDone();
return false;
}
putRow(data.outputRowMeta, outputRowData); // copy row to possible alternate rowset(s).
if (checkFeedback(getLinesInput())) logBasic(BaseMessages.getString(PKG, "FixedInput.Log.LineNumber", Long.toString(getLinesInput()))); //$NON-NLS-1$
return true;
}
示例7: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface rowMeta, String origin, RowMetaInterface[] info,
StepMeta nextStep, VariableSpace space) throws KettleStepException {
rowMeta.clear(); // Start with a clean slate, eats the input
for (int i = 0; i < inputFields.length; i++) {
TextFileInputField field = inputFields[i];
ValueMetaInterface valueMeta = new ValueMeta(field.getName(), field.getType());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setLength(field.getLength());
valueMeta.setPrecision(field.getPrecision());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setDecimalSymbol(field.getDecimalSymbol());
valueMeta.setGroupingSymbol(field.getGroupSymbol());
valueMeta.setCurrencySymbol(field.getCurrencySymbol());
valueMeta.setTrimType(field.getTrimType());
if (lazyConversionActive) {
valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
}
valueMeta.setStringEncoding(space.environmentSubstitute(encoding));
// In case we want to convert Strings...
// Using a copy of the valueMeta object means that the inner and outer representation
// format is the same.
// Preview will show the data the same way as we read it.
// This layout is then taken further down the road by the metadata through the transformation.
//
ValueMetaInterface storageMetadata = valueMeta.clone();
storageMetadata.setType(ValueMetaInterface.TYPE_STRING);
storageMetadata.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
storageMetadata
.setLength(-1, -1); // we don't really know the lengths of the strings read in advance.
valueMeta.setStorageMetadata(storageMetadata);
valueMeta.setOrigin(origin);
rowMeta.addValueMeta(valueMeta);
}
if (!Const.isEmpty(filenameField) && includingFilename) {
ValueMetaInterface filenameMeta =
new ValueMeta(filenameField, ValueMetaInterface.TYPE_STRING);
filenameMeta.setOrigin(origin);
if (lazyConversionActive) {
filenameMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
filenameMeta
.setStorageMetadata(new ValueMeta(filenameField, ValueMetaInterface.TYPE_STRING));
}
rowMeta.addValueMeta(filenameMeta);
}
if (!Const.isEmpty(rowNumField)) {
ValueMetaInterface rowNumMeta = new ValueMeta(rowNumField, ValueMetaInterface.TYPE_INTEGER);
rowNumMeta.setLength(10);
rowNumMeta.setOrigin(origin);
rowMeta.addValueMeta(rowNumMeta);
}
}
示例8: generateRandomRows
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* Generate some random rows to send to python in the case where a single variable (data frame) is being extracted
* and we want to try and determine the types of the output fields
*
* @param inputMeta incoming row meta
* @param r Random instance to use
* @return a list of randomly generated rows with types matching the incoming row types.
* @throws KettleException if a problem occurs
*/
protected static List<Object[]> generateRandomRows( RowMetaInterface inputMeta, Random r ) throws KettleException {
List<Object[]> rows = new ArrayList<Object[]>( NUM_RANDOM_ROWS );
// ValueMetaInterface numericVM = new ValueMeta( "num", ValueMetaInterface.TYPE_NUMBER ); //$NON-NLS-1$
ValueMetaInterface numericVM = ValueMetaFactory.createValueMeta( "num", ValueMetaInterface.TYPE_NUMBER ); //$NON-NLS-1$
for ( int i = 0; i < NUM_RANDOM_ROWS; i++ ) {
Object[] currentRow = new Object[inputMeta.size()];
for ( int j = 0; j < inputMeta.size(); j++ ) {
ValueMetaInterface vm = inputMeta.getValueMeta( j );
ValueMetaInterface tempVM = vm.clone();
tempVM.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL );
Object newVal;
double d = r.nextDouble();
switch ( vm.getType() ) {
case ValueMetaInterface.TYPE_NUMBER:
case ValueMetaInterface.TYPE_INTEGER:
case ValueMetaInterface.TYPE_BIGNUMBER:
d *= 100.0;
newVal = d;
if ( vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_BINARY_STRING ) {
newVal = tempVM.convertData( numericVM, newVal );
}
currentRow[j] =
vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_NORMAL ? vm.convertData( numericVM, newVal ) :
tempVM.convertToBinaryStringStorageType( newVal );
break;
case ValueMetaInterface.TYPE_DATE:
newVal = new Date( new Date().getTime() + (long) ( d * 100000 ) );
currentRow[j] =
vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_NORMAL ? newVal :
tempVM.convertToBinaryStringStorageType( newVal );
break;
case ValueMetaInterface.TYPE_TIMESTAMP:
newVal = new Timestamp( new Date().getTime() + (long) ( d * 100000 ) );
currentRow[j] =
vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_NORMAL ? newVal :
tempVM.convertToBinaryStringStorageType( newVal );
break;
case ValueMetaInterface.TYPE_BOOLEAN:
newVal = r.nextBoolean();
currentRow[j] =
vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_NORMAL ? newVal :
tempVM.convertToBinaryStringStorageType( newVal );
break;
default:
newVal = d < 0.5 ? "value1" : "value2";
currentRow[j] =
vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_NORMAL ? newVal :
tempVM.convertToBinaryStringStorageType( newVal );
}
}
rows.add( currentRow );
}
return rows;
}
示例9: getValueMetaForColumn
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* Get the Kettle ValueMeta that corresponds to the type of the supplied
* cassandra column.
*
* @param colName the name of the column to get a ValueMeta for
* @return the ValueMeta that is appropriate for the type of the supplied
* column.
*/
public ValueMetaInterface getValueMetaForColumn(String colName) {
String type = null;
// check the key first
if (colName.equals(getKeyName())) {
type = m_keyValidator;
} else {
type = m_columnMeta.get(colName);
if (type == null) {
type = m_defaultValidationClass;
}
}
int kettleType = 0;
if (type.indexOf("UTF8Type") > 0 || type.indexOf("AsciiType") > 0
|| type.indexOf("UUIDType") > 0 || type.indexOf("CompositeType") > 0) {
kettleType = ValueMetaInterface.TYPE_STRING;
} else if (type.indexOf("LongType") > 0 || type.indexOf("IntegerType") > 0
|| type.indexOf("Int32Type") > 0) {
kettleType = ValueMetaInterface.TYPE_INTEGER;
} else if (type.indexOf("DoubleType") > 0 || type.indexOf("FloatType") > 0) {
kettleType = ValueMetaInterface.TYPE_NUMBER;
} else if (type.indexOf("DateType") > 0) {
kettleType = ValueMetaInterface.TYPE_DATE;
} else if (type.indexOf("DecimalType") > 0) {
kettleType = ValueMetaInterface.TYPE_BIGNUMBER;
} else if (type.indexOf("BytesType") > 0) {
kettleType = ValueMetaInterface.TYPE_BINARY;
} else if (type.indexOf("BooleanType") > 0) {
kettleType = ValueMetaInterface.TYPE_BOOLEAN;
}
ValueMetaInterface newVM = new ValueMeta(colName, kettleType);
if (m_indexedVals.containsKey(colName)) {
// make it indexed!
newVM.setStorageType(ValueMetaInterface.STORAGE_TYPE_INDEXED);
HashSet<Object> indexedV = m_indexedVals.get(colName);
Object[] iv = indexedV.toArray();
newVM.setIndex(iv);
}
return newVM;
}
示例10: getMetadataFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getMetadataFields(RowMetaInterface inputRowMeta, String name)
{
if (meta!=null && meta.length>0) // METADATA mode: change the meta-data of the values mentioned...
{
for (int i=0;i<meta.length;i++)
{
SelectMetadataChange metaChange = meta[i];
int idx = inputRowMeta.indexOfValue(metaChange.getName());
if (idx>=0) // We found the value
{
// This is the value we need to change:
ValueMetaInterface v = inputRowMeta.getValueMeta(idx);
// Do we need to rename ?
if (!v.getName().equals(metaChange.getRename()) && !Const.isEmpty(metaChange.getRename()))
{
v.setName(metaChange.getRename());
v.setOrigin(name);
}
// Change the type?
if (metaChange.getType()!=ValueMetaInterface.TYPE_NONE && v.getType()!=metaChange.getType())
{
v.setType(metaChange.getType());
// This also moves the data to normal storage type
//
v.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
}
if (metaChange.getLength() != -2) { v.setLength(metaChange.getLength()); v.setOrigin(name); }
if (metaChange.getPrecision() != -2) { v.setPrecision(metaChange.getPrecision()); v.setOrigin(name); }
if (metaChange.getStorageType() >= 0) { v.setStorageType(metaChange.getStorageType()); v.setOrigin(name); }
if (!Const.isEmpty(metaChange.getConversionMask()))
{
v.setConversionMask(metaChange.getConversionMask());
v.setOrigin(name);
}
if (!Const.isEmpty(metaChange.getDecimalSymbol()))
{
v.setDecimalSymbol(metaChange.getDecimalSymbol());
v.setOrigin(name);
}
if (!Const.isEmpty(metaChange.getGroupingSymbol()))
{
v.setGroupingSymbol(metaChange.getGroupingSymbol());
v.setOrigin(name);
}
if (!Const.isEmpty(metaChange.getCurrencySymbol()))
{
v.setCurrencySymbol(metaChange.getCurrencySymbol());
v.setOrigin(name);
}
}
}
}
}
示例11: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
rowMeta.clear(); // Start with a clean slate, eats the input
for (int i=0;i<inputFields.length;i++) {
TextFileInputField field = inputFields[i];
ValueMetaInterface valueMeta = new ValueMeta(field.getName(), field.getType());
valueMeta.setConversionMask( field.getFormat() );
valueMeta.setLength( field.getLength() );
valueMeta.setPrecision( field.getPrecision() );
valueMeta.setConversionMask( field.getFormat() );
valueMeta.setDecimalSymbol( field.getDecimalSymbol() );
valueMeta.setGroupingSymbol( field.getGroupSymbol() );
valueMeta.setCurrencySymbol( field.getCurrencySymbol() );
valueMeta.setTrimType( field.getTrimType() );
if (lazyConversionActive) valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
valueMeta.setStringEncoding(space.environmentSubstitute(encoding));
// In case we want to convert Strings...
// Using a copy of the valueMeta object means that the inner and outer representation format is the same.
// Preview will show the data the same way as we read it.
// This layout is then taken further down the road by the metadata through the transformation.
//
ValueMetaInterface storageMetadata = valueMeta.clone();
storageMetadata.setType(ValueMetaInterface.TYPE_STRING);
storageMetadata.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
storageMetadata.setLength(-1,-1); // we don't really know the lengths of the strings read in advance.
valueMeta.setStorageMetadata(storageMetadata);
valueMeta.setOrigin(origin);
rowMeta.addValueMeta(valueMeta);
}
if (!Const.isEmpty(filenameField) && includingFilename) {
ValueMetaInterface filenameMeta = new ValueMeta(filenameField, ValueMetaInterface.TYPE_STRING);
filenameMeta.setOrigin(origin);
if (lazyConversionActive) {
filenameMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
filenameMeta.setStorageMetadata(new ValueMeta(filenameField, ValueMetaInterface.TYPE_STRING));
}
rowMeta.addValueMeta(filenameMeta);
}
if (!Const.isEmpty(rowNumField)) {
ValueMetaInterface rowNumMeta = new ValueMeta(rowNumField, ValueMetaInterface.TYPE_INTEGER);
rowNumMeta.setLength(10);
rowNumMeta.setOrigin(origin);
rowMeta.addValueMeta(rowNumMeta);
}
}
示例12: getMetadataFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getMetadataFields(RowMetaInterface inputRowMeta, String name)
{
if (meta!=null && meta.length>0) // METADATA mode: change the meta-data of the values mentioned...
{
for (int i=0;i<meta.length;i++)
{
SelectMetadataChange metaChange = meta[i];
int idx = inputRowMeta.indexOfValue(metaChange.getName());
if (idx>=0) // We found the value
{
// This is the value we need to change:
ValueMetaInterface v = inputRowMeta.getValueMeta(idx);
// Do we need to rename ?
if (!v.getName().equals(metaChange.getRename()) && !Const.isEmpty(metaChange.getRename()))
{
v.setName(metaChange.getRename());
v.setOrigin(name);
}
// Change the type?
if (metaChange.getType()!=ValueMetaInterface.TYPE_NONE && v.getType()!=metaChange.getType())
{
v.setType(metaChange.getType());
// This also moves the data to normal storage type
//
v.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
}
if (metaChange.getLength() != -2) { v.setLength(metaChange.getLength()); v.setOrigin(name); }
if (metaChange.getPrecision() != -2) { v.setPrecision(metaChange.getPrecision()); v.setOrigin(name); }
if (metaChange.getStorageType() >= 0) { v.setStorageType(metaChange.getStorageType()); v.setOrigin(name); }
if (!Const.isEmpty(metaChange.getConversionMask()))
{
v.setConversionMask(metaChange.getConversionMask());
v.setOrigin(name);
}
v.setDateFormatLenient(metaChange.isDateFormatLenient());
if (!Const.isEmpty(metaChange.getEncoding()))
{
v.setStringEncoding(metaChange.getEncoding());
v.setOrigin(name);
}
if (!Const.isEmpty(metaChange.getDecimalSymbol()))
{
v.setDecimalSymbol(metaChange.getDecimalSymbol());
v.setOrigin(name);
}
if (!Const.isEmpty(metaChange.getGroupingSymbol()))
{
v.setGroupingSymbol(metaChange.getGroupingSymbol());
v.setOrigin(name);
}
if (!Const.isEmpty(metaChange.getCurrencySymbol()))
{
v.setCurrencySymbol(metaChange.getCurrencySymbol());
v.setOrigin(name);
}
}
}
}
}