diff --git a/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTcolumn_def.java b/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTcolumn_def.java index 193f8ba..6ae2ac6 100644 --- a/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTcolumn_def.java +++ b/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTcolumn_def.java @@ -62,6 +62,10 @@ public boolean isHidden() { return AstTreeUtils.getOptionalChildByType(children, ASThidden.class) != null; } + public boolean isStored() { + return getGenerationClause() != null && getGenerationClause().isStored(); + } + @Override public String toString() { // check for unknown/unsupported children diff --git a/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTgeneration_clause.java b/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTgeneration_clause.java index 51a3e34..8e0e064 100644 --- a/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTgeneration_clause.java +++ b/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTgeneration_clause.java @@ -25,11 +25,14 @@ public ASTgeneration_clause(DdlParser p, int id) { super(p, id); } + public boolean isStored() { + return children.length > 1 && children[1].getClass() == ASTstored.class; + } + @Override public String toString() { final ASTexpression exp = (ASTexpression) children[0]; - final String storedOpt = - children.length > 1 && children[1].getClass() == ASTstored.class ? " STORED" : ""; + final String storedOpt = isStored() ? " STORED" : ""; return "AS ( " + exp.toString() + " )" + storedOpt; }