- 
                Notifications
    
You must be signed in to change notification settings  - Fork 25.6k
 
ES|QL: Improve random query generation tests #121750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES|QL: Improve random query generation tests #121750
Conversation
| 
           Pinging @elastic/es-analytical-engine (Team:Analytics)  | 
    
| 
           Apparently it's not time to enable this test yet #121754  | 
    
…tests_202502' into esql/update_generative_tests_202502
| 
           Thanks @idegtiarenko!  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor styling suggestions
| return previousOutput.get(randomIntBetween(0, previousOutput.size() - 1)).name(); | ||
| // we need to exclude <all-fields-projected> | ||
| // https://github.com/elastic/elasticsearch/issues/121741 | ||
| return randomFrom(previousOutput.stream().filter(x -> x.name().equals("<all-fields-projected>") == false).toList()).name(); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract "" into a constant
| return col.type.equals("keyword") | ||
| || col.type.equals("text") | ||
| || col.type.equals("long") | ||
| || col.type.equals("integer") | ||
| || col.type.equals("ip") | ||
| || col.type.equals("version"); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put those types into a set and simply do a map.contains()
| } | ||
| 
               | 
          ||
| private static boolean sortable(Column col) { | ||
| return col.type.equals("keyword") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as groupable
| 
           Thanks @costin, I'll have to iterate on this, so I'll include your suggestions in next batch  | 
    
Fix and enable
GenerativeIT, test that generates and executes random ES|QL queries on the sample csv-spec datasets.For now the test considers a list of errors as acceptable (known bugs/limitations).