flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabian Hueske <fhue...@gmail.com>
Subject Re: the attribute order in sql 'select * from...'
Date Fri, 13 Jan 2017 09:22:49 GMT
Hi Yuhong,

I assume that OrderA is a table of POJO objects and you are expecting the
order of the attribute to be as the order in which the fields of the POJO
are defined in the source code.

Flink accepts fields which are either public members or accessible via a
getter and setter.
This makes it difficult to automatically define an order, esp. if some
fields use getter and setter or public fields. Would the order depend on
the field (which might not exist in case of getter/setter) or setter or
getter methods (which might also not exist).
I'm also not sure if it is possible to extract the line number of a method
or field via reflection.

Best, Fabian



2017-01-13 9:54 GMT+01:00 Hongyuhong <hongyuhong@huawei.com>:

> Hi,
>
> I’m now using streaming sql, And I have the sql like
>
> select *  FROM OrderA where user > 2
>
> the OrderA has 3 attr (user, product, amount)
>
> and I expect the result is as the order like input, but it has been sorted
> by attr name,
>
> and I found the order has already been sorted when call addSource,
>
> What is the purpose of doing so?cause it’s a little not meet our
> requirements.
>
>
>
> Thanks very much.
>
>
>
>
>
> public PojoTypeInfo(Class<T> typeClass, List<PojoField> fields) {
>
>                    super(typeClass);
>
>
>
>                    checkArgument(Modifier.isPublic(typeClass.
> getModifiers()),
>
>                                      "POJO %s is not public", typeClass);
>
>
>
>                    this.fields = fields.toArray(new
> PojoField[fields.size()]);
>
>
>
>                    Arrays.sort(this.fields, new Comparator<PojoField>() {
>
>                             @Override
>
>                             public int compare(PojoField o1, PojoField o2)
> {
>
>                                      return o1.getField().getName().
> compareTo(o2.getField().getName());
>
>                             }
>
>                    });
>
>
>
>
>
> Best,
>
> Yuhong
>

Mime
View raw message