001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.nodes.flink.TFlinkTableProperty; 004 005/** 006 * AST node for StarRocks CACHE SELECT statement. 007 * 008 * Syntax: 009 * CACHE SELECT column_name [, ...] 010 * FROM [catalog_name.][db_name.]table_name 011 * [WHERE boolean_expression] 012 * [PROPERTIES("verbose"="true")] 013 */ 014public class TCacheSelectSqlNode extends TParseTreeNode { 015 016 private TResultColumnList selectList; 017 private TFromTable fromTable; 018 private TExpression whereClause; 019 private TPTNodeList<TFlinkTableProperty> properties; 020 021 public TResultColumnList getSelectList() { 022 return selectList; 023 } 024 025 public void setSelectList(TResultColumnList selectList) { 026 this.selectList = selectList; 027 } 028 029 public TFromTable getFromTable() { 030 return fromTable; 031 } 032 033 public void setFromTable(TFromTable fromTable) { 034 this.fromTable = fromTable; 035 } 036 037 public TExpression getWhereClause() { 038 return whereClause; 039 } 040 041 public void setWhereClause(TExpression whereClause) { 042 this.whereClause = whereClause; 043 } 044 045 public TPTNodeList<TFlinkTableProperty> getProperties() { 046 return properties; 047 } 048 049 public void setProperties(TPTNodeList properties) { 050 this.properties = properties; 051 } 052 053 /** 054 * Check if verbose mode is enabled in properties. 055 * @return true if PROPERTIES contains "verbose"="true" 056 */ 057 public boolean isVerbose() { 058 if (properties == null) return false; 059 for (int i = 0; i < properties.size(); i++) { 060 TFlinkTableProperty prop = properties.getElement(i); 061 if (prop.getPropertyKey() != null && 062 "verbose".equalsIgnoreCase(prop.getPropertyKey().toString())) { 063 if (prop.getPropertyValue() != null) { 064 String value = prop.getPropertyValue().toString(); 065 // Remove quotes if present 066 if (value.startsWith("'") && value.endsWith("'")) { 067 value = value.substring(1, value.length() - 1); 068 } else if (value.startsWith("\"") && value.endsWith("\"")) { 069 value = value.substring(1, value.length() - 1); 070 } 071 return "true".equalsIgnoreCase(value); 072 } 073 } 074 } 075 return false; 076 } 077}