Skip to content

feat: Create benchmarks comet cast - #2932

Merged
andygrove merged 7 commits into
apache:mainfrom
coderfender:create_benchmarks_comet_cast
Dec 22, 2025
Merged

andygrove merged 7 commits into
apache:mainfrom
coderfender:create_benchmarks_comet_cast

Conversation

@coderfender

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Create mechanism to benchmark CometCast operation with ANSI support (Similar to CometAggregatedBenchmark) to have a baseline understanding of native cast performance

Closes #.

Rationale for this change

What changes are included in this PR?

How are these changes tested?

Comment thread spark/src/test/scala/org/apache/spark/sql/benchmark/CometCastBenchmark.scala Outdated
Comment thread spark/src/test/scala/org/apache/spark/sql/benchmark/CometCastBenchmark.scala Outdated
Comment thread spark/src/test/scala/org/apache/spark/sql/benchmark/CometCastBenchmark.scala Outdated
@codecov-commenter

codecov-commenter commented Dec 18, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.63%. Comparing base (f09f8af) to head (ed9d181).
⚠️ Report is 782 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2932      +/-   ##
============================================
+ Coverage     56.12%   59.63%   +3.50%     
- Complexity      976     1379     +403     
============================================
  Files           119      167      +48     
  Lines         11743    15459    +3716     
  Branches       2251     2559     +308     
============================================
+ Hits           6591     9219    +2628     
- Misses         4012     4946     +934     
- Partials       1140     1294     +154     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread spark/src/test/scala/org/apache/spark/sql/benchmark/CometCastBenchmark.scala Outdated
@coderfender

Copy link
Copy Markdown
Contributor Author
================================================================================================
Running benchmark BooleanType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : BooleanType , ansi mode enabled : false:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : BOOLEAN , ansi mode enabled : false            172            186          14         60.9          16.4       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : BOOLEAN , ansi mode enabled : false            224            253          22         46.7          21.4       0.8X


================================================================================================
Running benchmark BooleanType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : BooleanType , ansi mode enabled : true:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : BOOLEAN , ansi mode enabled : true            170            190          23         61.7          16.2       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : BOOLEAN , ansi mode enabled : true            211            228          12         49.7          20.1       0.8X


================================================================================================
Running benchmark ByteType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : ByteType , ansi mode enabled : false:            Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : TINYINT , ansi mode enabled : false            174            216          23         60.2          16.6       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : TINYINT , ansi mode enabled : false            213            237          21         49.2          20.3       0.8X


================================================================================================
Running benchmark ByteType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : ByteType , ansi mode enabled : true:            Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : TINYINT , ansi mode enabled : true             35             57          23        298.3           3.4       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : TINYINT , ansi mode enabled : true             27             55          27        393.5           2.5       1.3X


================================================================================================
Running benchmark ShortType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : ShortType , ansi mode enabled : false:            Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : SMALLINT , ansi mode enabled : false            175            186          12         60.0          16.7       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : SMALLINT , ansi mode enabled : false            198            223          16         52.9          18.9       0.9X


================================================================================================
Running benchmark ShortType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : ShortType , ansi mode enabled : true:            Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : SMALLINT , ansi mode enabled : true             40             56          17        261.4           3.8       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : SMALLINT , ansi mode enabled : true             27             56          20        394.4           2.5       1.5X


================================================================================================
Running benchmark IntegerType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : IntegerType , ansi mode enabled : false:     Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
--------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : INT , ansi mode enabled : false            174            186          16         60.2          16.6       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : INT , ansi mode enabled : false            203            241          24         51.5          19.4       0.9X


================================================================================================
Running benchmark IntegerType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : IntegerType , ansi mode enabled : true:     Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
-------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : INT , ansi mode enabled : true             40             58          21        263.3           3.8       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : INT , ansi mode enabled : true             24             59          27        429.0           2.3       1.6X


================================================================================================
Running benchmark LongType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : LongType , ansi mode enabled : false:           Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : BIGINT , ansi mode enabled : false            175            206          17         59.9          16.7       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : BIGINT , ansi mode enabled : false            163            206          29         64.5          15.5       1.1X


================================================================================================
Running benchmark LongType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : LongType , ansi mode enabled : true:           Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : BIGINT , ansi mode enabled : true            175            193          15         60.0          16.7       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : BIGINT , ansi mode enabled : true            155            197          36         67.6          14.8       1.1X


================================================================================================
Running benchmark FloatType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : FloatType , ansi mode enabled : false:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : FLOAT , ansi mode enabled : false            174            183          12         60.4          16.6       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : FLOAT , ansi mode enabled : false            176            243          29         59.5          16.8       1.0X


================================================================================================
Running benchmark FloatType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : FloatType , ansi mode enabled : true:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
---------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : FLOAT , ansi mode enabled : true            177            199           8         59.3          16.8       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : FLOAT , ansi mode enabled : true            181            250          27         57.9          17.3       1.0X


================================================================================================
Running benchmark DoubleType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : DoubleType , ansi mode enabled : false:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : DOUBLE , ansi mode enabled : false            175            186          12         60.1          16.7       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : DOUBLE , ansi mode enabled : false            225            257          15         46.7          21.4       0.8X


================================================================================================
Running benchmark DoubleType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : DoubleType , ansi mode enabled : true:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : DOUBLE , ansi mode enabled : true            186            213          23         56.5          17.7       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : DOUBLE , ansi mode enabled : true            189            245          32         55.5          18.0       1.0X


================================================================================================
Running benchmark DecimalType(10,2))
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : DecimalType(10,2) , ansi mode enabled : false:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : DECIMAL(10,2) , ansi mode enabled : false            543            559          19         19.3          51.8       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : DECIMAL(10,2) , ansi mode enabled : false            285            331          36         36.8          27.2       1.9X


================================================================================================
Running benchmark DecimalType(10,2))
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : DecimalType(10,2) , ansi mode enabled : true:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : DECIMAL(10,2) , ansi mode enabled : true             33             59          14        317.3           3.2       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : DECIMAL(10,2) , ansi mode enabled : true             24             59          35        433.6           2.3       1.4X


================================================================================================
Running benchmark StringType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : StringType , ansi mode enabled : false:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : STRING , ansi mode enabled : false            567            568           1         18.5          54.1       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : STRING , ansi mode enabled : false            485            514          36         21.6          46.3       1.2X


================================================================================================
Running benchmark StringType)
================================================================================================

OpenJDK 64-Bit Server VM 17.0.16+8-LTS on Mac OS X 16.0
Apple M2 Max
Cast function from : LongType to : StringType , ansi mode enabled : true:         Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
----------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL Parquet - Spark Cast expr from BIGINT to : STRING , ansi mode enabled : true            570            582          21         18.4          54.4       1.0X
SQL Parquet - Comet Cast expr from BIGINT to : STRING , ansi mode enabled : true            445            477          33         23.6          42.4       1.3X

Comment thread spark/src/test/scala/org/apache/spark/sql/benchmark/CometCastBenchmark.scala Outdated
@coderfender

Copy link
Copy Markdown
Contributor Author

Addressed review comments

@andygrove andygrove left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @coderfender

@coderfender

Copy link
Copy Markdown
Contributor Author

Thank you for the approval @andygrove

@andygrove
andygrove merged commit c2ce72a into apache:main Dec 22, 2025
160 of 163 checks passed
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 this pull request may close these issues.

3 participants