001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.TSourceToken;
004import gudusoft.gsqlparser.nodes.flink.TFlinkTableProperty;
005
006/**
007 * AST node for StarRocks ALTER ROUTINE LOAD statement.
008 *
009 * Syntax:
010 * ALTER ROUTINE LOAD FOR [db_name.]job_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 TAlterRoutineLoadSqlNode extends TParseTreeNode {
030    // Job identification
031    private TObjectName jobName;
032
033    // Load properties
034    private TSourceToken columnSeparator;
035    private TSourceToken rowSeparator;
036    private TObjectNameList columnList;
037    private TExpression whereClause;
038    private TObjectNameList partitionList;
039    private TObjectNameList temporaryPartitionList;
040
041    // Job properties (PROPERTIES clause) - raw type to allow parser assignment
042    private TParseTreeNode jobProperties;
043
044    // Data source
045    private TSourceToken dataSourceType; // KAFKA, PULSAR, etc.
046    private TParseTreeNode dataSourceProperties;
047
048    // Getters and setters
049    public TObjectName getJobName() {
050        return jobName;
051    }
052
053    public void setJobName(TObjectName jobName) {
054        this.jobName = jobName;
055    }
056
057    public TSourceToken getColumnSeparator() {
058        return columnSeparator;
059    }
060
061    public void setColumnSeparator(TSourceToken columnSeparator) {
062        this.columnSeparator = columnSeparator;
063    }
064
065    public TSourceToken getRowSeparator() {
066        return rowSeparator;
067    }
068
069    public void setRowSeparator(TSourceToken rowSeparator) {
070        this.rowSeparator = rowSeparator;
071    }
072
073    public TObjectNameList getColumnList() {
074        return columnList;
075    }
076
077    public void setColumnList(TObjectNameList columnList) {
078        this.columnList = columnList;
079    }
080
081    public TExpression getWhereClause() {
082        return whereClause;
083    }
084
085    public void setWhereClause(TExpression whereClause) {
086        this.whereClause = whereClause;
087    }
088
089    public TObjectNameList getPartitionList() {
090        return partitionList;
091    }
092
093    public void setPartitionList(TObjectNameList partitionList) {
094        this.partitionList = partitionList;
095    }
096
097    public TObjectNameList getTemporaryPartitionList() {
098        return temporaryPartitionList;
099    }
100
101    public void setTemporaryPartitionList(TObjectNameList temporaryPartitionList) {
102        this.temporaryPartitionList = temporaryPartitionList;
103    }
104
105    @SuppressWarnings("unchecked")
106    public TPTNodeList<TFlinkTableProperty> getJobProperties() {
107        return (TPTNodeList<TFlinkTableProperty>) jobProperties;
108    }
109
110    public void setJobProperties(TParseTreeNode jobProperties) {
111        this.jobProperties = jobProperties;
112    }
113
114    public TSourceToken getDataSourceType() {
115        return dataSourceType;
116    }
117
118    public void setDataSourceType(TSourceToken dataSourceType) {
119        this.dataSourceType = dataSourceType;
120    }
121
122    @SuppressWarnings("unchecked")
123    public TPTNodeList<TFlinkTableProperty> getDataSourceProperties() {
124        return (TPTNodeList<TFlinkTableProperty>) dataSourceProperties;
125    }
126
127    public void setDataSourceProperties(TParseTreeNode dataSourceProperties) {
128        this.dataSourceProperties = dataSourceProperties;
129    }
130
131    public void init(Object jobName) {
132        this.jobName = (TObjectName) jobName;
133    }
134}