You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2019/03/05 05:05:30 UTC

[GitHub] [incubator-pinot] snleee commented on a change in pull request #3895: Fix the RecordReader to pick incoming time column

snleee commented on a change in pull request #3895: Fix the RecordReader to pick incoming time column
URL: https://github.com/apache/incubator-pinot/pull/3895#discussion_r262347759
 
 

 ##########
 File path: pinot-core/src/main/java/org/apache/pinot/core/data/readers/JSONRecordReader.java
 ##########
 @@ -71,25 +73,19 @@ public GenericRow next() {
     return next(new GenericRow());
   }
 
+  // NOTE: hard to extract common code further
+  @SuppressWarnings("Duplicates")
   @Override
   public GenericRow next(GenericRow reuse) {
     Map record = _iterator.next();
-
-    for (FieldSpec fieldSpec : _schema.getAllFieldSpecs()) {
+    for (FieldSpec fieldSpec : _fieldSpecs) {
       String fieldName = fieldSpec.getName();
-      Object jsonValue = record.get(fieldName);
-
-      Object value;
-      if (fieldSpec.isSingleValueField()) {
-        String token = jsonValue != null ? jsonValue.toString() : null;
-        value = RecordReaderUtils.convertToDataType(token, fieldSpec);
-      } else {
-        value = RecordReaderUtils.convertToDataTypeArray((ArrayList) jsonValue, fieldSpec);
+      Object value = record.get(fieldName);
+      // Allow default value for non-time columns
+      if (value != null || fieldSpec.getFieldType() != FieldSpec.FieldType.TIME) {
 
 Review comment:
   Instead of ignoring `null` time column values, maybe it's better to throw the exception? How do you think?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org