arjansh commented on a change in pull request #230: dev/add datatypes to excel 
columns
URL: https://github.com/apache/metamodel/pull/230#discussion_r328937574
 
 

 ##########
 File path: 
excel/src/main/java/org/apache/metamodel/excel/DefaultSpreadsheetReaderDelegate.java
 ##########
 @@ -167,50 +167,109 @@ private MutableTable createTable(final Workbook wb, 
final Sheet sheet) {
                     break;
                 }
             }
-
             if (hasColumns) {
-                createColumns(table, wb, row);
+                createColumns(table, wb, row, columnTypes);
             }
         }
-
         return table;
     }
 
+    private ColumnType[] getColumnTypes(final Sheet sheet, final Row row) {
+        final Iterator<Row> data = ExcelUtils.getRowIterator(sheet, 
_configuration, false);
+        final int rowLength = row.getLastCellNum();
+        int eagerness = 1000;
+        final ColumnType[] columnTypes = new ColumnType[rowLength];
+
+        while (data.hasNext() && eagerness-- > 0) {
+            Row currentRow = data.next();
+            for (int index = 0; index < rowLength; index++) {
+                if (currentRow.getLastCellNum() == 0) {
+                    continue;
+                }
+                if (currentRow.getCell(index) == null) {
 
 Review comment:
   Can you change the logic a bit around here. I would propose you extract 
lines 189 through 218 into a separate method which returns the `ColumnType` of 
a cell in a row. And then move the logic from lines 225 through 231 into this 
method deciding whether or not to assign that value to the `columnTypes` array.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to