[ 
https://issues.apache.org/jira/browse/DRILL-7683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17072190#comment-17072190
 ] 

ASF GitHub Bot commented on DRILL-7683:
---------------------------------------

arina-ielchiieva commented on pull request #2045: DRILL-7683: Add "message 
parsing" to new JSON loader
URL: https://github.com/apache/drill/pull/2045#discussion_r401229789
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/json/loader/JsonLoaderImpl.java
 ##########
 @@ -146,30 +198,33 @@
    * inference, and not JSON tokens have been seen which would hint
    * at a type. Not needed when a schema is provided.
    */
-
   // Using a simple list. Won't perform well if we have hundreds of
   // null fields; but then we've never seen such a pathologically bad
-  // case... Usually just one or two fields have deferred nulls.
+  // case. Usually just one or two fields have deferred nulls.
   private final List<NullTypeMarker> nullStates = new ArrayList<>();
 
-  public JsonLoaderImpl(ResultSetLoader rsLoader, TupleMetadata providedSchema,
-      JsonLoaderOptions options, CustomErrorContext errorContext,
-      InputStream stream) {
-    this.rsLoader = rsLoader;
-    this.options = options;
-    this.errorContext = errorContext;
-    this.rowListener = new TupleListener(this, rsLoader.writer(), 
providedSchema);
-    this.parser = new JsonStructureParser(stream, options, rowListener, this);
+  private JsonLoaderImpl(JsonLoaderBuilder builder) {
+    this.rsLoader = builder.rsLoader;
+    this.options = builder.options;
+    this.errorContext =builder. errorContext;
 
 Review comment:
   ```suggestion
       this.errorContext = builder. errorContext;
   ```
 
----------------------------------------------------------------
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:
[email protected]


> Add "message parsing" to new JSON loader
> ----------------------------------------
>
>                 Key: DRILL-7683
>                 URL: https://issues.apache.org/jira/browse/DRILL-7683
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.18.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Minor
>             Fix For: 1.18.0
>
>
> Worked on a project that uses the new JSON loader to parse a REST response 
> that includes a set of "wrapper" fields around the JSON payload. Example:
> {code:json}
> { "status": "ok", "results: [ data here ]}
> {code}
> To solve this cleanly, added the ability to specify a "message parser" to 
> consume JSON tokens up to the start of the data. This parser can be written 
> as needed for each different data source.
> Since this change adds one more parameter to the JSON structure parser, added 
> builders to gather the needed parameters rather than making the constructor 
> even larger.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to