nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi] pvillard31 commented on a change in pull request #3570: Fix for NIFI-6422
Date Thu, 03 Oct 2019 07:19:05 GMT
pvillard31 commented on a change in pull request #3570: Fix for NIFI-6422
URL: https://github.com/apache/nifi/pull/3570#discussion_r330893970
 
 

 ##########
 File path: nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/BigQueryUtils.java
 ##########
 @@ -33,44 +36,79 @@
  * Util class for schema manipulation
  */
 public class BigQueryUtils {
+    /**
+     * Exception thrown when a given type can't be transformed into a valid BigQuery type.
+     *
+     */
+    public static class BadTypeNameException extends ProcessException {
+        public BadTypeNameException(String message) {
+            super(message);
+        }
+    }
+
 
     private final static Type gsonSchemaType = new TypeToken<List<Map>>() { }.getType();
 
     public static Field mapToField(Map fMap) {
-        String typeStr = fMap.get("type").toString();
+        String typeStr = fMap.get("type").toString().toUpperCase();
         String nameStr = fMap.get("name").toString();
-        String modeStr = fMap.get("mode").toString();
+        String modeStr;
+        if(fMap.containsKey("mode")) {
+            modeStr = fMap.get("mode").toString();
+        } else {
+            modeStr = Mode.NULLABLE.name();
+        }
 
 Review comment:
   Also do you mind adding a unit test containing embedded records? to confirm the recursive
part of the schema parsing?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message