Skip to content

Commit 8094d57

Browse files
committed
Improve error message
1 parent c49d75d commit 8094d57

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

core/src/main/java/io/questdb/client/cutlass/qwp/protocol/QwpTableBuffer.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ public ColumnBuffer getOrCreateColumn(String name, byte type, boolean nullable)
169169
columnAccessCursor++;
170170
if (candidate.type != type) {
171171
throw new LineSenderException(
172-
"Column type mismatch for " + name + ": existing=" + candidate.type + " new=" + type
172+
"Column type mismatch for column '" + name + "': columnType="
173+
+ candidate.type + ", sentType=" + type
173174
);
174175
}
175176
return candidate;
@@ -182,7 +183,8 @@ public ColumnBuffer getOrCreateColumn(String name, byte type, boolean nullable)
182183
ColumnBuffer existing = columns.get(idx);
183184
if (existing.type != type) {
184185
throw new LineSenderException(
185-
"Column type mismatch for " + name + ": existing=" + existing.type + " new=" + type
186+
"Column type mismatch for column '" + name + "': columnType="
187+
+ existing.type + ", sentType=" + type
186188
);
187189
}
188190
return existing;
@@ -943,6 +945,14 @@ public int[] getArrayShapes() {
943945
return arrayShapes;
944946
}
945947

948+
/**
949+
* Returns the off-heap address of the auxiliary data buffer (global symbol IDs).
950+
* Returns 0 if no auxiliary data exists.
951+
*/
952+
public long getAuxDataAddress() {
953+
return auxBuffer != null ? auxBuffer.pageAddress() : 0;
954+
}
955+
946956
/**
947957
* Returns the total bytes buffered in this column's storage.
948958
*/
@@ -969,14 +979,6 @@ public long getBufferedBytes() {
969979
return bytes;
970980
}
971981

972-
/**
973-
* Returns the off-heap address of the auxiliary data buffer (global symbol IDs).
974-
* Returns 0 if no auxiliary data exists.
975-
*/
976-
public long getAuxDataAddress() {
977-
return auxBuffer != null ? auxBuffer.pageAddress() : 0;
978-
}
979-
980982
/**
981983
* Returns the off-heap address of the column data buffer.
982984
*/

core/src/test/java/io/questdb/client/test/cutlass/qwp/protocol/QwpTableBufferTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@
3030
import io.questdb.client.cutlass.qwp.protocol.QwpTableBuffer;
3131
import io.questdb.client.std.Decimal128;
3232
import io.questdb.client.std.Decimal64;
33-
import static io.questdb.client.test.tools.TestUtils.assertMemoryLeak;
3433
import org.junit.Test;
3534

36-
import static org.junit.Assert.assertArrayEquals;
37-
import static org.junit.Assert.assertEquals;
38-
import static org.junit.Assert.fail;
35+
import static io.questdb.client.test.tools.TestUtils.assertMemoryLeak;
36+
import static org.junit.Assert.*;
3937

4038
public class QwpTableBufferTest {
4139

@@ -420,7 +418,7 @@ public void testGetOrCreateColumnConflictingTypeFastPath() throws Exception {
420418
fail("Expected LineSenderException for column type mismatch");
421419
} catch (LineSenderException e) {
422420
assertEquals(
423-
"Column type mismatch for x: existing=" + QwpConstants.TYPE_LONG + " new=" + QwpConstants.TYPE_DOUBLE,
421+
"Column type mismatch for column 'x': columnType=" + QwpConstants.TYPE_LONG + ", sentType=" + QwpConstants.TYPE_DOUBLE,
424422
e.getMessage()
425423
);
426424
}
@@ -445,7 +443,7 @@ public void testGetOrCreateColumnConflictingTypeSlowPath() throws Exception {
445443
fail("Expected LineSenderException for column type mismatch");
446444
} catch (LineSenderException e) {
447445
assertEquals(
448-
"Column type mismatch for b: existing=" + QwpConstants.TYPE_STRING + " new=" + QwpConstants.TYPE_LONG,
446+
"Column type mismatch for column 'b': columnType=" + QwpConstants.TYPE_STRING + ", sentType=" + QwpConstants.TYPE_LONG,
449447
e.getMessage()
450448
);
451449
}

0 commit comments

Comments
 (0)