Query class to accept a list of columns to select

Description

issue:

REST uses the Query class from core - which returns complete PO objects - the Query class doesn't filter columns

use case: get columns a,b,c with rest $select operator - the view behind has 100 columns - includes sub-queries with aggregation - we are wondering. 1. sql cost with 3 cols 30ms same with intensive column costs 7 sec. so believe REST api processed only requested 3 columns, instead it make huge query against database, for 100 cols, convert them then drop-return to rest client 3 columns with 100 columns processing costs.

related discussion
https://mattermost.idempiere.org/idempiere/pl/38jrkdjpqifoiryhp8jmzzwnwr

Carlos: think it could be possible changing the Query core class to accept a list of columns to select

Hengsin: we would have to modify the Query class to be able to return partial result. and then use it in the Rest $select implementation

 

Phases

A. change core

B. apply to rest

Environment

v12

Attachments

1

Activity

Carlos Ruiz 
April 26, 2024 at 2:37 PM

Hi

Testing REST with the endpoint /api/v1/models/m_freightcategory?$select=name,help
is returning the records like this:

{ "id": 0, "Name": "Ground", "model-name": "m_freightcategory" }

The problem is the PO.get_ID() is returning zero, can you please check that?

Heng Sin Low 
April 26, 2024 at 12:38 PM

The Rest patch have not been tested so please fix any issues discover there.

Carlos Ruiz 
April 26, 2024 at 11:47 AM

Hi, this option is for developers but I think it would be worthy to be documented as a new feature explaining the usage and implications.

I'm reviewing and testing the REST part, there are some missing points.

Former user 
April 25, 2024 at 7:17 PM

hi. this was fast, thanks. hope we get it in core next days and we can test it asap.

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created April 24, 2024 at 4:38 PM
Updated July 4, 2024 at 9:36 PM
Resolved May 7, 2024 at 3:55 PM