Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: panic on comparison lookup #7412

Closed
knz opened this issue Jun 22, 2016 · 0 comments · Fixed by #7512
Closed

sql: panic on comparison lookup #7412

knz opened this issue Jun 22, 2016 · 0 comments · Fixed by #7512
Assignees

Comments

@knz
Copy link
Contributor

knz commented Jun 22, 2016

Found by #7409:

SELECT 89, COALESCE ( + 94, - 57, CASE 
  WHEN COUNT ( * ) NOT BETWEEN ( NULL ) AND - 43 * ( + 34 * COUNT ( * ) ) 
  THEN + ( - COALESCE ( 9, 74 ) ) 
  ELSE - MAX ( - 89 ) END
 + - COALESCE ( 80 + 11, ( + COUNT ( * ) ) ) * 95, 26 )
 + CASE NULLIF ( + 87, - 57 * SUM ( DISTINCT 42 ) ) 
     WHEN 58 THEN NULL WHEN 59 THEN NULL ELSE - 70 END AS col2;
panic: lookup for ComparisonExpr ((COUNT((*)[int]))[int] < (((NULL)[NULL]))[NULL])[bool]'s CmpOp failed                                                                                                            
goroutine 322 [running]:                                                                                                                                                                                                                                                       panic(0x15bb420, 0xc8208917b0)                                                                                                                                                                                                                                                         /mnt/kena/go1.6.2/src/runtime/panic.go:481 +0x3e6                                                                                                                                                                                                                      github.com/cockroachdb/cockroach/sql/parser.(*ComparisonExpr).memoizeFn(0xc8202e4b60)                                                                                                                                                                                                  /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/expr.go:316 +0x47d
github.com/cockroachdb/cockroach/sql/parser.NewTypedComparisonExpr(0x1, 0x7f3b424000d8, 0xc8206afd00, 0x7f3b423d2b10, 0xc8208a1940, 0xc8206afd00)                                                                                                                                      /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/expr.go:302 +0x138                                                                                                                                                                                        github.com/cockroachdb/cockroach/sql/parser.(*RangeCond).normalize(0xc8203aa690, 0xc820880e20, 0x0, 0x0)
        /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/normalize.go:324 +0x441
github.com/cockroachdb/cockroach/sql/parser.(*normalizeVisitor).VisitPre(0xc820880e20, 0x7f3b42405328, 0xc8203aa690, 0x7f3b423d2830, 0x0, 0x0)                                                                                                                                         /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/normalize.go:369 +0xfd                                                                                                                                                                                    github.com/cockroachdb/cockroach/sql/parser.WalkExpr(0x7f3b42381d40, 0xc820880e20, 0x7f3b42405328, 0xc8203aa690, 0x0, 0x0, 0xc8203aa6e0)                                                                                                                                               /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:404 +0x56
github.com/cockroachdb/cockroach/sql/parser.(*CaseExpr).Walk(0xc8203aa6e0, 0x7f3b42381d40, 0xc820880e20, 0x0, 0x0)                                                                                                                                                                     /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:103 +0x18b
github.com/cockroachdb/cockroach/sql/parser.WalkExpr(0x7f3b42381d40, 0xc820880e20, 0x7f3b423d2830, 0xc8203aa6e0, 0x7f3b423d2830, 0xc8203aa6e0, 0x7f3b423d19f0)                                                                                                                         /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:407 +0x98
github.com/cockroachdb/cockroach/sql/parser.(*BinaryExpr).Walk(0xc82074a480, 0x7f3b42381d40, 0xc820880e20, 0x0, 0x0)                                                                                                                                                                   /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:68 +0x6d                                                                                                                                                                                          github.com/cockroachdb/cockroach/sql/parser.WalkExpr(0x7f3b42381d40, 0xc820880e20, 0x7f3b423d19f0, 0xc82074a480, 0x7f3b423d19f0, 0xc82074a480, 0xc820880e00)
        /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:407 +0x98                                                                                                                                                                                         github.com/cockroachdb/cockroach/sql/parser.(*CoalesceExpr).Walk(0xc8203ac5c0, 0x7f3b42381d40, 0xc820880e20, 0x0, 0x0)
        /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:147 +0xe6                                                                                                                                                                                         github.com/cockroachdb/cockroach/sql/parser.WalkExpr(0x7f3b42381d40, 0xc820880e20, 0x7f3b423d2870, 0xc8203ac5c0, 0x7f3b423d2870, 0xc8203ac5c0, 0x7f3b423d19f0)                                                                                                                         /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:407 +0x98                                                                                                                                                                                         github.com/cockroachdb/cockroach/sql/parser.(*BinaryExpr).Walk(0xc82074a580, 0x7f3b42381d40, 0xc820880e20, 0x0, 0x0)                                                                                                                                                                   /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:68 +0x6d
github.com/cockroachdb/cockroach/sql/parser.WalkExpr(0x7f3b42381d40, 0xc820880e20, 0x7f3b423d19f0, 0xc82074a580, 0x7f3b423d19f0, 0xc82074a580, 0xc82019f300)                                                                                                                           /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/walk.go:407 +0x98
github.com/cockroachdb/cockroach/sql/parser.(*Parser).NormalizeExpr(0xc820880988, 0xc8208808b0, 0x7f3b423d20a8, 0xc82074a580, 0x0, 0x0, 0x0, 0x0)                                                                                                                                      /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/parser/parse.go:129 +0x18d
github.com/cockroachdb/cockroach/sql.(*planner).analyzeExpr(0xc820880890, 0x7f3b423d19f0, 0xc8206afb80, 0xc82002ca08, 0x1, 0x1, 0xc820410270, 0x0, 0x0, 0x0, ...)
        /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/analyze.go:1644 +0x2dd                                                                                                                                                                                           github.com/cockroachdb/cockroach/sql.(*selectNode).addRender(0xc8202ba240, 0x7f3b423d19f0, 0xc8206afb80, 0xc82072d146, 0x4, 0x0, 0x0, 0x0, 0x0)                                                                                                                                        /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/select.go:635 +0x5ea                                                                                                                                                                                             github.com/cockroachdb/cockroach/sql.(*selectNode).initTargets(0xc8202ba240, 0xc8203ac480, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0)
        /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/select.go:529 +0x156
github.com/cockroachdb/cockroach/sql.(*planner).SelectClause(0xc820880890, 0xc8206afc00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)                                                                                                                                                  /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/select.go:309 +0x1cb
github.com/cockroachdb/cockroach/sql.(*planner).Select(0xc820880890, 0xc820410210, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0)                                                                                                                                                             /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/select.go:254 +0x333
github.com/cockroachdb/cockroach/sql.(*planner).newPlan(0xc820880890, 0x7f3b423d0b70, 0xc820410210, 0x0, 0x0, 0x0, 0x1da9901, 0x0, 0x0, 0x0, ...)
        /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/plan.go:273 +0x1556
github.com/cockroachdb/cockroach/sql.(*planner).makePlan(0xc820880890, 0x7f3b423d0b70, 0xc820410210, 0x817901, 0x0, 0x0, 0x0, 0x0)
        /mnt/kena/go/src/github.com/cockroachdb/cockroach/sql/plan.go:211 +0x83                                                                                                                                                                                                github.com/cockroachdb/cockroach/sql.(*Executor).execStmt(0xc8203b80f0, 0x7f3b423d0b70, 0xc820410210, 0xc820880890, 0xc820410201, 0x0, 0x0, 0x0, 0x0, 0x0, ...)  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant