[
https://issues.apache.org/jira/browse/NIFI-4940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16388109#comment-16388109
]
ASF GitHub Bot commented on NIFI-4940:
--------------------------------------
Github user zenfenan commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2513#discussion_r172590173
--- Diff:
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/CSVHeaderSchemaStrategy.java
---
@@ -79,4 +81,12 @@ public RecordSchema getSchema(Map<String, String>
variables, final InputStream c
public Set<SchemaField> getSuppliedSchemaFields() {
return schemaFields;
}
+
+ private String normalizeNameForAvro(String inputName) {
+ String normalizedName = inputName.replaceAll("[^A-Za-z0-9_]", "_");
--- End diff --
How about this `[^A-Za-z0-9_]+`? So rather than adding N underscores for
continuous non-compatible characters, it adds a single `_`.
> CSVReader - Header schema strategy - normalize names
> ----------------------------------------------------
>
> Key: NIFI-4940
> URL: https://issues.apache.org/jira/browse/NIFI-4940
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Reporter: Pierre Villard
> Assignee: Pierre Villard
> Priority: Major
>
> When using the CSV Reader with the Header Schema Strategy access, we should
> add a property (boolean) in case field names should be normalized to be avro
> compatible. Otherwise it won't be possible, for instance, to use the
> UpdateRecord processor and access a field with a "weird" name.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)