Hello Drillers :)

I came across the aforementioned bug (DRILL-5033) and wanted to contribute.
My attempt is to consider a *null *token as a *string *and print the "null"
as the column value instead of omitting the key in the output
resultset, details
of the fix attempt is below:


*1)* In JsonReader.java (java-exec/drill-exec/vector/complex/fn/) at line
283 i add the following:

> ...
> case VALUE_NULL:
>           // handle null as string
>           handleString(parser, map, fieldName);
>           break;
> ...


*2)* then at line 415 the handleString() becomes:

private void handleString(JsonParser parser, MapWriter writer, String
> fieldName) throws IOException {
>     try {
>      // added the following if
>       if (parser.nextToken() == VALUE_NULL)
>         writer.varChar(fieldName)
>           .writeVarChar(0, workingBuffer.prepareVarCharHolder("null"),
> workingBuffer.getBuf());
>       else
>       writer.varChar(fieldName)
>           .writeVarChar(0,
> workingBuffer.prepareVarCharHolder(parser.getText()),
> workingBuffer.getBuf());
>     } catch (IllegalArgumentException e) {
>       if (parser.getText() == null || parser.getText().isEmpty()) {
>        // return;
>       }
>       throw e;
>     }
>   }



Is this a possible fix to the mentioned bug?
If yes should i pull request ?

Thanks.

Reply via email to