nicoloboschi commented on code in PR #18668:
URL: https://github.com/apache/pulsar/pull/18668#discussion_r1034518054
##########
pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchSink.java:
##########
@@ -240,20 +240,28 @@ public Pair<String, String>
extractIdAndDocument(Record<GenericObject> record) t
if (id != null
&& idHashingAlgorithm != null
&& idHashingAlgorithm !=
ElasticSearchConfig.IdHashingAlgorithm.NONE) {
- Hasher hasher;
- switch (idHashingAlgorithm) {
- case SHA256:
- hasher = Hashing.sha256().newHasher();
- break;
- case SHA512:
- hasher = Hashing.sha512().newHasher();
- break;
- default:
- throw new UnsupportedOperationException("Unsupported
IdHashingAlgorithm: "
- + idHashingAlgorithm);
+
+ boolean performHashing = true;
+ if (elasticSearchConfig.isConditionalIdHashing()
+ && id.getBytes(StandardCharsets.UTF_8).length <= 512) {
Review Comment:
good catch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]