@Override protected int hash( Object key ) { byte[] rowKey = (byte[]) key; try { return keyMeta.hashCode( RowMeta.getRow( keyMeta, rowKey ) ); } catch ( KettleValueException ex ) { throw new IllegalArgumentException( ex ); } }
public static int generateHashCode( byte[] key, RowMetaInterface rowMeta ) throws KettleValueException { Object[] rowData = RowMeta.getRow( rowMeta, key ); return rowMeta.hashCode( rowData ); }
private Object[] getFromCache( Object[] keyValues, Date dateValue ) throws KettleValueException { if ( data.cacheValueRowMeta == null ) { // nothing in the cache yet, no lookup was ever performed if ( data.returnRowMeta == null ) { return null; } data.cacheValueRowMeta = assembleCacheValueRowMeta(); } byte[] key = RowMeta.extractData( data.cacheKeyRowMeta, keyValues ); byte[] value = data.cache.get( key ); if ( value != null ) { Object[] row = RowMeta.getRow( data.cacheValueRowMeta, value ); // See if the dateValue is between the from and to date ranges... // The last 2 values are from and to long time = dateValue.getTime(); long from = ( (Date) row[ row.length - 2 ] ).getTime(); long to = ( (Date) row[ row.length - 1 ] ).getTime(); if ( time >= from && time < to ) { // sanity check to see if we have the right version if ( isRowLevel() ) { logRowlevel( "Cache hit: key=" + data.cacheKeyRowMeta.getString( keyValues ) + " values=" + data.cacheValueRowMeta.getString( row ) ); } return row; } } return null; }
byte[] value = data.cache.get( key ); if ( value != null ) { Object[] values = RowMeta.getRow( data.cacheValueRowMeta, value ); Long tk = data.cacheValueRowMeta.getInteger( values, 0 ); samples.add( tk ); byte[] value = data.cache.get( key ); if ( value != null ) { Object[] values = RowMeta.getRow( data.cacheValueRowMeta, value ); long tk = data.cacheValueRowMeta.getInteger( values, 0 ).longValue(); if ( tk <= data.smallestCacheKey ) {
return null; return RowMeta.getRow( data.cacheValueMeta, value ); } catch ( Exception e ) { logError( "Oops", e );
Object[] rowData = rowMeta.getRow( resultNode ); rows.add( new RowMetaAndData( rowMeta, rowData ) );