[ 
https://issues.apache.org/jira/browse/GEODE-8512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17210442#comment-17210442
 ] 

ASF GitHub Bot commented on GEODE-8512:
---------------------------------------

gaussianrecurrence commented on a change in pull request #661:
URL: https://github.com/apache/geode-native/pull/661#discussion_r501994956



##########
File path: cppcache/integration/test/PdxJsonTypeTest.cpp
##########
@@ -68,6 +68,32 @@ std::shared_ptr<Region> setupRegion(Cache& cache) {
   return region;
 }
 
+TEST(PdxJsonTypeTest, testGfshQueryJsonInstances) {
+  Cluster cluster{LocatorCount{1}, ServerCount{1}};
+  cluster.start();
+
+  auto& gfsh = cluster.getGfsh();
+  gfsh.create().region().withName("region").withType("REPLICATE").execute();
+
+  auto cache = cluster.createCache();
+  auto region = setupRegion(cache);
+  const std::string query_stmt{"SELECT * FROM /region"};
+
+  region->put("non-java-domain-class-entry",
+              cache.createPdxInstanceFactory(gemfireJsonClassName, false)
+                  .writeString("foo", "bar")
+                  .create());
+
+  EXPECT_NO_THROW(gfsh.query(query_stmt).execute());
+
+  region->put("java-domain-class-entry",
+              cache.createPdxInstanceFactory(gemfireJsonClassName)
+                  .writeString("foo", "bar")
+                  .create());
+
+  EXPECT_THROW(gfsh.query(query_stmt).execute(), GfshExecuteException);

Review comment:
       Ok, so I've been going throught the query engine code of the server and 
finally located the problem.
   As I feared org.apache.geode.cache.query.internal.Bag addAndGetOccurence 
method uses mapGet on the different objects added, and PdxInstanceImpl hash is 
not considering noJavaDomainClass attribute and neither is the equals operator 
therefore all PdxInstanceImpl with the same hash that are equals as of equals 
operator are not added but instead the previous existing copy inside bag is 
duplicated.
   Now the question, and here is where I need your help, is: "Is this a bug or 
a feature?" 
   Because as of my point of view is a bug, but there might be many more 
implications than the one I am able to see.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Be able to specify 'expectDomainClass' when calling createPdxInstanceFactory
> ----------------------------------------------------------------------------
>
>                 Key: GEODE-8512
>                 URL: https://issues.apache.org/jira/browse/GEODE-8512
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>    Affects Versions: 1.13.0
>            Reporter: Mario Salazar de Torres
>            Assignee: Mario Salazar de Torres
>            Priority: Minor
>              Labels: JsonFormatter, pull-request-available
>
> Within Java client, you can specify if the PdxInstance you want to create is 
> a Java domain class or not, but this is not the case for geode-native C++ 
> client.
> Thing is that in order to implement JsonFormatter in C++ client, having this 
> change is mandatory, otherwise creating PdxType's with __GEMFIRE_JSON 
> classname will present some issues while using cquery's.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to