public int findVirtualColumnNum(VirtualColumn virtualColumn) { // Virtual columns start after the last partition column. int resultColumnNum = dataColumnCount + partitionColumnCount; for (VirtualColumn neededVirtualColumn : neededVirtualColumns) { if (neededVirtualColumn.equals(virtualColumn)) { return resultColumnNum; } resultColumnNum++; } return -1; }
private void populateVirtualColumnValues() { if (this.vcs != null) { ExecMapperContext mapExecCxt = this.getExecContext(); IOContext ioCxt = mapExecCxt.getIoCxt(); for (int i = 0; i < vcs.size(); i++) { VirtualColumn vc = vcs.get(i); if (vc.equals(VirtualColumn.FILENAME) && mapExecCxt.inputFileChanged()) { this.vcValues[i] = new Text(mapExecCxt.getCurrentInputFile()); } else if (vc.equals(VirtualColumn.BLOCKOFFSET)) { long current = ioCxt.getCurrentBlockStart(); LongWritable old = (LongWritable) this.vcValues[i]; if (old == null) { old = new LongWritable(current); this.vcValues[i] = old; continue; } if (current != old.get()) { old.set(current); } } } } }
if (vc.equals(VirtualColumn.FILENAME)) { if (ctx.inputFileChanged()) { vcValues[i] = new Text(ctx.getCurrentInputPath().toString()); } else if (vc.equals(VirtualColumn.BLOCKOFFSET)) { long current = ctx.getIoCxt().getCurrentBlockStart(); LongWritable old = (LongWritable) vcValues[i]; old.set(current); } else if (vc.equals(VirtualColumn.ROWOFFSET)) { long current = ctx.getIoCxt().getCurrentRow(); LongWritable old = (LongWritable) vcValues[i]; old.set(current); } else if (vc.equals(VirtualColumn.RAWDATASIZE)) { long current = 0L; SerDeStats stats = deserializer.getSerDeStats(); else if(vc.equals(VirtualColumn.ROWID)) { if(ctx.getIoCxt().getRecordIdentifier() == null) { vcValues[i] = null;