Skip to content

Conversation

@harshkumar-2005
Copy link

@harshkumar-2005 harshkumar-2005 commented Oct 23, 2025

Rationale

Introduces a type_singleton(Type::type id) utility to create parameter-free DataType instances
(such as int32, boolean, utf8, etc.) without requiring parameters. Returns an error for
parameterized or unsupported types.

Implementation Details

  • Added implementation in type_traits.cc
  • Declared function in type_traits.h
  • Added comprehensive tests for:
    • Parameter-free types (success cases)
    • Parameterized types (expected error)
    • Invalid type IDs (graceful error handling)

Testing

All tests in arrow-type-test passed locally:

Notes

This utility simplifies internal code where parameter-free type instances are required.

@github-actions
Copy link

Thanks for opening a pull request!

If this is not a minor PR. 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 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:

@harshkumar-2005
Copy link
Author

@pitrou Cl jobs are awaiting maintainer approval. Please approve to trigger the remaining checks.

@harshkumar-2005
Copy link
Author

@pitrou
This PR has 9 workflows pending approval. Kindly review and approve to initiate the workflow runs. Thank you!

@harshkumar-2005 harshkumar-2005 changed the title ARROW-46531: [C++] Add type_singleton utility function and tests GH-46531: [C++] Add type_singleton utility function and tests GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY} Oct 26, 2025
@harshkumar-2005 harshkumar-2005 changed the title GH-46531: [C++] Add type_singleton utility function and tests GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY} GH-46531: [C++] Add type_singleton utility function and tests. Oct 26, 2025
@github-actions
Copy link

⚠️ GitHub issue #46531 has been automatically assigned in GitHub to PR creator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant