korlov42 commented on code in PR #1700:
URL: https://github.com/apache/ignite-3/pull/1700#discussion_r1117028444
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/IgniteTableImpl.java:
##########
@@ -503,4 +617,81 @@ public IgniteDistribution getDistribution() {
return distribution();
}
}
+
+ private static int[] project(int columnCount, int[] source, BitSet
usedFields) {
+ int[] deltas = new int[columnCount];
+ int[] projection = new int[source.length];
+
+ for (int currentIndex = 0, nextIndex = usedFields.nextSetBit(0);
+ nextIndex != -1; nextIndex = usedFields.nextSetBit(nextIndex +
1), currentIndex++) {
+ deltas[nextIndex] = -(nextIndex - currentIndex);
+ }
+
+ for (int i = 0; i < source.length; i++) {
+ projection[i] = source[i] + deltas[source[i]];
+ }
+
+ return projection;
+ }
+
+ private static <RowT> void injectDefaults(
+ TableDescriptor tableDescriptor,
+ RowHandler<RowT> handler,
+ List<RowT> rows
+ ) {
+ for (RowT row : rows) {
+ for (int i = 0; i < tableDescriptor.columnsCount(); i++) {
+ ColumnDescriptor columnDescriptor =
tableDescriptor.columnDescriptor(i);
+
+ Object oldValue = handler.get(columnDescriptor.logicalIndex(),
row);
+
+ Object newValue;
+ if (columnDescriptor.key()
+ && Commons.implicitPkEnabled()
+ &&
Commons.IMPLICIT_PK_COL_NAME.equals(columnDescriptor.name())
+ ) {
+ newValue = columnDescriptor.defaultValue();
+ } else {
+ newValue =
replaceDefaultValuePlaceholder(handler.get(columnDescriptor.logicalIndex(),
row), columnDescriptor);
Review Comment:
good catch! fixed
--
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]