@@ -197,6 +197,9 @@ func Column(sb *strings.Builder, col *ast.ColumnDeclaration, depth int) {
197197 if col .Default != nil || hasEphemeralDefault {
198198 children ++
199199 }
200+ if col .Codec != nil {
201+ children ++
202+ }
200203 fmt .Fprintf (sb , "%sColumnDeclaration %s (children %d)\n " , indent , col .Name , children )
201204 if col .Type != nil {
202205 Node (sb , col .Type , depth + 1 )
@@ -207,6 +210,34 @@ func Column(sb *strings.Builder, col *ast.ColumnDeclaration, depth int) {
207210 // EPHEMERAL columns without explicit default value show defaultValueOfTypeName function
208211 fmt .Fprintf (sb , "%s Function defaultValueOfTypeName\n " , indent )
209212 }
213+ if col .Codec != nil {
214+ explainCodecExpr (sb , col .Codec , indent + " " , depth + 1 )
215+ }
216+ }
217+
218+ // explainCodecExpr handles CODEC expressions in column declarations
219+ func explainCodecExpr (sb * strings.Builder , codec * ast.CodecExpr , indent string , depth int ) {
220+ // CODEC is rendered as a Function with one child (ExpressionList of codecs)
221+ fmt .Fprintf (sb , "%sFunction CODEC (children 1)\n " , indent )
222+ fmt .Fprintf (sb , "%s ExpressionList (children %d)\n " , indent , len (codec .Codecs ))
223+ for _ , c := range codec .Codecs {
224+ explainCodecFunction (sb , c , indent + " " , depth + 2 )
225+ }
226+ }
227+
228+ // explainCodecFunction handles individual codec functions (e.g., LZ4, ZSTD(10), Gorilla(1))
229+ func explainCodecFunction (sb * strings.Builder , fn * ast.FunctionCall , indent string , depth int ) {
230+ if len (fn .Arguments ) == 0 {
231+ // Codec without parameters: just the function name
232+ fmt .Fprintf (sb , "%sFunction %s\n " , indent , fn .Name )
233+ } else {
234+ // Codec with parameters: function with ExpressionList of arguments
235+ fmt .Fprintf (sb , "%sFunction %s (children 1)\n " , indent , fn .Name )
236+ fmt .Fprintf (sb , "%s ExpressionList (children %d)\n " , indent , len (fn .Arguments ))
237+ for _ , arg := range fn .Arguments {
238+ Node (sb , arg , depth + 2 )
239+ }
240+ }
210241}
211242
212243func Index (sb * strings.Builder , idx * ast.IndexDefinition , depth int ) {
0 commit comments