Jira (PDB-3601) PQL array 'in' operator to match by type or allow sql-like field aliases

1 view
Skip to first unread message

Malcolm Herbert (JIRA)

unread,
Jun 27, 2017, 7:48:02 PM6/27/17
to puppe...@googlegroups.com
Malcolm Herbert created an issue
 
PuppetDB / New Feature PDB-3601
PQL array 'in' operator to match by type or allow sql-like field aliases
Issue Type: New Feature New Feature
Affects Versions: PDB 4.2.3.1
Assignee: Unassigned
Components: PuppetDB
Created: 2017/06/27 4:47 PM
Environment:

internal to the PQL parser, affects all platforms

Priority: Normal Normal
Reporter: Malcolm Herbert

PQL query using the array-form 'in' operator as below will fail because the output of the aggregate function min() is a field named 'min', not 'receive_time':

reports {
[certname, receive_time] in reports [certname, min(receive_time)]

{ certname ~ "foo" group by certname }


}

can we either match fields by position in the array (poor), position and type (better) or provide SQL-like aliases in the second array as in:

[certname, receive_time] in reports [certname, min(receive_time) as receive_time]

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Malcolm Herbert (JIRA)

unread,
Jun 27, 2017, 7:49:02 PM6/27/17
to puppe...@googlegroups.com
Malcolm Herbert updated an issue
Change By: Malcolm Herbert
PQL query using the array-form 'in' operator as below will fail because the output of the aggregate function min() is a field named 'min', not 'receive_time':

reports { 
  [certname, receive_time] in reports [certname, min(receive_time)] { 
    certname     code_id  ~ "foo ;development
    group     order  by certname  

  } 
}

can we either match fields by position in the array (poor), position and type (better) or provide SQL-like aliases in the second array as in:

[certname, receive_time] in reports [certname, min(receive_time) as receive_time] 

Malcolm Herbert (JIRA)

unread,
Jun 27, 2017, 7:50:02 PM6/27/17
to puppe...@googlegroups.com

Wyatt Alt (JIRA)

unread,
Jun 27, 2017, 7:58:04 PM6/27/17
to puppe...@googlegroups.com
Wyatt Alt commented on New Feature PDB-3601

aliases + allowing incorporation of function results in queries is a good feature I think. For this specific case though is the objective to get the earliest receive time for each certname?

If that's the case I think you can do

reports[certname, min(receive_time)]{code_id ~  "foo;development" group by certname}

ordering on top of that is currently broken due to an issue related to PDB-3591 I believe but the results should at least be right.

Claudia Petty (Jira)

unread,
Jun 21, 2023, 10:57:07 AM6/21/23
to puppe...@googlegroups.com
Claudia Petty updated an issue
 
Change By: Claudia Petty
Labels: new-feature
This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages