Skip to content

Improve performance of conditional expressions #3025

Description

@andygrove

What is the problem the feature request solves?

Conditional expressions are slower when Comet is enabled. This will impact TPC-H and TPC-DS performance.

OpenJDK 64-Bit Server VM 17.0.17+10-Ubuntu-122.04 on Linux 6.8.0-90-generic
AMD Ryzen 9 7950X3D 16-Core Processor
Case When Literal (3 branches):           Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                48             52           2         21.9          45.7       1.0X
Comet (Scan)                                         46             51           3         22.7          44.1       1.0X
Comet (Scan + Exec)                                  57             60           2         18.4          54.3       0.8X

OpenJDK 64-Bit Server VM 17.0.17+10-Ubuntu-122.04 on Linux 6.8.0-90-generic
AMD Ryzen 9 7950X3D 16-Core Processor
Case When Literal (10 branches):          Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                48             51           1         21.6          46.2       1.0X
Comet (Scan)                                         48             49           1         21.8          45.8       1.0X
Comet (Scan + Exec)                                  67             69           1         15.8          63.4       0.7X

OpenJDK 64-Bit Server VM 17.0.17+10-Ubuntu-122.04 on Linux 6.8.0-90-generic
AMD Ryzen 9 7950X3D 16-Core Processor
Case When Column Result (3 branches):     Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                37             40           1         28.0          35.7       1.0X
Comet (Scan)                                         39             42           4         26.9          37.1       1.0X
Comet (Scan + Exec)                                  45             47           3         23.6          42.4       0.8X

OpenJDK 64-Bit Server VM 17.0.17+10-Ubuntu-122.04 on Linux 6.8.0-90-generic
AMD Ryzen 9 7950X3D 16-Core Processor
Case When Column Result (10 branches):    Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                55             56           1         19.2          52.0       1.0X
Comet (Scan)                                         47             50           2         22.3          44.8       1.2X
Comet (Scan + Exec)                                  73             76           1         14.3          69.9       0.7X

OpenJDK 64-Bit Server VM 17.0.17+10-Ubuntu-122.04 on Linux 6.8.0-90-generic
AMD Ryzen 9 7950X3D 16-Core Processor
If Literal:                               Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                40             43           4         25.9          38.6       1.0X
Comet (Scan)                                         40             42           2         26.1          38.2       1.0X
Comet (Scan + Exec)                                  45             46           1         23.3          42.9       0.9X

OpenJDK 64-Bit Server VM 17.0.17+10-Ubuntu-122.04 on Linux 6.8.0-90-generic
AMD Ryzen 9 7950X3D 16-Core Processor
If Column Result:                         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                33             35           1         31.8          31.4       1.0X
Comet (Scan)                                         33             35           1         31.7          31.5       1.0X
Comet (Scan + Exec)                                  39             41           2         26.8          37.3       0.8X

OpenJDK 64-Bit Server VM 17.0.17+10-Ubuntu-122.04 on Linux 6.8.0-90-generic
AMD Ryzen 9 7950X3D 16-Core Processor
Nested If Literal (4 outcomes):           Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                40             43           2         26.0          38.5       1.0X
Comet (Scan)                                         41             42           1         25.8          38.8       1.0X
Comet (Scan + Exec)                                  52             55           1         20.0          49.9       0.8X

OpenJDK 64-Bit Server VM 17.0.17+10-Ubuntu-122.04 on Linux 6.8.0-90-generic
AMD Ryzen 9 7950X3D 16-Core Processor
Nested If Column Result (4 outcomes):     Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                42             45           2         24.9          40.2       1.0X
Comet (Scan)                                         42             44           2         24.8          40.4       1.0X
Comet (Scan + Exec)                                  50             52           2         21.1          47.5       0.8X

Describe the potential solution

No response

Additional context

No response

Activity

  1. added this to the 0.14.0 milestone on Jan 2, 2026
  2. self-assigned this
    on Jan 2, 2026
  3. andygrove commented on Jan 2, 2026

    @andygrove
    MemberAuthor

    I am going to work on this one.

  4. removed this from the 0.14.0 milestone on Mar 12, 2026
  5. added a commit that references this issue on Sep 30, 2026
    b38a60b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions