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

[fix][io] add protobuf ByteString to pulsar-io jdbc core #20259

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -184,7 +184,7 @@ flexible messaging model and an intuitive client API.</description>
<sqlite-jdbc.version>3.36.0.3</sqlite-jdbc.version>
<mysql-jdbc.version>8.0.11</mysql-jdbc.version>
<postgresql-jdbc.version>42.5.1</postgresql-jdbc.version>
<clickhouse-jdbc.version>0.3.2-patch11</clickhouse-jdbc.version>
<clickhouse-jdbc.version>0.4.6</clickhouse-jdbc.version>
<mariadb-jdbc.version>2.7.5</mariadb-jdbc.version>
<openmldb-jdbc.version>0.4.4-hotfix1</openmldb-jdbc.version>
<hdfs-offload-version3>3.3.5</hdfs-offload-version3>
Expand Down
8 changes: 8 additions & 0 deletions pulsar-io/jdbc/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
tisonkun marked this conversation as resolved.
Show resolved Hide resolved
<scope>provided</scope>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.google.protobuf.ByteString;
import lombok.extern.slf4j.Slf4j;
import org.apache.avro.Schema;
import org.apache.pulsar.client.api.schema.GenericObject;
Expand Down Expand Up @@ -185,8 +186,10 @@ private static void setColumnValue(PreparedStatement statement, int index, Objec
statement.setString(index, (String) value);
} else if (value instanceof Short) {
statement.setShort(index, (Short) value);
} else if (value instanceof ByteString) {
statement.setBytes(index, ((ByteString) value).toByteArray());
} else {
throw new Exception("Not support value type, need to add it. " + value.getClass());
throw new Exception("Not supported value type, need to add it. " + value.getClass());
}
}

Expand Down