public static int getRowByteSize(Schema schema) { int sum = 0; for(Column col : schema.getColumns()) { sum += StorageUtil.getColByteSize(col); } return sum; }
public static int[] getTargetIds(Schema inSchema, Schema outSchema) { int[] targetIds = new int[outSchema.size()]; int i = 0; for (Column target : outSchema.getColumns()) { targetIds[i] = inSchema.getColumnId(target.getQualifiedName()); i++; } return targetIds; }
public void init() throws IOException { fs = path.getFileSystem(conf); if (!fs.exists(path.getParent())) { throw new FileNotFoundException(path.toString()); } fos = fs.create(path); ColumnMetaData [] trevniMetas = new ColumnMetaData[schema.size()]; int i = 0; for (Column column : schema.getColumns()) { trevniMetas[i++] = new ColumnMetaData(column.getSimpleName(), getType(column.getDataType().getType())); } writer = new ColumnFileWriter(createFileMeta(), trevniMetas); if (enabledStats) { this.stats = new TableStatistics(this.schema); } super.init(); }
Tuple tuple = new VTuple(schema.getColumns().size()); for (int i = 0; i < schema.getColumns().size(); i++) { fieldIsNull[i] = true; if ((nullByte & (1 << (i % 8))) != 0) {
fieldIsNull = new boolean[schema.getColumns().size()]; fieldStart = new int[schema.getColumns().size()]; fieldLength = new int[schema.getColumns().size()];
public void init() throws IOException { closed.set(false); firstSchdeuled.set(true); if(!inited) { smContext.requestFileScan(this); } inited = true; progress = 0.0f; tableStats = new TableStats(); if (fragment != null) { tableStats.setNumBytes(fragment.getEndKey()); tableStats.setNumBlocks(1); } if (schema != null) { for(Column eachColumn: schema.getColumns()) { ColumnStats columnStats = new ColumnStats(eachColumn); tableStats.addColumnStat(columnStats); } } }
public void init() throws IOException { inited = true; progress = 0.0f; if (fragment != null) { tableStats.setNumBytes(fragment.getEndKey()); tableStats.setNumBlocks(1); } if (schema != null) { for(Column eachColumn: schema.getColumns()) { ColumnStats columnStats = new ColumnStats(eachColumn); tableStats.addColumnStat(columnStats); } } }
public MergeScanner(Configuration conf, Schema schema, TableMeta meta, List<FileFragment> rawFragmentList, Schema target) throws IOException { this.conf = conf; this.schema = schema; this.meta = meta; this.target = target; this.fragments = new ArrayList<FileFragment>(); long numBytes = 0; for (FileFragment eachFileFragment: rawFragmentList) { numBytes += eachFileFragment.getEndKey(); if (eachFileFragment.getEndKey() > 0) { fragments.add(eachFileFragment); } } // it should keep the input order. Otherwise, it causes wrong result of sort queries. this.reset(); if (currentScanner != null) { this.projectable = currentScanner.isProjectable(); this.selectable = currentScanner.isSelectable(); } tableStats = new TableStats(); tableStats.setNumBytes(numBytes); tableStats.setNumBlocks(fragments.size()); for(Column eachColumn: schema.getColumns()) { ColumnStats columnStats = new ColumnStats(eachColumn); tableStats.addColumnStat(columnStats); } }