gnodet-bot commented on code in PR #30452:
URL: https://github.com/apache/camel/pull/30452#discussion_r4634356165
##########
components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/transform/PineconeEmbeddingsDataTypeTransformer.java:
##########
@@ -63,9 +63,14 @@ public void transform(Message message, DataType fromType,
DataType toType) {
}
TextSegment text = message.getBody(TextSegment.class);
String indexId = message.getHeader(PineconeVectorDbHeaders.INDEX_ID,
UUID.randomUUID(), String.class);
- String indexName =
message.getHeader(PineconeVectorDbHeaders.INDEX_NAME, "embeddings",
String.class);
+ // the index name is left unset when the route does not set it, so
that the producer uses the indexName
+ // of its endpoint; a default here would override the endpoint option,
as the producer takes the
+ // header over the option
+ String indexName =
message.getHeader(PineconeVectorDbHeaders.INDEX_NAME, String.class);
+ if (indexName != null) {
+ message.setHeader(PineconeVectorDbHeaders.INDEX_NAME, indexName);
+ }
Review Comment:
**[low]** The `if (indexName != null)` block is a no-op. `getHeader(KEY,
String.class)` returns the header value already stored in the message if
present, or `null` if absent. Writing the same value back is redundant — the
header is already there. The variable `indexName` is used only for this call,
so the entire block can be removed with no behaviour change:
```suggestion
```
(Remove lines 69–72; the comments on lines 66–68 already explain the intent.)
--
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]