@@ -28,6 +28,8 @@ public class WithItem<T extends ParenthesedStatement> {
2828 private List <SelectItem <?>> withItemList ;
2929 private boolean recursive = false ;
3030
31+ private boolean materialized = false ;
32+
3133 public WithItem (T statement , Alias alias ) {
3234 this .statement = statement ;
3335 this .alias = alias ;
@@ -79,6 +81,14 @@ public void setRecursive(boolean recursive) {
7981 this .recursive = recursive ;
8082 }
8183
84+ public boolean isMaterialized () {
85+ return materialized ;
86+ }
87+
88+ public void setMaterialized (boolean materialized ) {
89+ this .materialized = materialized ;
90+ }
91+
8292 /**
8393 * The {@link SelectItem}s in this WITH (for example the A,B,C in "WITH mywith (A,B,C) AS ...")
8494 *
@@ -108,6 +118,7 @@ public String toString() {
108118 builder .append (")" );
109119 }
110120 builder .append (" AS " );
121+ builder .append (materialized ? "MATERIALIZED " : "" );
111122 builder .append (statement );
112123 return builder .toString ();
113124 }
@@ -121,8 +132,9 @@ public WithItem<?> withWithItemList(List<SelectItem<?>> withItemList) {
121132 return this ;
122133 }
123134
124- public WithItem <?> withRecursive (boolean recursive ) {
135+ public WithItem <?> withRecursive (boolean recursive , boolean materialized ) {
125136 this .setRecursive (recursive );
137+ this .setMaterialized (materialized );
126138 return this ;
127139 }
128140
0 commit comments