harshkumar-2005 commented on code in PR #47922:
URL: https://github.com/apache/arrow/pull/47922#discussion_r2759088967


##########
cpp/src/arrow/type_traits.h:
##########
@@ -596,6 +598,19 @@ struct TypeTraits<ExtensionType> {
 };
 /// @}
 
+/// \brief Create a data type instance from a type ID for parameter-free types
+///
+/// This function creates a data type instance for types that don't require
+/// additional parameters (where TypeTraits<T>::is_parameter_free is true).
+/// For types that require parameters (like TimestampType or ListType),
+/// this function will return an error.
+///
+/// \param[in] id The type ID to create a type instance for
+/// \return Result with a shared pointer to the created DataType instance,
+///         or an error if the type requires parameters
+ARROW_EXPORT
+Result<std::shared_ptr<DataType>> type_singleton(Type::type id);

Review Comment:
   Thanks for the review!
   
   I’ve rebased the branch onto the latest upstream `main` and updated the 
implementation:
   
   - `type_singleton` now uses `VisitTypeIdInline` with 
`TypeTraits<T>::type_singleton`
   - The function is moved to `type.h` / `type.cc`
   - Tests only check representative parameter-free types
   - Legacy error semantics are preserved for invalid type IDs
   
   Please let me know if any further changes are needed.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to