Skip to content

Conversation

@shubhamkoti
Copy link

@shubhamkoti shubhamkoti commented Jan 7, 2026

Rationale for this change

As reported in #48740, the CTypeTraits specializations were missing for Decimal128Type and Decimal256Type. This prevented generic code from correctly identifying the C++ types associated with these Arrow types.

What changes are included in this PR?

  • Added CTypeTraits<Decimal128Type> mapping to Decimal128.
  • Added CTypeTraits<Decimal256Type> mapping to Decimal256.

Are these changes tested?

Yes. I verified the changes locally by running the existing type traits tests.
Command used: ctest -R arrow-type-traits

Are there any user-facing changes?

No.

Closes #48740

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

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

@HuaHuaY
Copy link
Contributor

HuaHuaY commented Jan 9, 2026

I think that what you need is TypeTraits but not CTypeTraits

@pitrou
Copy link
Member

pitrou commented Jan 12, 2026

cc @zanmato1984

Copy link
Contributor

@zanmato1984 zanmato1984 left a comment

Choose a reason for hiding this comment

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

We might also want to do for Decimal32/64 as well.

@zanmato1984
Copy link
Contributor

I think that what you need is TypeTraits but not CTypeTraits

Hi @HuaHuaY , this issue is specifically for CTypeTraits which are now missing for certain types (mostly Decimals).

@HuaHuaY
Copy link
Contributor

HuaHuaY commented Jan 14, 2026

I think that what you need is TypeTraits but not CTypeTraits

Hi @HuaHuaY , this issue is specifically for CTypeTraits which are now missing for certain types (mostly Decimals).

But I think that this PR is implementing types' TypeTraits instead of CTypeTraits. You can check the code around line 354 which is similar to this PR.

// line 354
template <>
struct TypeTraits<Decimal128Type> {
  ...
  using CType = Decimal128;
  ...
};

template <>
struct TypeTraits<Decimal256Type> {
  ...
  using CType = Decimal256;
  ...
};

// this PR
template <>
struct CTypeTraits<Decimal128Type> {
  using ArrowType = Decimal128Type;
  using CType = Decimal128;
};

template <>
struct CTypeTraits<Decimal256Type> {
  using ArrowType = Decimal256Type;
  using CType = Decimal256;
};

I guess that there should not be CType in CTypeTraits and arrow type should not be the template parameter. We may need these code instead, or you may use some other CType template parameter but I guess it should not be Decimal128Type itself:

template <>
struct CTypeTraits<Decimal128Type::CType> {
  using ArrowType = Decimal128Type;
};

template <>
struct CTypeTraits<Decimal256Type::CType> {
  using ArrowType = Decimal256Type;
};

@HuaHuaY
Copy link
Contributor

HuaHuaY commented Jan 14, 2026

template <>
struct CTypeTraits<Decimal128Type::CType> {
  using ArrowType = Decimal128Type;
};

template <>
struct CTypeTraits<Decimal256Type::CType> {
  using ArrowType = Decimal256Type;
};

I found that my understanding of this code isn't complete either. Referring to other implementations, CTypeTraits should inherit from TypeTraits.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++] Some CTypeTraits are missing

4 participants