pseudomo opened a new issue #2466:
URL: https://github.com/apache/drill/issues/2466


   Select from dfs.`path_to_sas_file` fails with error "Cannot invoke 
"Object.getClass()" because "this.firstRow[counter]" is null"
    if the first row of the file contains null values.
   
   Can be reproduced with any sas file that contain null values in the first 
row.
   Apparently, the problem is here:
   
drill\contrib\format-sas\src\main\java\org\apache\drill\exec\store\sas\SasBatchReader.java
   
   ```
   private TupleMetadata buildSchema() {
       SchemaBuilder builder = new SchemaBuilder();
       List<Column> columns = sasFileReader.getColumns();
       int counter = 0;
       for (Column column : columns) {
         String fieldName = column.getName();
         try {
           MinorType type = 
getType(**firstRow[counter].getClass()**.getSimpleName());
           if (type == MinorType.BIGINT && !column.getFormat().isEmpty()) {
             logger.debug("Found possible time");
             type = MinorType.TIME;
           }
           builder.addNullable(fieldName, type);
         } catch (Exception e) {
           throw UserException.dataReadError()
             .message("Error with column type: " + 
firstRow[counter].getClass().getSimpleName())
             .addContext(errorContext)
             .build(logger);
         }
         counter++;
       }
   
       return builder.buildSchema();
     }
   ```
   
   
![image](https://user-images.githubusercontent.com/11786376/154575424-1bb86df3-8a1f-4477-93a1-2b97d7c09fbc.png)
   


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