In some places (e.g. in AutoValueSchema) we assume that nested
schema-inferred types are of the same "class". I filed [1] to track this a
while back - I think we should support mixing and matching SchemaProviders
for nested types.

[1] https://github.com/apache/beam/issues/20359

On Thu, Aug 4, 2022 at 2:45 PM Reuven Lax via user <[email protected]>
wrote:

> We do have JavaBeanSchema which might work, depending on whether your
> thrift class conforms to java beans.
>
> On Thu, Aug 4, 2022 at 2:06 PM Binh Nguyen Van <[email protected]> wrote:
>
>> Hi,
>>
>> I have an AutoValue class and it looks like this
>>
>> @AutoValue
>> @DefaultSchema( AutoValueSchema.class )
>> public abstract class MyClass {
>>     public abstract String getField1();
>>     public abstract MyThriftClass getField2();
>>     public static Builder Builder() {
>>         return new AutoValue_MyClass.Builder();
>>     }
>>
>>     @AutoValue.Builder
>>     public static abstract class Builder() {
>>         public abstract Builder setField1(String field1);
>>         public abstract Builder setField2(MyThriftClass field2);
>>         public abstract MyClass build();
>>     }
>> }
>>
>> MyThriftClass is not an AutoValue class and it inherits from
>> org.apache.thrift.TBase class.
>>
>> When I run a pipeline with a PCollection of elements that are instances
>> of this class, I got this error java.lang.IllegalStateException:
>> AutoValue generated class not found: com.foo.bar.AutoValue_MyThriftClass.
>>
>> My question is, is it possible to use a non-AutoValue member in an
>> AutoValue class like what I am doing now? If yes then how can I do it? If
>> no then what would be the alternatives?
>>
>> Thank you
>>
>> -Binh
>>
>>
>>

Reply via email to