Re: Using a non-AutoValue member with AutoValueSchema

2022-08-04 Thread Binh Nguyen Van
Thank you for helping.

My thrift class conforms to Java beans, I will convert the outer class to
Java bean and try it.

-Binh


On Thu, Aug 4, 2022 at 2:55 PM Reuven Lax via user 
wrote:

> That would be a nice feature, though maybe some work to implement.
>
> On Thu, Aug 4, 2022 at 2:49 PM Brian Hulette  wrote:
>
>> 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 
>> 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 
>>> 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





Re: Using a non-AutoValue member with AutoValueSchema

2022-08-04 Thread Reuven Lax via user
That would be a nice feature, though maybe some work to implement.

On Thu, Aug 4, 2022 at 2:49 PM Brian Hulette  wrote:

> 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 
> 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 
>> 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
>>>
>>>
>>>


Re: Using a non-AutoValue member with AutoValueSchema

2022-08-04 Thread Brian Hulette via user
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 
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  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
>>
>>
>>


Re: Using a non-AutoValue member with AutoValueSchema

2022-08-04 Thread Reuven Lax via user
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  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
>
>
>


Using a non-AutoValue member with AutoValueSchema

2022-08-04 Thread Binh Nguyen Van
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