tledkov-gridgain commented on a change in pull request #168:
URL: https://github.com/apache/ignite-3/pull/168#discussion_r669571612
##########
File path:
modules/schema/src/main/java/org/apache/ignite/internal/schema/row/RowAssembler.java
##########
@@ -499,86 +575,89 @@ private void checkType(NativeType type) {
}
/**
- * Sets null flag in the null map for the given column.
+ * Sets null flag in the null-map for the given column.
*
* @param colIdx Column index.
*/
private void setNull(int colIdx) {
- assert (flags & (baseOff == BinaryRow.KEY_CHUNK_OFFSET ?
RowFlags.OMIT_KEY_NULL_MAP_FLAG : RowFlags.OMIT_VAL_NULL_MAP_FLAG)) == 0 :
- "Illegal writing 'null' value when 'omit null-map' flag is set for
a chunk.";
+ assert nullMapOff < varTblOff : "Null-map is omitted.";
- int byteInMap = colIdx / 8;
- int bitInByte = colIdx % 8;
+ int byteInMap = colIdx >> 3; // Equivalent expression for: colIidx / 8
+ int bitInByte = colIdx & 7; // Equivalent expression for: colIdx % 8
buf.ensureCapacity(nullMapOff + byteInMap + 1);
- buf.put(nullMapOff + byteInMap, (byte)(buf.get(nullMapOff + byteInMap)
| (1 << bitInByte)));
+ buf.put(nullMapOff + byteInMap,
(byte)((Byte.toUnsignedInt(buf.get(nullMapOff + byteInMap))) | (1 <<
bitInByte)));
}
/**
- * Must be called after an append of fixlen column.
- *
- * @param type Type of the appended column.
+ * Shifts current column indexes as necessary, also
+ * switch to value chunk writer when moving from key to value columns.
*/
- private void shiftColumn(NativeType type) {
- assert type.spec().fixedLength() : "Varlen types should provide field
length to shift column: " + type;
-
- shiftColumn(type.sizeInBytes(), false);
- }
-
- /**
- * Shifts current offsets and column indexes as necessary, also changes
the chunk base offsets when
- * moving from key to value columns.
- *
- * @param size Size of the appended column.
- * @param varlen {@code true} if appended column was varlen.
- */
- private void shiftColumn(int size, boolean varlen) {
+ private void shiftColumn(int size) {
curCol++;
curOff += size;
- if (varlen)
- curVarlenTblEntry++;
-
if (curCol == curCols.length()) {
- int chunkLen = curOff - baseOff;
+ if (curVartblEntry > 1) {
+ assert varTblOff < dataOff : "Illegal writing of varlen when
'omit vartable' flag is set for a chunk.";
+ assert varTblOff + varTableChunkLength(curVartblEntry,
Integer.BYTES) == dataOff : "Vartable overlow: size=" + curVartblEntry;
+
+ final VarTableFormat format = VarTableFormat.format( curOff -
dataOff);
Review comment:
Remove space after open brace
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]