pvillard31 commented on a change in pull request #3570: Fix for NIFI-6422
URL: https://github.com/apache/nifi/pull/3570#discussion_r330638467
##########
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:
I feel like this change is the only change really related to the stack trace
in the associated [JIRA](https://issues.apache.org/jira/browse/NIFI-6422):
````
2019-07-03 08:35:24,964 ERROR [Timer-Driven Process Thread-8]
o.a.n.p.gcp.bigquery.PutBigQueryBatch
PutBigQueryBatch[id=b2b1c6bf-016b-1000-e8c9-b3f9fb5b417e] null:
java.lang.NullPointerException
java.lang.NullPointerException: null
at
org.apache.nifi.processors.gcp.bigquery.BigQueryUtils.mapToField(BigQueryUtils.java:42)
````
If ``mode`` is not defined, then we have the above exception, right?
The other changes are to be case insensitive of the ``type`` field and fix
an issue when dealing with records, right? If that's correct, can you update
the JIRA to also explain these changes?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services