zstan commented on code in PR #12911:
URL: https://github.com/apache/ignite/pull/12911#discussion_r2953037873


##########
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java:
##########
@@ -66,6 +72,93 @@ public void testSqlFieldsQueryWithTopologyChanges() throws 
Exception {
         executeQuery();
     }
 
+    /** */
+    @Test
+    public void testCacheInterceptorOnBeforePut() throws Exception {
+        IgniteEx ignite = startGrid(0);
+
+        var entPerson = new QueryEntity()
+            .setTableName("Person")
+            .setKeyType(Integer.class.getName())
+            .setValueType(Person.class.getName())
+            .addQueryField("id", Integer.class.getName(), null)
+            .addQueryField("age", Integer.class.getName(), null)
+            .addQueryField("name", String.class.getName(), null)
+            .setKeyFieldName("id");
+
+        var entString = new QueryEntity()
+            .setKeyType(Integer.class.getName())
+            .setValueType(String.class.getName())
+            .setKeyFieldName("id")
+            .setValueFieldName("val")
+            .addQueryField("id", Integer.class.getName(), null)
+            .addQueryField("val", String.class.getName(), null);
+
+        var cacheObjectCfg = new CacheConfiguration<Integer, 
Object>("mixedCache")
+            .setSqlSchema("PUBLIC")
+            .setInterceptor(new TestObjectCacheInterceptor())
+            .setQueryEntities(List.of(entPerson, 
entString.setTableName("StringMix")));
+
+        var cacheStringCfg = new CacheConfiguration<Integer, 
String>("singleValCache")
+            .setSqlSchema("PUBLIC")
+            .setInterceptor(new TestStringCacheInterceptor())
+            .setQueryEntities(List.of(new 
QueryEntity(entString).setTableName("String")));
+
+        IgniteCache<Integer, Object> mixedCache = 
ignite.getOrCreateCache(cacheObjectCfg);
+        IgniteCache<Integer, String> singleCache = 
ignite.getOrCreateCache(cacheStringCfg);
+
+        mixedCache.withKeepBinary().query(new SqlFieldsQuery("INSERT INTO 
PUBLIC.Person(id, age, name) VALUES (1, 2, 'name')"));
+        // Check cache interceptor will process binary object representation.
+        assertTrue(TestObjectCacheInterceptor.putBinaryRaised.get());
+        TestObjectCacheInterceptor.putBinaryRaised.set(false);
+
+        mixedCache.query(new SqlFieldsQuery("INSERT INTO PUBLIC.Person(id, 
age, name) VALUES (2, 2, 'name')"));
+        // Check cache interceptor will process custom object representation.
+        assertFalse(TestObjectCacheInterceptor.putBinaryRaised.get());

Review Comment:
   it need to be passed here but it didn`t



-- 
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]

Reply via email to