@Override public int getTotalSizeInBytes() { if (totalLengthInBytes > 0) { return totalLengthInBytes; } else { return super.getTotalSizeInBytes(); } } }
/** * Add the index row to dataMapRows, basically to in memory. * * @param indexRow * @return */ @Override public void addIndexRow(CarbonRowSchema[] schema, DataMapRow indexRow) throws MemoryException { dataMapRows.add(indexRow); runningLength += indexRow.getTotalSizeInBytes(); }
/** * Add the index row to unsafe. * * @param indexRow * @return */ public void addIndexRow(CarbonRowSchema[] schema, DataMapRow indexRow) throws MemoryException { // First calculate the required memory to keep the row in unsafe int rowSize = indexRow.getTotalSizeInBytes(); // Check whether allocated memory is sufficient or not. ensureSize(rowSize); int pointer = runningLength; for (int i = 0; i < schema.length; i++) { addToUnsafe(schema[i], indexRow, i); } pointers[rowCount++] = pointer; }
private int getSizeInBytes(int ordinal, int position) { switch (schemas[ordinal].getSchemaType()) { case FIXED: return schemas[ordinal].getLength(); case VARIABLE_SHORT: return getLengthInBytes(ordinal, position) + 2; case VARIABLE_INT: return getLengthInBytes(ordinal, position) + 4; case STRUCT: return getRow(ordinal).getTotalSizeInBytes(); default: throw new UnsupportedOperationException("wrong type"); } }
public int getSizeInBytes(int ordinal) { switch (schemas[ordinal].getSchemaType()) { case FIXED: return schemas[ordinal].getLength(); case VARIABLE_SHORT: return getLengthInBytes(ordinal) + 2; case VARIABLE_INT: return getLengthInBytes(ordinal) + 4; case STRUCT: DataMapRow row = getRow(ordinal); CarbonRowSchema[] childSchemas = ((CarbonRowSchema.StructCarbonRowSchema) schemas[ordinal]).getChildSchemas(); // set the child schema. Because schema is transient it can be null row.setSchemas(childSchemas); return getRow(ordinal).getTotalSizeInBytes(); default: throw new UnsupportedOperationException("wrong type"); } }
DataMapRow structRow = ((UnsafeDataMapRow) getRow(i)).convertToSafeRow(); row.setRow(structRow, i); runningLength += structRow.getTotalSizeInBytes(); break; default: