pjfanning commented on a change in pull request #2428:
URL: https://github.com/apache/drill/pull/2428#discussion_r785376059



##########
File path: 
contrib/format-excel/src/main/java/org/apache/drill/exec/store/excel/ExcelBatchReader.java
##########
@@ -364,6 +368,27 @@ private void getColumnHeaders(SchemaBuilder builder) {
     builder.buildSchema();
   }
 
+  /**
+   * This function verifies whether a given column name is already present in 
the projected schema.
+   * If so, it appends _n to the column name.  N will be incremented for every 
duplicate column
+   * @param columnName The original column
+   * @return The deconflicted column name
+   */
+  private String deconflictColumnNames(String columnName) {
+    Pattern pattern = Pattern.compile("_(\\d+)$");
+    Matcher matcher = pattern.matcher(columnName);
+    while (excelFieldNames.contains(columnName)) {

Review comment:
       Does case matter because `contains` is case sensitive? - so if col1 is 
called 'Column' and col2 is called 'column' then this code won't rename col2.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to