You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/12/05 14:57:03 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #6757: NIFI-10944 FixTestConvertAvroToParquet

exceptionfactory commented on code in PR #6757:
URL: https://github.com/apache/nifi/pull/6757#discussion_r1039703169


##########
nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/test/java/org/apache/nifi/processors/parquet/TestConvertAvroToParquet.java:
##########
@@ -228,8 +229,17 @@ public void testData() throws Exception {
         assertEquals(firstRecord.getGroup("myarray",0).getGroup("list",1).getInteger("element", 0), 2);
 
         // Map
-        assertEquals(firstRecord.getGroup("mymap",0).getGroup("key_value",0).getInteger("value", 0), 1);
-        assertEquals(firstRecord.getGroup("mymap",0).getGroup("key_value",1).getInteger("value", 0), 2);
+        String key1 = firstRecord.getGroup("mymap",0).getGroup("key_value",0).getValueToString(0,0);
+        String key2 = firstRecord.getGroup("mymap",0).getGroup("key_value",1).getValueToString(0,0);
+        int v1 = firstRecord.getGroup("mymap",0).getGroup("key_value",0).getInteger("value", 0);
+        int v2 = firstRecord.getGroup("mymap",0).getGroup("key_value",1).getInteger("value", 0);
+        Map<String,Integer> mymap = new HashMap<String,Integer>();

Review Comment:
   Recommend renaming and using LinkedHashMap:
   ```suggestion
           Map<String,Integer> recordData = new LinkedHashMap<String,Integer>();
   ```



##########
nifi-nar-bundles/nifi-parquet-bundle/nifi-parquet-processors/src/test/java/org/apache/nifi/processors/parquet/TestConvertAvroToParquet.java:
##########
@@ -228,8 +229,17 @@ public void testData() throws Exception {
         assertEquals(firstRecord.getGroup("myarray",0).getGroup("list",1).getInteger("element", 0), 2);
 
         // Map
-        assertEquals(firstRecord.getGroup("mymap",0).getGroup("key_value",0).getInteger("value", 0), 1);
-        assertEquals(firstRecord.getGroup("mymap",0).getGroup("key_value",1).getInteger("value", 0), 2);
+        String key1 = firstRecord.getGroup("mymap",0).getGroup("key_value",0).getValueToString(0,0);
+        String key2 = firstRecord.getGroup("mymap",0).getGroup("key_value",1).getValueToString(0,0);
+        int v1 = firstRecord.getGroup("mymap",0).getGroup("key_value",0).getInteger("value", 0);
+        int v2 = firstRecord.getGroup("mymap",0).getGroup("key_value",1).getInteger("value", 0);
+        Map<String,Integer> mymap = new HashMap<String,Integer>();
+        mymap.put(key1,v1);
+        mymap.put(key2,v2);
+         Map<String,Integer> inputData = new HashMap<String,Integer>();
+        inputData.put("a",1);
+        inputData.put("b",2);
+        assertTrue(mymap.equals(inputData));

Review Comment:
   This should be changed to use `assertEquals`:
   ```suggestion
           assertEquals(inputData, mymap);
   ```



-- 
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: issues-unsubscribe@nifi.apache.org

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