oleg-vlsk commented on code in PR #13583:
URL: https://github.com/apache/ignite/pull/13583#discussion_r4433799825
##########
modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java:
##########
@@ -2075,42 +2090,36 @@ public CacheConfiguration<K, V>
setPartitionLossPolicy(PartitionLossPolicy partL
/**
* Sets query entities configuration.
+ * <p>
+ * This method must not be used together with {@link #setIndexedTypes}.
+ * <p>
+ * Repeated calls replace the query entities configured by the previous
call.
+ * Passing an empty collection clears the existing query entities.
*
* @param qryEntities Query entities.
* @return {@code this} for chaining.
+ * @throws CacheException If query entities have already been configured
through {@link #setIndexedTypes}.
*/
public CacheConfiguration<K, V> setQueryEntities(Collection<QueryEntity>
qryEntities) {
- if (this.qryEntities == null) {
- this.qryEntities = new ArrayList<>(qryEntities);
-
- return this;
- }
+
checkQueryEntityConfigurationSource(QueryEntityConfigurationSource.QUERY_ENTITIES);
- for (QueryEntity entity : qryEntities) {
- boolean found = false;
+ this.qryEntities = new ArrayList<>(qryEntities);
- for (QueryEntity existing : this.qryEntities) {
- if (Objects.equals(entity.findValueType(),
existing.findValueType())) {
- found = true;
-
- break;
- }
- }
-
- if (!found)
- this.qryEntities.add(entity);
- }
+ qryEntityCfgSrc = QueryEntityConfigurationSource.QUERY_ENTITIES;
return this;
}
Review Comment:
Added fallback to an empty collection for the `null` argument.
--
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]