public abstract class SqlNode implements Cloneable {
public static final SqlNode[] EMPTY_ARRAY = new SqlNode[0];
protected final SqlParserPos pos;
SqlNode(SqlParserPos pos) {
this.pos = (SqlParserPos)Objects.requireNonNull(pos, "pos");
}
/** @deprecated */
@Deprecated
public Object clone() {
return this.clone(this.getParserPosition());
}
public static <E extends SqlNode> E clone(E e) {
return e.clone(e.pos);
}
public abstract SqlNode clone(SqlParserPos var1);
public SqlKind getKind() {
return SqlKind.OTHER;
}
public final boolean isA(Set<SqlKind> category) {
return this.getKind().belongsTo(category);
}
/** @deprecated */
@Deprecated
public static SqlNode[] cloneArray(SqlNode[] nodes) {
SqlNode[] clones = (SqlNode[])nodes.clone();
for(int i = 0; i < clones.length; ++i) {
SqlNode node = clones[i];
if (node != null) {
clones[i] = clone(node);
}
}
return clones;
}
public String toString() {
return this.toSqlString((c) -> {
return c.withDialect(AnsiSqlDialect.DEFAULT).withAlwaysUseParentheses(false).withSelectListItemsOnSeparateLines(false).withUpdateSetListNewline(false).withIndentation(0);
}).getSql();
}
public SqlString toSqlString(UnaryOperator<SqlWriterConfig> transform) {
SqlWriterConfig config = (SqlWriterConfig)transform.apply(SqlPrettyWriter.config());
SqlPrettyWriter writer = new SqlPrettyWriter(config);
this.unparse(writer, 0, 0);
return writer.toSqlString();
}
public SqlString toSqlString(@Nullable SqlDialect dialect, boolean forceParens) {
return this.toSqlString((c) -> {
return c.withDialect((SqlDialect)Util.first(dialect, AnsiSqlDialect.DEFAULT)).withAlwaysUseParentheses(forceParens).withSelectListItemsOnSeparateLines(false).withUpdateSetListNewl
apache calcite源码阅读(一)org.apache.calcite.sql下的SqlNode.class
最新推荐文章于 2024-06-18 02:14:17 发布
SqlNode是一个抽象类,代表SQL语句语法树的节点,实现了Cloneable接口。类中包含位置信息、克隆方法、节点类型获取、验证和转换为SQL字符串等功能。它支持表达式验证、单调性检查和访问者模式,用于处理和解析SQL语句。

最低0.47元/天 解锁文章
805

被折叠的 条评论
为什么被折叠?



