001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.nodes.flink.TFlinkTableProperty;
004
005/**
006 * AST node for StarRocks CREATE RESOURCE GROUP statement.
007 *
008 * Syntax:
009 * CREATE RESOURCE GROUP resource_group_name
010 * TO CLASSIFIER1, CLASSIFIER2, ...
011 * WITH (resource_limit1, resource_limit2, ...)
012 *
013 * Where CLASSIFIER is:
014 *   (user='username' | role='rolename' | query_type in ('select', 'insert') |
015 *    source_ip='CIDR' | db='database' | plan_cpu_cost_range='[low, high)' |
016 *    plan_mem_cost_range='[low, high)')
017 *
018 * And resource_limit is:
019 *   cpu_weight=value | exclusive_cpu_cores=value | mem_limit=value |
020 *   concurrency_limit=value | max_cpu_cores=value |
021 *   big_query_cpu_second_limit=value | big_query_scan_rows_limit=value |
022 *   big_query_mem_limit=value | type='normal'|'short_query'
023 *
024 * Example:
025 * CREATE RESOURCE GROUP rg1
026 * TO (user='alice', query_type in ('select'))
027 * WITH (cpu_weight=10, mem_limit=0.5, concurrency_limit=20);
028 */
029public class TCreateResourceGroupSqlNode extends TParseTreeNode {
030    // Resource group name
031    private TObjectName resourceGroupName;
032
033    // Classifiers (TO clause) - list of classifier specifications
034    private TParseTreeNode classifierList;
035
036    // Resource limits (WITH clause) - list of property key-value pairs
037    private TParseTreeNode resourceLimits;
038
039    // Getters and setters
040    public TObjectName getResourceGroupName() {
041        return resourceGroupName;
042    }
043
044    public void setResourceGroupName(TObjectName resourceGroupName) {
045        this.resourceGroupName = resourceGroupName;
046    }
047
048    @SuppressWarnings("unchecked")
049    public TPTNodeList<TParseTreeNode> getClassifierList() {
050        return (TPTNodeList<TParseTreeNode>) classifierList;
051    }
052
053    public void setClassifierList(TParseTreeNode classifierList) {
054        this.classifierList = classifierList;
055    }
056
057    @SuppressWarnings("unchecked")
058    public TPTNodeList<TFlinkTableProperty> getResourceLimits() {
059        return (TPTNodeList<TFlinkTableProperty>) resourceLimits;
060    }
061
062    public void setResourceLimits(TParseTreeNode resourceLimits) {
063        this.resourceLimits = resourceLimits;
064    }
065
066    public void init(Object arg1) {
067        this.resourceGroupName = (TObjectName) arg1;
068    }
069}