Browse Source

HPCC-10298 CSV auto discovery should check the validity and uniqueness of
the discovered field name.

Fix field name uniqueness testing bug.

Signed-off-by: Attila Vamos <attila.vamos@gmail.com>

Attila Vamos 11 years ago
parent
commit
d61db404d8
1 changed files with 18 additions and 18 deletions
  1. 18 18
      dali/ft/daftformat.cpp

+ 18 - 18
dali/ft/daftformat.cpp

@@ -624,21 +624,21 @@ void CCsvPartitioner::storeFieldName(const char * start, unsigned len)
                 fieldName.setCharAt(i, '_');
             }
         }
-
-        // Check discovered field name uniqueness
-        const char * fn = fieldName.toCharArray();
-        if ( fields->find(fn) != NULL )
-        {
-            time_t t;
-            time(&t);
-            fieldName.append('_').append(fieldCount).append('_').append((unsigned)t);
-        }
     }
     else
     {
         fieldName.append("field").append(fieldCount);
     }
 
+    // Check discovered field name uniqueness
+    const char * fn = fieldName.toCharArray();
+    if ( fields->find(fn) != NULL )
+    {
+        time_t t;
+        time(&t);
+        fieldName.append('_').append(fieldCount).append('_').append((unsigned)t);
+    }
+
     recordStructure.append(fieldName);
     recordStructure.append(";\n");
 
@@ -953,21 +953,21 @@ void CUtfPartitioner::storeFieldName(const char * start, unsigned len)
                 fieldName.setCharAt(i, '_');
             }
         }
-
-        // Check discovered field name uniqueness
-        const char * fn = fieldName.toCharArray();
-        if ( fields->find(fn) != NULL )
-        {
-            time_t t;
-            time(&t);
-            fieldName.append('_').append(fieldCount).append('_').append((unsigned)t);
-        }
     }
     else
     {
         fieldName.append("field").append(fieldCount);
     }
 
+    // Check discovered field name uniqueness
+    const char * fn = fieldName.toCharArray();
+    if ( fields->find(fn) != NULL )
+    {
+        time_t t;
+        time(&t);
+        fieldName.append('_').append(fieldCount).append('_').append((unsigned)t);
+    }
+
     recordStructure.append(fieldName);
     recordStructure.append(";\n");