Hi Charles,
Thanks for the PR. Two suggestions for your test. First, use TupleSchema:
TupleSchema schema = new SchemaBuilder() ... .buildSchema().
BatchSchema has some limitations that TupleSchema overcomes.
Second, when I did a PR that added unions, I normalized the "buildFoo()"
methods. They are now called .resumeSchema(). Checkout the test
TestSchemaBuilder for an example.
Just checked, the example in the SchemaBuilder class shows the old names.
Please file a JIRA ticket for this and I'll submit a PR with the fix.
Thanks,
- Paul
On Friday, November 9, 2018, 12:52:56 PM PST, Charles Givre
<[email protected]> wrote:
Hello everyone,
I just submitted a PR for a format plugin for Syslog formatted data. I’m
really stuck on writing a unit test however and could use some assistance.
Basically I’m stuck writing a unit test where the data returns a map. I
attempted to follow the sample code shown below, however, Java doesn’t seem to
be finding the build() or buildMap() functions and hence the unit test doesn’t
work.
<p>
* Code:<pre><code>
* BatchSchema batchSchema = new SchemaBuilder()
* .add("c", MinorType.INT)
* .addMap("a")
* .addNullable("b", MinorType.VARCHAR)
* .add("d", MinorType.INT)
* .addMap("e") // or .addMapArray("e")
* .add("f", MinorType.VARCHAR)
* .buildMap()
* .add("g", MinorType.INT)
* .buildMap()
* .addUnion("h") // or .addList("h")
* .addType(MinorType.INT)
* .addMap()
* .add("h1", MinorType.INT)
* .buildNested()
* .addList()
* .addType(MinorType.BIGINT)
* .buildNested()
* .build()
* .addArray("i", MinorType.BIGINT)
* .addRepeatedList("j")
* .addDimension()
* .addArray(MinorType.VARCHAR)
* .endDimension()
* .build()
* .build();
* </code</pre>
However, it would not work. The test file can be found here:
https://github.com/apache/drill/blob/a2365042ee0baa73698f1bb9dd183bb4623bc254/contrib/format-syslog/src/test/java/org/apache/drill/exec/store/syslog/TestSyslogFormat.java
<https://github.com/apache/drill/blob/a2365042ee0baa73698f1bb9dd183bb4623bc254/contrib/format-syslog/src/test/java/org/apache/drill/exec/store/syslog/TestSyslogFormat.java>.
I commented out the non-working test. Any help would be greatly appreciated.
Thanks!
—C