See https://issues.apache.org/jira/browse/CALCITE-2798 which removes order
by in subqueries (correct, standard sql behavior)
and
https://issues.apache.org/jira/browse/CALCITE-4160 which makes it
configurable

On Mon, Oct 13, 2025 at 2:18 PM Mihai Budiu <[email protected]> wrote:

> I think that the SQL semantics of SELECT does not guarantee preserving the
> order of records in the input collection.
>
> Mihai
>
> ________________________________
> From: Francis Chuang <[email protected]>
> Sent: Monday, October 13, 2025 2:15 PM
> To: [email protected] <[email protected]>
> Subject: Re: Unexpected Behavior with Subquery and ORDER BY in
> FilterableTable Implementation
>
> The images show when they are in moderation, but appears to be removed
> when posted to the list. I ran the images through a image -> text
> converter and here are the results:
>
> Image 1:
> ra-testfdm-n=> select name from datamodeling.views order by name asc;
> name
> -------------
> Action
> Activity
> Activity
> Areas
> Asset
> Asset class
> Asset type
> Assets
> Blower_1
> Blower_10
> Blower_100
> Blower_11
> Blower_12
> Blower_13
> Blower_14
> Blower_15
> Blower_16
> Blower_17
> Blower_18
> Blower_19
> Blower_2
>
> Image 2:
> ra-testfdm-n=> select "$Table"."name" as "name" from (select name,
> externalid from datamodeling.views order by name asc) "$Table";
> name
> --------------
> Dress
> Blower_100
> Blower_10
> Blower_11
> Blower_1
> Blower_12
> Blower_13
> Blower_14
> Blower_15
> Blower_16
> Blower_17
> Blower_18
> Blower_19
> Blower_20
> Blower_21 Blower_2
> Blower_22 Blower 23
>
> On 14/10/2025 3:37 am, Mihai Budiu wrote:
> > I believe that the dev mailing list will strip images from messages. At
> least I cannot see them.
> >
> > Calcite is really a framework which can be configured in countless ways.
> You have to tell us more about your particular setup.
> >
> > Mihai
> >
> >
> > ________________________________
> > From: Mahadev Mishal <[email protected]>
> > Sent: Monday, October 13, 2025 7:55 AM
> > To: [email protected] <[email protected]>
> > Cc: Abhishek Bhandary <[email protected]>
> > Subject: Unexpected Behavior with Subquery and ORDER BY in
> FilterableTable Implementation
> >
> > Hi Team,
> >
> > I'm currently working with Apache Calcite and have implemented a custom
> table using the FilterableTable interface to expose a virtual view
> (datamodeling.views). While testing query behavior, I noticed a discrepancy
> in results between two seemingly equivalent queries.
> >
> > Below are the snapshots of the results.
> >
> > [cid:15e448a4-4485-46a2-ac69-d0fcc734e7d6]
> >
> >
> > [cid:9915e99b-3fb9-475b-b894-cb58fff4a79e]
> >
> > Is there a recommended approach to preserve sort order when using
> subqueries in Calcite?
> >
> > Any guidance or suggestions would be greatly appreciated. Please let me
> know if you need more details.
> >
> > Thank you for your time!
> >
> >
> > [Rockwell Automation]<https://www.rockwellautomation.com/>
> >
> > Mahadev Mishal
> > Senior Software Engineer
> >
> > A-Wing Mississippi Bldg Embassy Tech Zone,
> > Hinjewadi P2, Pune
> > India
> > [Rockwell Automation Facebook]<https://www.facebook.com/ROKAutomation>
> [Rockwell Automation Instagram] <https://www.instagram.com/rokautomation/>
> [Rockwell Automation LinkedIn] <
> http://www.linkedin.com/company/rockwell-automation>  [Rockwell
> Automation Twitter] <https://twitter.com/ROKAutomation>
> >
> >
> >
> >
> >
>
>

Reply via email to