-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1876 from ClickHouse/v2_fix_aggregate_function_serde
[client-v2] Fix Bitmap SerDe
- Loading branch information
Showing
14 changed files
with
195 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
client-v2/src/test/java/com/clickhouse/client/internal/SerializerUtilsTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
client-v2/src/test/java/com/clickhouse/client/query/AggregateFuncDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.clickhouse.client.query; | ||
|
||
import com.clickhouse.data.value.ClickHouseBitmap; | ||
|
||
import java.util.Objects; | ||
import java.util.Random; | ||
|
||
public class AggregateFuncDTO { | ||
|
||
private ClickHouseBitmap groupBitmapUint32; | ||
private ClickHouseBitmap groupBitmapUint64; | ||
|
||
public AggregateFuncDTO() { | ||
Random random = new Random(); | ||
this.groupBitmapUint32 = ClickHouseBitmap.wrap(random.ints(5, Integer.MAX_VALUE - 100, Integer.MAX_VALUE).toArray()); | ||
this.groupBitmapUint64 = ClickHouseBitmap.wrap(random.longs(5, Long.MAX_VALUE - 100, Long.MAX_VALUE).toArray()); | ||
} | ||
|
||
public ClickHouseBitmap getGroupBitmapUint32() { | ||
return groupBitmapUint32; | ||
} | ||
|
||
public void setGroupBitmapUint32(ClickHouseBitmap groupBitmapUint32) { | ||
this.groupBitmapUint32 = groupBitmapUint32; | ||
} | ||
|
||
public ClickHouseBitmap getGroupBitmapUint64() { | ||
return groupBitmapUint64; | ||
} | ||
|
||
public void setGroupBitmapUint64(ClickHouseBitmap groupBitmapUint64) { | ||
this.groupBitmapUint64 = groupBitmapUint64; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
AggregateFuncDTO that = (AggregateFuncDTO) o; | ||
return Objects.equals(groupBitmapUint32, that.groupBitmapUint32) && Objects.equals(groupBitmapUint64, that.groupBitmapUint64); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(groupBitmapUint32, groupBitmapUint64); | ||
} | ||
|
||
public static String generateTableCreateSQL(String tableName) { | ||
return "CREATE TABLE " + tableName + " (" + | ||
"groupBitmapUint32 AggregateFunction(groupBitmap, UInt32), " + | ||
"groupBitmapUint64 AggregateFunction(groupBitmap, UInt64) " + | ||
") ENGINE = MergeTree() ORDER BY tuple()"; | ||
} | ||
} |
Oops, something went wrong.