Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions internal/explain/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ func Column(sb *strings.Builder, col *ast.ColumnDeclaration, depth int) {
if col.Default != nil || hasEphemeralDefault {
children++
}
if col.Codec != nil {
children++
}
fmt.Fprintf(sb, "%sColumnDeclaration %s (children %d)\n", indent, col.Name, children)
if col.Type != nil {
Node(sb, col.Type, depth+1)
Expand All @@ -207,6 +210,34 @@ func Column(sb *strings.Builder, col *ast.ColumnDeclaration, depth int) {
// EPHEMERAL columns without explicit default value show defaultValueOfTypeName function
fmt.Fprintf(sb, "%s Function defaultValueOfTypeName\n", indent)
}
if col.Codec != nil {
explainCodecExpr(sb, col.Codec, indent+" ", depth+1)
}
}

// explainCodecExpr handles CODEC expressions in column declarations
func explainCodecExpr(sb *strings.Builder, codec *ast.CodecExpr, indent string, depth int) {
// CODEC is rendered as a Function with one child (ExpressionList of codecs)
fmt.Fprintf(sb, "%sFunction CODEC (children 1)\n", indent)
fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(codec.Codecs))
for _, c := range codec.Codecs {
explainCodecFunction(sb, c, indent+" ", depth+2)
}
}

// explainCodecFunction handles individual codec functions (e.g., LZ4, ZSTD(10), Gorilla(1))
func explainCodecFunction(sb *strings.Builder, fn *ast.FunctionCall, indent string, depth int) {
if len(fn.Arguments) == 0 {
// Codec without parameters: just the function name
fmt.Fprintf(sb, "%sFunction %s\n", indent, fn.Name)
} else {
// Codec with parameters: function with ExpressionList of arguments
fmt.Fprintf(sb, "%sFunction %s (children 1)\n", indent, fn.Name)
fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(fn.Arguments))
for _, arg := range fn.Arguments {
Node(sb, arg, depth+2)
}
}
}

func Index(sb *strings.Builder, idx *ast.IndexDefinition, depth int) {
Expand Down
2 changes: 1 addition & 1 deletion parser/testdata/00162_mmap_compression_none/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"explain_todo":{"stmt2":true}}
{}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@
"stmt20": true,
"stmt21": true,
"stmt27": true,
"stmt3": true,
"stmt30": true,
"stmt31": true,
"stmt32": true,
"stmt36": true,
"stmt41": true,
"stmt43": true,
"stmt7": true,
"stmt8": true
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
{
"explain_todo": {
"stmt22": true,
"stmt23": true,
"stmt24": true,
"stmt25": true,
"stmt26": true,
"stmt27": true,
"stmt28": true,
"stmt38": true,
"stmt4": true,
"stmt49": true,
"stmt50": true,
"stmt58": true,
"stmt69": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
{
"explain_todo": {
"stmt16": true,
"stmt28": true,
"stmt4": true,
"stmt40": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt4": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
{
"explain_todo": {
"stmt12": true,
"stmt18": true,
"stmt19": true,
"stmt20": true,
"stmt24": true,
"stmt30": true,
"stmt31": true,
"stmt36": true,
"stmt5": true,
"stmt6": true
"stmt36": true
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
{"explain_todo":{"stmt4":true,"stmt5":true,"stmt6":true,"stmt7":true,"stmt8":true,"stmt9":true}}
{
"explain_todo": {
"stmt5": true,
"stmt6": true,
"stmt7": true,
"stmt9": true
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
{
"explain_todo": {
"stmt4": true,
"stmt5": true,
"stmt6": true
}
}
{}
6 changes: 1 addition & 5 deletions parser/testdata/00870_t64_codec/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt2": true
}
}
{}
6 changes: 1 addition & 5 deletions parser/testdata/00871_t64_codec_signed/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt2": true
}
}
{}
6 changes: 1 addition & 5 deletions parser/testdata/00872_t64_bit_codec/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt2": true
}
}
{}
6 changes: 1 addition & 5 deletions parser/testdata/00873_t64_codec_date/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt2": true
}
}
{}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
"explain_todo": {
"stmt10": true,
"stmt15": true,
"stmt25": true,
"stmt26": true,
"stmt28": true,
"stmt32": true,
"stmt40": true,
"stmt42": true,
"stmt48": true,
"stmt5": true,
"stmt56": true,
"stmt6": true
"stmt42": true
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"explain_todo": {
"stmt12": true,
"stmt13": true,
"stmt14": true,
"stmt15": true,
Expand All @@ -21,8 +20,6 @@
"stmt44": true,
"stmt45": true,
"stmt46": true,
"stmt5": true,
"stmt6": true,
"stmt9": true
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"explain_todo": {
"stmt39": true,
"stmt43": true
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"explain_todo": {
"stmt2": true,
"stmt28": true,
"stmt3": true,
"stmt4": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
{
"explain_todo": {
"stmt10": true,
"stmt14": true,
"stmt15": true,
"stmt17": true,
"stmt2": true,
"stmt3": true,
"stmt4": true,
"stmt5": true,
"stmt7": true
"stmt17": true
}
}
1 change: 0 additions & 1 deletion parser/testdata/00950_test_gorilla_codec/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"explain_todo": {
"stmt3": true,
"stmt4": true,
"stmt5": true,
"stmt6": true,
Expand Down
2 changes: 1 addition & 1 deletion parser/testdata/00957_delta_diff_bug/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"explain_todo":{"stmt3":true}}
{}
7 changes: 1 addition & 6 deletions parser/testdata/01061_alter_codec_with_type/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"explain_todo": {
"stmt2": true,
"stmt4": true
}
}
{}
30 changes: 1 addition & 29 deletions parser/testdata/01272_suspicious_codecs/metadata.json
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
{
"explain_todo": {
"stmt10": true,
"stmt11": true,
"stmt12": true,
"stmt13": true,
"stmt14": true,
"stmt15": true,
"stmt16": true,
"stmt2": true,
"stmt29": true,
"stmt30": true,
"stmt31": true,
"stmt32": true,
"stmt33": true,
"stmt34": true,
"stmt35": true,
"stmt36": true,
"stmt37": true,
"stmt38": true,
"stmt39": true,
"stmt4": true,
"stmt5": true,
"stmt6": true,
"stmt7": true,
"stmt8": true,
"stmt9": true
}
}
{}
2 changes: 1 addition & 1 deletion parser/testdata/01296_codecs_bad_arguments/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"explain_todo":{"stmt4":true}}
{}
6 changes: 1 addition & 5 deletions parser/testdata/01356_wrong_filter-type_bug/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt2": true
}
}
{}
7 changes: 1 addition & 6 deletions parser/testdata/01375_compact_parts_codecs/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"explain_todo": {
"stmt10": true,
"stmt18": true
}
}
{}
10 changes: 1 addition & 9 deletions parser/testdata/01380_coded_delta_exception_code/metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
{
"explain_todo": {
"stmt1": true,
"stmt2": true,
"stmt3": true,
"stmt4": true,
"stmt5": true
}
}
{}
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"explain_todo": {
"stmt3": true
}
}
{}
2 changes: 0 additions & 2 deletions parser/testdata/01390_check_table_codec/metadata.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"explain_todo": {
"stmt3": true,
"stmt5": true,
"stmt7": true,
"stmt9": true
}
}
9 changes: 1 addition & 8 deletions parser/testdata/01462_test_codec_on_alias/metadata.json
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
{
"explain_todo": {
"stmt3": true,
"stmt5": true,
"stmt7": true,
"stmt9": true
}
}
{}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"stmt13": true,
"stmt20": true,
"stmt3": true,
"stmt30": true,
"stmt37": true,
"stmt38": true
"stmt30": true
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"explain_todo": {
"stmt11": true,
"stmt6": true,
"stmt8": true
"stmt6": true
}
}
6 changes: 1 addition & 5 deletions parser/testdata/01622_codec_zstd_long/metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"explain_todo": {
"stmt10": true,
"stmt11": true,
"stmt7": true,
"stmt8": true,
"stmt9": true
"stmt7": true
}
}
2 changes: 1 addition & 1 deletion parser/testdata/01683_codec_encrypted/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"explain_todo":{"stmt2":true,"stmt6":true}}
{}
1 change: 0 additions & 1 deletion parser/testdata/01701_if_tuple_segfault/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"explain_todo": {
"stmt2": true,
"stmt7": true,
"stmt8": true,
"stmt9": true
Expand Down
3 changes: 1 addition & 2 deletions parser/testdata/01780_column_sparse_pk/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"explain_todo": {
"stmt17": true,
"stmt18": true,
"stmt9": true
"stmt18": true
}
}
2 changes: 0 additions & 2 deletions parser/testdata/01911_logical_error_minus/metadata.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"explain_todo": {
"stmt11": true,
"stmt12": true,
"stmt13": true,
"stmt14": true,
"stmt15": true,
"stmt16": true,
"stmt3": true,
"stmt4": true,
"stmt5": true,
"stmt6": true,
Expand Down
Loading