Skip to content

Commit

Permalink
Fix intermediate output of MaxMinByAccumulator in TableModel
Browse files Browse the repository at this point in the history
  • Loading branch information
Wei-hao-Li authored Nov 18, 2024
1 parent 63da4a4 commit 8a84787
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,11 @@ public void minByTest() {
expectedHeader,
retArray,
DATABASE_NAME);

expectedHeader = new String[] {"_col0"};
retArray = new String[] {"40,"};
tableResultSetEqualTest(
"select min_by(s1, s10) from table1 where s1=40", expectedHeader, retArray, DATABASE_NAME);
}

@Test
Expand Down Expand Up @@ -1746,6 +1751,11 @@ public void maxByTest() {
expectedHeader,
retArray,
DATABASE_NAME);

expectedHeader = new String[] {"_col0"};
retArray = new String[] {"40,"};
tableResultSetEqualTest(
"select max_by(s1, s10) from table1 where s1=40", expectedHeader, retArray, DATABASE_NAME);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,16 @@ private void updateX(Column xColumn, int xIndex) {

private byte[] serialize() {
byte[] valueBytes;
int yLength = calcTypeSize(yDataType, yExtremeValue);
if (xNull) {
valueBytes = new byte[calcTypeSize(yDataType, yExtremeValue) + 1];
valueBytes = new byte[yLength + 1];
serializeValue(yDataType, yExtremeValue, valueBytes, 0);
BytesUtils.boolToBytes(true, valueBytes, 8);
BytesUtils.boolToBytes(true, valueBytes, yLength);
} else {
valueBytes =
new byte[calcTypeSize(yDataType, yExtremeValue) + 1 + calcTypeSize(xDataType, xResult)];
valueBytes = new byte[yLength + 1 + calcTypeSize(xDataType, xResult)];
int offset = 0;
serializeValue(yDataType, yExtremeValue, valueBytes, offset);
offset = calcTypeSize(yDataType, yExtremeValue);
offset = yLength;

BytesUtils.boolToBytes(false, valueBytes, offset);
offset += 1;
Expand Down

0 comments on commit 8a84787

Please sign in to comment.