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

 ##########
 File path: 
server/src/main/java/org/apache/druid/segment/indexing/DataSchema.java
 ##########
 @@ -212,25 +247,78 @@ public TransformSpec getTransformSpec()
     return transformSpec;
   }
 
+  @Deprecated
+  @JsonProperty("parser")
+  @Nullable
+  @JsonInclude(Include.NON_NULL)
+  public Map<String, Object> getParserMap()
+  {
+    return parserMap;
+  }
+
+  @Nullable
+  public InputRowParser getParser()
+  {
+    if (inputRowParser == null) {
+      if (parserMap == null) {
+        return null;
+      }
+      //noinspection unchecked
+      inputRowParser = 
transformSpec.decorate(objectMapper.convertValue(this.parserMap, 
InputRowParser.class));
+      ParseSpec parseSpec = inputRowParser.getParseSpec();
+      parseSpec = parseSpec.withDimensionsSpec(
+          computeDimensionsSpec(parseSpec.getTimestampSpec(), 
parseSpec.getDimensionsSpec(), aggregators)
+      );
+      if (timestampSpec != null) {
+        parseSpec = parseSpec.withTimestampSpec(timestampSpec);
+      }
+      if (dimensionsSpec != null) {
+        parseSpec = parseSpec.withDimensionsSpec(dimensionsSpec);
+      }
+      inputRowParser = inputRowParser.withParseSpec(parseSpec);
+    }
+    return inputRowParser;
+  }
+
   public DataSchema withGranularitySpec(GranularitySpec granularitySpec)
   {
-    return new DataSchema(dataSource, parser, aggregators, granularitySpec, 
transformSpec, jsonMapper);
+    return new DataSchema(
+        dataSource,
+        timestampSpec,
+        dimensionsSpec,
+        aggregators,
+        granularitySpec,
+        transformSpec,
+        parserMap,
+        objectMapper
+    );
   }
 
   public DataSchema withTransformSpec(TransformSpec transformSpec)
   {
-    return new DataSchema(dataSource, parser, aggregators, granularitySpec, 
transformSpec, jsonMapper);
+    return new DataSchema(
+        dataSource,
+        timestampSpec,
+        dimensionsSpec,
+        aggregators,
+        granularitySpec,
+        transformSpec,
+        parserMap,
+        objectMapper
+    );
   }
 
   @Override
   public String toString()
   {
     return "DataSchema{" +
            "dataSource='" + dataSource + '\'' +
-           ", parser=" + parser +
            ", aggregators=" + Arrays.toString(aggregators) +
            ", granularitySpec=" + granularitySpec +
            ", transformSpec=" + transformSpec +
+           (parserMap == null ? "" : ", parserMap=" + parserMap) +
 
 Review comment:
   Changed.

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