This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 0d5090d5c Publish built docs triggered by 
d19e1f24f35414111795b96aca066698768257fc
0d5090d5c is described below

commit 0d5090d5cae6329265923df450a1901d00a41106
Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jan 16 20:22:44 2026 +0000

    Publish built docs triggered by d19e1f24f35414111795b96aca066698768257fc
---
 .../adding_a_new_expression.md.txt                 | 23 ++++++++++++++++++++++
 contributor-guide/adding_a_new_expression.html     | 20 +++++++++++++++++++
 searchindex.js                                     |  2 +-
 3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/_sources/contributor-guide/adding_a_new_expression.md.txt 
b/_sources/contributor-guide/adding_a_new_expression.md.txt
index 74825f430..7853c126b 100644
--- a/_sources/contributor-guide/adding_a_new_expression.md.txt
+++ b/_sources/contributor-guide/adding_a_new_expression.md.txt
@@ -236,6 +236,29 @@ test("unhex") {
 }
 ```
 
+#### Testing with Literal Values
+
+When writing tests that use literal values (e.g., `SELECT 
my_func('literal')`), Spark's constant folding optimizer may evaluate the 
expression at planning time rather than execution time. This means your Comet 
implementation might not actually be exercised during the test.
+
+To ensure literal expressions are executed by Comet, disable the constant 
folding optimizer:
+
+```scala
+test("my_func with literals") {
+  withSQLConf(SQLConf.OPTIMIZER_EXCLUDED_RULES.key ->
+      "org.apache.spark.sql.catalyst.optimizer.ConstantFolding") {
+    checkSparkAnswerAndOperator("SELECT my_func('literal_value')")
+  }
+}
+```
+
+This is particularly important for:
+
+- Edge case tests using specific literal values (e.g., null handling, overflow 
conditions)
+- Tests verifying behavior with special input values
+- Any test where the expression inputs are entirely literal
+
+When possible, prefer testing with column references from tables (as shown in 
the `unhex` example above), which naturally avoids the constant folding issue.
+
 ### Adding the Expression To the Protobuf Definition
 
 Once you have the expression implemented in Scala, you might need to update 
the protobuf definition to include the new expression. You may not need to do 
this if the expression is already covered by the existing protobuf definition 
(e.g. you're adding a new scalar function that uses the `ScalarFunc` message).
diff --git a/contributor-guide/adding_a_new_expression.html 
b/contributor-guide/adding_a_new_expression.html
index e33056296..098a8502c 100644
--- a/contributor-guide/adding_a_new_expression.html
+++ b/contributor-guide/adding_a_new_expression.html
@@ -657,6 +657,26 @@ under the License.
 </pre></div>
 </div>
 </section>
+<section id="testing-with-literal-values">
+<h4>Testing with Literal Values<a class="headerlink" 
href="#testing-with-literal-values" title="Link to this heading">#</a></h4>
+<p>When writing tests that use literal values (e.g., <code class="docutils 
literal notranslate"><span class="pre">SELECT</span> <span 
class="pre">my_func('literal')</span></code>), Spark’s constant folding 
optimizer may evaluate the expression at planning time rather than execution 
time. This means your Comet implementation might not actually be exercised 
during the test.</p>
+<p>To ensure literal expressions are executed by Comet, disable the constant 
folding optimizer:</p>
+<div class="highlight-scala notranslate"><div 
class="highlight"><pre><span></span><span class="n">test</span><span 
class="p">(</span><span class="s">&quot;my_func with literals&quot;</span><span 
class="p">)</span><span class="w"> </span><span class="p">{</span>
+<span class="w">  </span><span class="n">withSQLConf</span><span 
class="p">(</span><span class="nc">SQLConf</span><span class="p">.</span><span 
class="nc">OPTIMIZER_EXCLUDED_RULES</span><span class="p">.</span><span 
class="n">key</span><span class="w"> </span><span class="o">-&gt;</span>
+<span class="w">      </span><span 
class="s">&quot;org.apache.spark.sql.catalyst.optimizer.ConstantFolding&quot;</span><span
 class="p">)</span><span class="w"> </span><span class="p">{</span>
+<span class="w">    </span><span 
class="n">checkSparkAnswerAndOperator</span><span class="p">(</span><span 
class="s">&quot;SELECT my_func(&#39;literal_value&#39;)&quot;</span><span 
class="p">)</span>
+<span class="w">  </span><span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+</div>
+<p>This is particularly important for:</p>
+<ul class="simple">
+<li><p>Edge case tests using specific literal values (e.g., null handling, 
overflow conditions)</p></li>
+<li><p>Tests verifying behavior with special input values</p></li>
+<li><p>Any test where the expression inputs are entirely literal</p></li>
+</ul>
+<p>When possible, prefer testing with column references from tables (as shown 
in the <code class="docutils literal notranslate"><span 
class="pre">unhex</span></code> example above), which naturally avoids the 
constant folding issue.</p>
+</section>
 </section>
 <section id="adding-the-expression-to-the-protobuf-definition">
 <h3>Adding the Expression To the Protobuf Definition<a class="headerlink" 
href="#adding-the-expression-to-the-protobuf-definition" title="Link to this 
heading">#</a></h3>
diff --git a/searchindex.js b/searchindex.js
index f2b48cd27..c9447a1be 100644
--- a/searchindex.js
+++ b/searchindex.js
@@ -1 +1 @@
-Search.setIndex({"alltitles": {"1. Install Comet": [[21, "install-comet"]], 
"1. Native Operators (nativeExecs map)": [[4, 
"native-operators-nativeexecs-map"]], "2. Clone Spark and Apply Diff": [[21, 
"clone-spark-and-apply-diff"]], "2. Sink Operators (sinks map)": [[4, 
"sink-operators-sinks-map"]], "3. Comet JVM Operators": [[4, 
"comet-jvm-operators"]], "3. Run Spark SQL Tests": [[21, 
"run-spark-sql-tests"]], "ANSI Mode": [[24, "ansi-mode"], [37, "ansi-mode"], 
[50, "ansi-mode"], [90, "ans [...]
\ No newline at end of file
+Search.setIndex({"alltitles": {"1. Install Comet": [[21, "install-comet"]], 
"1. Native Operators (nativeExecs map)": [[4, 
"native-operators-nativeexecs-map"]], "2. Clone Spark and Apply Diff": [[21, 
"clone-spark-and-apply-diff"]], "2. Sink Operators (sinks map)": [[4, 
"sink-operators-sinks-map"]], "3. Comet JVM Operators": [[4, 
"comet-jvm-operators"]], "3. Run Spark SQL Tests": [[21, 
"run-spark-sql-tests"]], "ANSI Mode": [[24, "ansi-mode"], [37, "ansi-mode"], 
[50, "ansi-mode"], [90, "ans [...]
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to