MatrixHB commented on code in PR #63:
URL: 
https://github.com/apache/rocketmq-schema-registry/pull/63#discussion_r975976054


##########
storage-rocketmq/src/main/java/org/apache/rocketmq/schema/registry/storage/rocketmq/RocketmqStorageClientImpl.java:
##########
@@ -113,6 +113,21 @@ public SchemaRecordInfo getBySubject(QualifiedName 
qualifiedName) {
         return versionSchemaMap.get(qualifiedName.getVersion());
     }
 
+    @Override
+    public SchemaRecordInfo getTargetSchema(QualifiedName qualifiedName) {
+        // schema version is given
+        SchemaInfo schemaInfo = 
rocketmqClient.getSchemaInfoBySubject(qualifiedName.subjectFullName());
+        if (schemaInfo == null || schemaInfo.getDetails() == null || 
schemaInfo.getDetails().getSchemaRecords() == null) {
+            return null;
+        }
+        for (SchemaRecordInfo schemaRecordInfo : 
schemaInfo.getDetails().getSchemaRecords()) {
+            if (schemaRecordInfo.getIdl().equals(qualifiedName.getSchema())) {
+                return schemaRecordInfo;
+            }
+        }
+        return null;

Review Comment:
   Is there any problem in simply comparing IDL by string "equals"? Some IDLs 
with different strings actually express equivalent meanings, for example, 
fields change order.
   单纯将IDL进行字符串的equals比较,是否有问题? 有些字符串不完全一样的IDL,实际上表达的意义是等价的,比如字段调换了顺序
   
   



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