components/org.wso2.carbon.siddhi.editor.core/src/main/resources/web/js/source-editor/completion-engine.js
/**
             * Handle the query section group by suggestions for the query
             *
             * @private
             * @param {string[]} regexResults Array of groups from the regex execution of the query
             * @param {string} fullEditorText Complete editor text before the cursor
             */
Handle the query section group by suggestions for the query
@private
@param {string[]} regexResults Array of groups from the regex execution of the query
@param {string} fullEditorText Complete editor text before the cursor
Handle the query section group by suggestions for the query @private @param { string [] } regexResults Array of groups from the regex execution of the query @param { string } fullEditorText Complete editor text before the cursor
function handleGroupBySuggestions(regexResults, fullEditorText) {
                var groupByClause = regexResults[8];
                var afterGroupByClauseRegex = new RegExp(regex.identifier + "\\s*" +
                    "(?:" + regex.comma + regex.identifier + "\\s*)*" + "\\s+[a-zA-Z_0-9]*$", "i");
                var generalSuggestionsRegex = new RegExp("(?:" + regex.identifier + "\\s*" +
                    regex.comma + ")*", "i");
                if (afterGroupByClauseRegex.test(groupByClause)) {
                    addCompletions(["having", "order by", "limit", "output", "insert", "delete", "update",
                        "update or insert into"]
                        .map(function (completion) {
                                return {value: completion + " ", priority: 2};
                            }
                        ));
                } else if (generalSuggestionsRegex.test(groupByClause)) {
                    addAttributesOfSourcesAsCompletionsFromQueryIn(
                        regexResults, fullEditorText, 3, 2,
                        [constants.STREAMS, constants.EVENT_TABLES, constants.WINDOWS, constants.AGGREGATIONS]
                    );
                    addAttributesOfStandardStatefulSourcesAsCompletionsFromQueryIn(
                        regexResults, fullEditorText, 3, 2
                    );
                    addAttributesOfStreamOrTableReferencesAsCompletionsFromQueryIn(
                        regexResults, fullEditorText, 3, 2
                    );
                }
            }
function handleGroupBySuggestions ( regexResults , fullEditorText ) { var groupByClause = regexResults [ 8 ] ; var afterGroupByClauseRegex = new RegExp ( regex . identifier + "\\s*" + "(?:" + regex . comma + regex . identifier + "\\s*)*" + "\\s+[a-zA-Z_0-9]*$" , "i" ) ; var generalSuggestionsRegex = new RegExp ( "(?:" + regex . identifier + "\\s*" + regex . comma + ")*" , "i" ) ; if ( afterGroupByClauseRegex . test ( groupByClause ) ) { addCompletions ( [ "having" , "order by" , "limit" , "output" , "insert" , "delete" , "update" , "update or insert into" ] . map ( function ( completion ) { return { value : completion + " " , priority : 2 } ; } ) ) ; } else if ( generalSuggestionsRegex . test ( groupByClause ) ) { addAttributesOfSourcesAsCompletionsFromQueryIn ( regexResults , fullEditorText , 3 , 2 , [ constants . STREAMS , constants . EVENT_TABLES , constants . WINDOWS , constants . AGGREGATIONS ] ) ; addAttributesOfStandardStatefulSourcesAsCompletionsFromQueryIn ( regexResults , fullEditorText , 3 , 2 ) ; addAttributesOfStreamOrTableReferencesAsCompletionsFromQueryIn ( regexResults , fullEditorText , 3 , 2 ) ; } }
Handle the query section group by suggestions for the query
 @private
 @param {string[]} regexResults Array of groups from the regex execution of the query
 @param {string} fullEditorText Complete editor text before the cursor
Handle the query section group by suggestions for the query @private @param { string [] } regexResults Array of groups from the regex execution of the query @param { string } fullEditorText Complete editor text before the cursor
// Regexps used for identifying the suggestions // Testing to find the relevant suggestion // Add keyword suggestions after the group by attribute list without a comma at the end // Add attributes of the sources for the group by clause