You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2026/01/07 04:22:22 UTC

[PR] [Minor][C++][Compute] Remove resolved TODO comments in case_when null validation [arrow]

HyukjinKwon opened a new pull request, #48749:
URL: https://github.com/apache/arrow/pull/48749

   ### Rationale for this change
   
   https://github.com/apache/arrow/blob/abbcd53007e613d8ece3e4abcdbae9ba2f4c618f/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L1771
   
   https://github.com/apache/arrow/blob/abbcd53007e613d8ece3e4abcdbae9ba2f4c618f/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L1818
   
   https://github.com/apache/arrow/blob/abbcd53007e613d8ece3e4abcdbae9ba2f4c618f/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L1859
   
   https://github.com/apache/arrow/blob/abbcd53007e613d8ece3e4abcdbae9ba2f4c618f/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L1900
   
   https://github.com/apache/arrow/blob/abbcd53007e613d8ece3e4abcdbae9ba2f4c618f/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L1917
   
   https://github.com/apache/arrow/blob/abbcd53007e613d8ece3e4abcdbae9ba2f4c618f/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L1934
   
   https://github.com/apache/arrow/blob/abbcd53007e613d8ece3e4abcdbae9ba2f4c618f/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L1961
   
   https://github.com/apache/arrow/blob/abbcd53007e613d8ece3e4abcdbae9ba2f4c618f/cpp/src/arrow/compute/kernels/scalar_if_else.cc#L1974
   
   are all user-facing checks so cannot be `DCHECK`.
   
   (Generated by ChatGPT)
   
   ```python
   import pyarrow as pa
   import pyarrow.compute as pc
   
   print("=" * 60)
   print("PyArrow case_when Validation Examples")
   print("=" * 60)
   
   # Helper function to test case_when
   def test_case_when(name, cond_array, value1, value2, line_number):
       try:
           result = pc.case_when(cond_array, value1, value2)
           print(f"✅ {name}: Success")
           return True
       except pa.ArrowInvalid as e:
           print(f"❌ {name} (line {line_number}): {e}")
           return False
   
   # Create condition structs
   valid_cond = pa.array([
       {'c1': True}, {'c1': False}
   ], type=pa.struct([pa.field('c1', pa.bool_())]))
   
   invalid_cond = pa.array([
       {'c1': True}, None  # ← OUTER NULL triggers validation!
   ], type=pa.struct([pa.field('c1', pa.bool_())]))
   
   print("\n1. BINARY TYPE (line 1771 - enable_if_base_binary)")
   print("-" * 60)
   binary1 = pa.array([b'v1', b'v1'])
   binary2 = pa.array([b'v2', b'v2'])
   test_case_when("Valid binary", valid_cond, binary1, binary2, 1771)
   test_case_when("Invalid binary", invalid_cond, binary1, binary2, 1771)
   
   print("\n2. LIST TYPE (line 1818 - enable_if_var_size_list)")
   print("-" * 60)
   list1 = pa.array([[1, 2], [3, 4]])
   list2 = pa.array([[5, 6], [7, 8]])
   test_case_when("Valid list", valid_cond, list1, list2, 1818)
   test_case_when("Invalid list", invalid_cond, list1, list2, 1818)
   
   print("\n3. LIST_VIEW TYPE (line 1859 - enable_if_list_view)")
   print("-" * 60)
   listview1 = pa.array([[1, 2], [3, 4]], type=pa.list_view(pa.int64()))
   listview2 = pa.array([[5, 6], [7, 8]], type=pa.list_view(pa.int64()))
   test_case_when("Valid list_view", valid_cond, listview1, listview2, 1859)
   test_case_when("Invalid list_view", invalid_cond, listview1, listview2, 1859)
   
   print("\n4. MAP TYPE (line 1900)")
   print("-" * 60)
   map1 = pa.array([[('k1', 100)], [('k2', 200)]], type=pa.map_(pa.string(), pa.int64()))
   map2 = pa.array([[('k3', 300)], [('k4', 400)]], type=pa.map_(pa.string(), pa.int64()))
   test_case_when("Valid map", valid_cond, map1, map2, 1900)
   test_case_when("Invalid map", invalid_cond, map1, map2, 1900)
   
   print("\n5. STRUCT TYPE (line 1917)")
   print("-" * 60)
   struct1 = pa.array([{'x': 1}, {'x': 2}], type=pa.struct([pa.field('x', pa.int64())]))
   struct2 = pa.array([{'x': 3}, {'x': 4}], type=pa.struct([pa.field('x', pa.int64())]))
   test_case_when("Valid struct", valid_cond, struct1, struct2, 1917)
   test_case_when("Invalid struct", invalid_cond, struct1, struct2, 1917)
   
   print("\n6. FIXED_SIZE_LIST TYPE (line 1934)")
   print("-" * 60)
   fsl1 = pa.array([[1, 2], [3, 4]], type=pa.list_(pa.int64(), 2))
   fsl2 = pa.array([[5, 6], [7, 8]], type=pa.list_(pa.int64(), 2))
   test_case_when("Valid fixed_size_list", valid_cond, fsl1, fsl2, 1934)
   test_case_when("Invalid fixed_size_list", invalid_cond, fsl1, fsl2, 1934)
   
   print("\n7. DICTIONARY TYPE (line 1974)")
   print("-" * 60)
   dict1 = pa.array(['a', 'b']).dictionary_encode()
   dict2 = pa.array(['c', 'd']).dictionary_encode()
   test_case_when("Valid dictionary", valid_cond, dict1, dict2, 1974)
   test_case_when("Invalid dictionary", invalid_cond, dict1, dict2, 1974)
   
   print("\n" + "=" * 60)
   print("KEY POINT: Outer nulls (None in struct) trigger validation")
   print("           Inner nulls ({'c1': None}) are allowed")
   print("=" * 60)
   ```
   
   ### What changes are included in this PR?
   
   This PR removes obsolete TODOs. They cannot be DCHECK.
   
   ### Are these changes tested?
   
   Yes, as described above.
   
   ### Are there any user-facing changes?
   
   No, dev-only.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Minor][C++][Compute] Remove resolved TODO comments in case_when null validation [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #48749:
URL: https://github.com/apache/arrow/pull/48749#issuecomment-3717264787

   <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
   -->
   
   Thanks for opening a pull request!
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   See also:
   
     * [Other pull requests](https://github.com/apache/arrow/pulls/)
     * [Contribution Guidelines - Contributing Overview](https://arrow.apache.org/docs/developers/overview.html)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: [C++][Compute] Remove resolved TODO comments in case_when null validation [arrow]

Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #48749:
URL: https://github.com/apache/arrow/pull/48749#issuecomment-3725371553

   After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 5b1af01098f9281e7c04c5017a7f5232a683f646.
   
   There weren't enough matching historic benchmark results to make a call on whether there were regressions.
   
   The [full Conbench report](https://github.com/apache/arrow/runs/59838937718) has more details.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: [C++][Compute] Remove resolved TODO comments in case_when null validation [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou merged PR #48749:
URL: https://github.com/apache/arrow/pull/48749


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org