Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.31.0 with VECTOR support #4

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.debezium</groupId>
<artifactId>mysql-binlog-connector-java</artifactId>
<version>0.30.0</version>
<version>0.31.0</version>

<name>mysql-binlog-connector-java</name>
<description>MySQL Binary Log connector</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class TableMapEventMetadata implements EventData {
private DefaultCharset enumAndSetDefaultCharset;
private List<Integer> enumAndSetColumnCharsets;
private BitSet visibility;
private List<Integer> vectorDimensionality;

public BitSet getSignedness() {
return signedness;
Expand Down Expand Up @@ -134,6 +135,14 @@ public void setVisibility(BitSet visibility) {
this.visibility = visibility;
}

public List<Integer> getVectorDimensionality() {
return vectorDimensionality;
}

public void setVectorDimensionality(List<Integer> vectorDimensionality) {
this.vectorDimensionality = vectorDimensionality;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ protected Serializable deserializeCell(ColumnType type, int meta, int length, By
return deserializeGeometry(meta, inputStream);
case JSON:
return deserializeJson(meta, inputStream);
case VECTOR:
return deserializeVector(meta, inputStream);
default:
throw new IOException("Unsupported type " + type);
}
Expand Down Expand Up @@ -403,6 +405,11 @@ protected Serializable deserializeBlob(int meta, ByteArrayInputStream inputStrea
return inputStream.read(blobLength);
}

protected Serializable deserializeVector(int meta, ByteArrayInputStream inputStream) throws IOException {
int vectorLength = inputStream.readInteger(meta);
return inputStream.read(vectorLength);
}

protected Serializable deserializeEnum(int length, ByteArrayInputStream inputStream) throws IOException {
return inputStream.readInteger(length);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public enum ColumnType {
TIMESTAMP_V2(17),
DATETIME_V2(18),
TIME_V2(19),
VECTOR(242),
JSON(245),
NEWDECIMAL(246),
ENUM(247),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ private int[] readMetadata(ByteArrayInputStream inputStream, byte[] columnTypes)
case BLOB:
case JSON:
case GEOMETRY:
case VECTOR:
metadata[i] = inputStream.readInteger(1);
break;
case BIT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public TableMapEventMetadata deserialize(ByteArrayInputStream inputStream, int n
case VISIBILITY:
result.setVisibility(readBooleanList(inputStream, nColumns));
break;
case VECTOR_DIMENSIONALITY:
result.setVectorDimensionality(readIntegers(inputStream));
break;
default:
inputStream.enterBlock(remainingBytes);
throw new IOException("Unsupported table metadata field type " + code);
Expand Down Expand Up @@ -212,6 +215,7 @@ private enum MetadataFieldType {
ENUM_AND_SET_DEFAULT_CHARSET(10), // Charsets of ENUM and SET columns
ENUM_AND_SET_COLUMN_CHARSET(11), // Charsets of ENUM and SET columns
VISIBILITY(12), // Column visibility (8.0.23 and newer)
VECTOR_DIMENSIONALITY(13), // Vector column dimensionality (9.0.0 and newer)
UNKNOWN_METADATA_FIELD_TYPE(
128); // Returned with binlog-row-metadata=FULL from MySQL 8.0 in some cases

Expand Down
Loading