Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.0.0-M3
-
None
Description
I'm using NiFi with IoTDB, My CSV data has columns with symbols, like '.', so I surround the column name with backquotes "`".
In this case, AbstractIoTDB.parseSchema(), which returns map like
{"root.sth.device": ["col1", "col2"]}, returns incorrect result, for example "root.sth.device.`my column.with.dot`" will be parsed to {"root.sth.device.`my column.with": ["dot`"]}.
Class DatabaseSchema in IoTDB has a method getFieldNames() joins prefix ("root.sth.device.") with field names("col1", "col2", etc.) , and then parse back in AbstractIoTDB.generateTablets() with AbstractIoTDB.parseSchema().
Why not just create another DatabaseSchema method return a map with key=StringUtils.stripEnd(prefix) and values=fieldNames.
So there are two ways to fix this issue:
- Create another method in DatabaseSchema to make the map easier as I mentioned above;
- Update AbstractIoTDB.parseSchema() to support dots and backquotes in column names.
For the second way, I've added a new AbstractIoTDB.parseSchema() in my environment, to support such case, diff attached.
This changes detects if column name has backquote "`": if no use previous method; if yes and they are in pairs, generate correct results.
Pros and Cons
- add new method:
- Pros: Easy to implement
- Cons: Lost the ability to support column name like device1.col1, device2.col1
- update parseSchema():
- Pros: Minimum changes
- Cons: Possibly low efficiency if column name has "`"