问题描述
当我将hazelcast存储数据与imap和hazelcastjsonvalue一起使用时,我无法查询不正确的结果,例如“ side ='1'”之类的sql。我想是因为json包含“国债”之类的汉字。如何解决这个问题?如果可以设置hazelcast的某些配置以支持汉字。这样的代码,System.out.println()结果为{},应包含json:
Gson gson = new Gson();
String json = "{\"orderId\":\"-20200822-221116-188-quote-100002\",\"securityId\":\"130015\",\"TradingAccount\":\"xtrinterbanktra01\",\"subSystemId\":\"QDM-ESP\",\"userId\":\"xtrinterbankat01\",\"securityExchange\":\"B\",\"systemNodeId\":710,\"quoteId\":\"1598145974197\",\"execId\":\"22550774606679263\",\"investAccount\":\"xtrinterbankinvest01\",\"productAccount\":\"xtrinterbankprod01\",\"assetAccount\":\"xtrinterbankasst01\",\"securityAccount\":\"111010032010000205011\",\"securityType\":\"4\",\"settlType\":\"1\",\"orderModel\":\"legs\",\"orderStatus\":\"8\",\"createdTime\":1598145974,\"createdDate\":\"20200824\",\"TradeDate\":\"20200824\",\"positionFlag\":1,\"price\":111.0,\"orderQty\":1.0E7,\"accumulatedExecQty\":1.0E7,\"lastQty\":1.0E7,\"finalFlag\":true,\"symbol\":\"13国债15\",\"side\":\"1\",\"orderVersion\":2,\"classtype\":\"OrderBO\",\"messageId\":87350933198472267,\"uniqueKey\":\"-20200822-221116-188-quote-100002\",\"topicName\":\"order\",\"subject\":\"business/order/130015/B/xtrinterbanktra01/xtrinterbankat01\",\"publisherId\":\"oms-710-9577@168-61-73-136\",\"tenantId\":\"ficc\",\"extFields\":{\"quotaionType\":\"5\",\"clOrdId\":\"-20200822-221116-188-quote-100001\",\"marketIndicator\":\"4\",\"deliveryType\":\"0\",\"transcatTime\":\"1883635200\",\"quoteStaus\":\"16\",\"clearingMethod\":\"13\",\"execType\":\"F\",\"validUnitTime\":\"1883635200\"}}";
String tableName = "__UT_TestMap";
IMap map = instance.getMap(tableName);
map.addindex(new IndexConfig(IndexType.HASH,"orderId"));
map.put("-20200822-221116-188-quote-100002",new HazelcastJsonValue(json));
System.out.println(map.entrySet(Predicates.sql("side='1'")));
解决方法
这看起来像是个错误,因此我对其进行了一些简化,并将其记录为here