Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-13458

IoTDB Extension Incorrect Result when Parsing Column Name with Backquotes And Dots

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.0-M3
    • None
    • Extensions

    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:

      1. Create another method in DatabaseSchema to make the map easier as I mentioned above;
      2. 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

      1. add new method:
        1. Pros: Easy to implement
        2. Cons: Lost the ability to support column name like device1.col1, device2.col1
      2. update parseSchema():
        1. Pros: Minimum changes
        2. Cons: Possibly low efficiency if column name has "`"

       
       
       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            sskaje sskaje
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: