jihoonson commented on a change in pull request #8823: Add InputSource and 
InputFormat interfaces
URL: https://github.com/apache/incubator-druid/pull/8823#discussion_r344422300
 
 

 ##########
 File path: 
server/src/main/java/org/apache/druid/segment/indexing/DataSchema.java
 ##########
 @@ -53,38 +57,53 @@
   private static final Logger log = new Logger(DataSchema.class);
   private static final Pattern INVALIDCHARS = Pattern.compile("(?s).*[^\\S 
].*");
   private final String dataSource;
-  private final Map<String, Object> parser;
   private final AggregatorFactory[] aggregators;
   private final GranularitySpec granularitySpec;
   private final TransformSpec transformSpec;
+  private final Map<String, Object> parserMap;
+  private final ObjectMapper objectMapper;
 
-  private final ObjectMapper jsonMapper;
+  // The below fields can be initialized lazily from parser for backward 
compatibility.
+  private TimestampSpec timestampSpec;
+  private DimensionsSpec dimensionsSpec;
 
-  private InputRowParser cachedParser;
+  // This is used for backward compatibility
+  private InputRowParser inputRowParser;
 
   @JsonCreator
   public DataSchema(
       @JsonProperty("dataSource") String dataSource,
-      @JsonProperty("parser") Map<String, Object> parser,
+      @JsonProperty("timestampSpec") @Nullable TimestampSpec timestampSpec, // 
can be null in old task spec
+      @JsonProperty("dimensionsSpec") @Nullable DimensionsSpec dimensionsSpec, 
// can be null in old task spec
       @JsonProperty("metricsSpec") AggregatorFactory[] aggregators,
       @JsonProperty("granularitySpec") GranularitySpec granularitySpec,
       @JsonProperty("transformSpec") TransformSpec transformSpec,
-      @JacksonInject ObjectMapper jsonMapper
+      @Deprecated @JsonProperty("parser") @Nullable Map<String, Object> 
parserMap,
+      @JacksonInject ObjectMapper objectMapper
   )
   {
-    this.jsonMapper = Preconditions.checkNotNull(jsonMapper, "null 
ObjectMapper.");
-    this.parser = parser;
-    this.transformSpec = transformSpec == null ? TransformSpec.NONE : 
transformSpec;
-
     validateDatasourceName(dataSource);
     this.dataSource = dataSource;
 
+    this.timestampSpec = timestampSpec;
+    this.dimensionsSpec = dimensionsSpec == null
+                          ? null
+                          : computeDimensionsSpec(
+                              Preconditions.checkNotNull(timestampSpec, 
"timestampSpec"),
 
 Review comment:
   The original null check has no point since `timestampSpec` is never null. 
See the constructor of `parseSpec`.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to