use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.
the class ReadAllCacheTest method lookup_Finds_WithTwoBetweenOperators.
@Test
public void lookup_Finds_WithTwoBetweenOperators() throws Exception {
RowMeta meta = new RowMeta();
meta.addValueMeta(new ValueMetaInteger());
meta.addValueMeta(new ValueMetaString());
meta.addValueMeta(new ValueMetaString());
meta.addValueMeta(new ValueMetaDate());
meta.addValueMeta(new ValueMetaDate());
meta.addValueMeta(new ValueMetaInteger());
ReadAllCache cache = buildCache(">,BETWEEN,BETWEEN,IS NULL");
Object[] found = cache.getRowFromCache(meta, new Object[] { -1L, "1", "3", new Date(0), new Date(1000), null });
assertArrayEquals("('1' <= keys[1] <= '3') && (0 <= keys[2] <= 1000) --> row 2", data[2], found);
}
use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.
the class ReadAllCacheTest method lookup_Finds_WithBetweenOperator.
@Test
public void lookup_Finds_WithBetweenOperator() throws Exception {
RowMeta meta = keysMeta.clone();
meta.setValueMeta(3, new ValueMetaDate());
meta.addValueMeta(new ValueMetaInteger());
ReadAllCache cache = buildCache("<>,IS NOT NULL,BETWEEN,IS NULL");
Object[] found = cache.getRowFromCache(meta, new Object[] { -1L, null, new Date(140), new Date(160), null });
assertArrayEquals("(140 <= keys[2] <= 160) --> row 4", data[4], found);
}
use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.
the class SpeedTest method populateMetaAndData.
private static void populateMetaAndData(int i, Object[] rowString10, RowMetaInterface metaString10, Object[] rowMixed10, RowMetaInterface metaMixed10) {
rowString10[i] = StringUtil.generateRandomString(20, "", "", false);
ValueMetaInterface meta = new ValueMetaString("String" + (i + 1), 20, 0);
metaString10.addValueMeta(meta);
rowMixed10[i * 5 + 0] = StringUtil.generateRandomString(20, "", "", false);
ValueMetaInterface meta0 = new ValueMetaString("String" + (i * 5 + 1), 20, 0);
metaMixed10.addValueMeta(meta0);
rowMixed10[i * 5 + 1] = new Date();
ValueMetaInterface meta1 = new ValueMetaDate("String" + (i * 5 + 1));
metaMixed10.addValueMeta(meta1);
rowMixed10[i * 5 + 2] = new Double(Math.random() * 1000000);
ValueMetaInterface meta2 = new ValueMetaNumber("String" + (i * 5 + 1), 12, 4);
metaMixed10.addValueMeta(meta2);
rowMixed10[i * 5 + 3] = new Long((long) (Math.random() * 1000000));
ValueMetaInterface meta3 = new ValueMetaInteger("String" + (i * 5 + 1), 8, 0);
metaMixed10.addValueMeta(meta3);
rowMixed10[i * 5 + 4] = Boolean.valueOf(Math.random() > 0.5 ? true : false);
ValueMetaInterface meta4 = new ValueMetaBoolean("String" + (i * 5 + 1));
metaMixed10.addValueMeta(meta4);
}
use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.
the class ResultFile method getRow.
/**
* @return an output Row for this Result File object.
*/
public RowMetaAndData getRow() {
RowMetaAndData row = new RowMetaAndData();
// First the type
row.addValue(new ValueMetaString("type"), getTypeDesc());
// The filename
row.addValue(new ValueMetaString("filename"), file.getName().getBaseName());
// The path
row.addValue(new ValueMetaString("path"), file.getName().getURI());
// The origin parent
row.addValue(new ValueMetaString("parentorigin"), originParent);
// The origin
row.addValue(new ValueMetaString("origin"), origin);
// The comment
row.addValue(new ValueMetaString("comment"), comment);
// The timestamp
row.addValue(new ValueMetaDate("timestamp"), timestamp);
return row;
}
use of org.pentaho.di.core.row.value.ValueMetaDate in project pentaho-kettle by pentaho.
the class InjectorIT method createRowMetaInterface.
public RowMetaInterface createRowMetaInterface() {
RowMetaInterface rm = new RowMeta();
ValueMetaInterface[] valuesMeta = { new ValueMetaString("field1"), new ValueMetaInteger("field2"), new ValueMetaNumber("field3"), new ValueMetaDate("field4"), new ValueMetaBoolean("field5"), new ValueMetaBigNumber("field6"), new ValueMetaBigNumber("field7") };
for (int i = 0; i < valuesMeta.length; i++) {
rm.addValueMeta(valuesMeta[i]);
}
return rm;
}
Aggregations