When implementing Daniel's suggestion, future-proof yourself:

https://github.com/kevinweil/elephant-bird/blob/master/src/java/com/twitter/elephantbird/pig/util/PigUtil.java

(see the Pig9orNewer() method)

D

On Mon, Oct 31, 2011 at 12:59 PM, Daniel Dai <[email protected]> wrote:
> Always set twoLevelAccess to true in 0.8. From 0.9, don't worry about it
> any more.
>
> Daniel
>
> On Mon, Oct 31, 2011 at 12:20 PM, Andrew Clegg <
> [email protected]> wrote:
>
>> Hi,
>>
>> If I create two schemas like this:
>>
>> Schema s1 = Utils.getSchemaFromString("b: {t: (f0: [])}");
>> Schema s2 = SchemaUtil.newBagSchema(new Byte[]{DataType.MAP});
>>
>> then compare them like this:
>>
>> boolean match = Schema.equals(expected, output, false, true);
>>
>> they don't match, even though the toString output of the two is identical:
>>
>> {b: {t: (f0: map[ ])}}
>>
>> This turns out to be because in s1, t.setTwoLevelAccessRequired is
>> true, but in s2, it's false.
>>
>> Which is correct? If I'm writing a UDF that returns a bag of maps,
>> what should I make the outputSchema method return?
>>
>> Thanks,
>>
>> Andrew.
>>
>> --
>>
>> http://tinyurl.com/andrew-clegg-linkedin | http://twitter.com/andrew_clegg
>>
>

Reply via email to