001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.TSourceToken;
004import gudusoft.gsqlparser.nodes.flink.TFlinkTableProperty;
005
006/**
007 * AST node for StarRocks CREATE ROUTINE LOAD statement.
008 *
009 * Syntax:
010 * CREATE ROUTINE LOAD [database.]job_name ON table_name
011 * [load_properties]
012 * [job_properties]
013 * FROM data_source
014 * [data_source_properties]
015 *
016 * load_properties:
017 *   [COLUMNS TERMINATED BY '<column_separator>']
018 *   [ROWS TERMINATED BY '<row_separator>']
019 *   [COLUMNS (<column1_name>[, <column2_name>, <column_assignment>, ...])]
020 *   [WHERE <expr>]
021 *   [PARTITION (<partition1_name>[, <partition2_name>, ...])]
022 *
023 * job_properties:
024 *   PROPERTIES ("key" = "value"[, ...])
025 *
026 * data_source:
027 *   FROM KAFKA ("key" = "value"[, ...])
028 */
029public class TCreateRoutineLoadSqlNode extends TParseTreeNode {
030    // Job identification
031    private TObjectName jobName;
032    private TObjectName tableName;
033
034    // Load properties
035    private TSourceToken columnSeparator;
036    private TSourceToken rowSeparator;
037    private TObjectNameList columnList;
038    private TExpression whereClause;
039    private TObjectNameList partitionList;
040    private TObjectNameList temporaryPartitionList;
041
042    // Job properties (PROPERTIES clause) - raw type to allow parser assignment
043    private TParseTreeNode jobProperties;
044
045    // Data source
046    private TSourceToken dataSourceType; // KAFKA, PULSAR, etc.
047    private TParseTreeNode dataSourceProperties;
048
049    // Getters and setters
050    public TObjectName getJobName() {
051        return jobName;
052    }
053
054    public void setJobName(TObjectName jobName) {
055        this.jobName = jobName;
056    }
057
058    public TObjectName getTableName() {
059        return tableName;
060    }
061
062    public void setTableName(TObjectName tableName) {
063        this.tableName = tableName;
064    }
065
066    public TSourceToken getColumnSeparator() {
067        return columnSeparator;
068    }
069
070    public void setColumnSeparator(TSourceToken columnSeparator) {
071        this.columnSeparator = columnSeparator;
072    }
073
074    public TSourceToken getRowSeparator() {
075        return rowSeparator;
076    }
077
078    public void setRowSeparator(TSourceToken rowSeparator) {
079        this.rowSeparator = rowSeparator;
080    }
081
082    public TObjectNameList getColumnList() {
083        return columnList;
084    }
085
086    public void setColumnList(TObjectNameList columnList) {
087        this.columnList = columnList;
088    }
089
090    public TExpression getWhereClause() {
091        return whereClause;
092    }
093
094    public void setWhereClause(TExpression whereClause) {
095        this.whereClause = whereClause;
096    }
097
098    public TObjectNameList getPartitionList() {
099        return partitionList;
100    }
101
102    public void setPartitionList(TObjectNameList partitionList) {
103        this.partitionList = partitionList;
104    }
105
106    public TObjectNameList getTemporaryPartitionList() {
107        return temporaryPartitionList;
108    }
109
110    public void setTemporaryPartitionList(TObjectNameList temporaryPartitionList) {
111        this.temporaryPartitionList = temporaryPartitionList;
112    }
113
114    @SuppressWarnings("unchecked")
115    public TPTNodeList<TFlinkTableProperty> getJobProperties() {
116        return (TPTNodeList<TFlinkTableProperty>) jobProperties;
117    }
118
119    public void setJobProperties(TParseTreeNode jobProperties) {
120        this.jobProperties = jobProperties;
121    }
122
123    public TSourceToken getDataSourceType() {
124        return dataSourceType;
125    }
126
127    public void setDataSourceType(TSourceToken dataSourceType) {
128        this.dataSourceType = dataSourceType;
129    }
130
131    @SuppressWarnings("unchecked")
132    public TPTNodeList<TFlinkTableProperty> getDataSourceProperties() {
133        return (TPTNodeList<TFlinkTableProperty>) dataSourceProperties;
134    }
135
136    public void setDataSourceProperties(TParseTreeNode dataSourceProperties) {
137        this.dataSourceProperties = dataSourceProperties;
138    }
139
140    public void init(Object arg1, Object arg2) {
141        this.jobName = (TObjectName) arg1;
142        this.tableName = (TObjectName) arg2;
143    }
144}