public long length() { if (isFrame()) { return ((Frame)get()).byteSize(); } return _max; }
public boolean isRawData() { if(isFrame()){ Frame fr = get(); return fr.vecs().length == 1 && (fr.vecs()[0] instanceof ByteVec); } // either simple value with bytearray, un-parsed value array or byte vec return _type == TypeMap.PRIM_B || isByteVec(); }
public boolean isBitIdentical( Value v ) { if( this == v ) return true; if( !isFrame() && !v.isFrame() ) return Arrays.equals(getBytes(), v.getBytes()); Frame fr0 = get(); Frame fr1 = v.get(); if( fr0.numRows() != fr1.numRows() ) return false; if( fr0.numCols() != fr1.numCols() ) return false; return new BitCmp(fr1).doAll(fr0)._eq; } private static class BitCmp extends MRTask2<BitCmp> {
/** Creates a Stream for reading bytes */ public InputStream openStream(ProgressMonitor p) throws IOException { if(onNFS() ) return PersistNFS .openStream(_key ); if(onHDFS()) return PersistHdfs.openStream(_key,p); if(onS3() ) return PersistS3 .openStream(_key,p); if(onTachyon()) return PersistTachyon.openStream(_key,p); if( isFrame() ) throw new IllegalArgumentException("Tried to pass a Frame to openStream (maybe tried to parse a (already-parsed) Frame?)"); assert _type==TypeMap.PRIM_B : "Expected byte[] type but got "+TypeMap.className(_type); return new ByteArrayInputStream(memOrLoad()); }
for( Key k : frameKeys ) { // Convert all VAs to Frames Value val = DKV.get(k); if( val == null || !val.isFrame()) continue;
public KeyInfo(Key k, Value v){ assert k!=null : "Key should be not null!"; assert v!=null : "Value should be not null!"; _key = k; _type = v.type(); _rawData = v.isRawData(); if(v.isFrame()){ Frame f = v.get(); // NOTE: can't get byteSize here as it may invoke RollupStats! :( // _sz = f.byteSize(); _sz = v._max; // do at least nrows/ncols instead _ncols = f.numCols(); _nrows = f.numRows(); } else { _sz = v._max; _ncols = 0; _nrows = 0; } _backEnd = v.backend(); } @Override public int compareTo(KeyInfo ki){ return _key.compareTo(ki._key);}
public byte[] getFirstBytes() { Value v = this; if(isByteVec()){ ByteVec vec = get(); return vec.chunkForChunkIdx(0).getBytes(); } else if(isFrame()){ Frame fr = get(); return ((ByteVec)fr.vecs()[0]).chunkForChunkIdx(0).getBytes(); } // Return empty array if key has been deleted return v != null ? v.memOrLoad() : new byte[0]; }
Value v = DKV.get(headerKey); if(!v.isRawData()){ // either ValueArray or a Frame, just extract the headers if(v.isFrame()){ Frame fr = v.get(); colNames = fr._names;
String str = ""; if(val.isFrame()){ Frame fr = val.get(); rows = fr.numRows();