Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Long Decimal Type in Native Parquet Reader #2822

Conversation

majetideepak
Copy link
Collaborator

No description provided.

@netlify
Copy link

netlify bot commented Oct 12, 2022

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit a47b66b
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/634968ebab7f480009e9bd3a

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 12, 2022
Copy link
Contributor

@Yuhta Yuhta left a comment

Choose a reason for hiding this comment

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

The build is not successful yet

template <typename A>
struct LoadIndices<int128_t, A> {
static xsimd::batch<int32_t, A> apply(const int128_t* values, const A& arch) {
VELOX_UNSUPPORTED("LoadIndices for int128_t type is not supported");
Copy link
Contributor

Choose a reason for hiding this comment

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

How about just VELOX_UNREACHABLE()?

reinterpret_cast<char*>(&result) + (16 - numBytes),
reinterpret_cast<const char*>(valueOffset),
numBytes);
auto low = __builtin_bswap64(result >> 64);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use __builtin_bswap128 here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

On my mac, I see the following error. I guess this version is not supported everywhere.

error: use of undeclared identifier '__builtin_bswap128'
    return __builtin_bswap128(result);

Copy link
Contributor

@Yuhta Yuhta Oct 12, 2022

Choose a reason for hiding this comment

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

Can we do this?

#if __has_builtin(__builtin_bswap128)
  return __builtin_bswap128(result);
#else
  return buildInt128(__builtin_bswap64(result), __builtin_bswap64(result >> 64));
#endif

@@ -53,6 +53,11 @@ struct make_index<uint64_t> {
using type = uint64_t;
};

template <>
struct make_index<int128_t> {
using type = int128_t;
Copy link
Contributor

Choose a reason for hiding this comment

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

uint128_t? Also if this is not really used, can we make sure it is not used at compile time?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is used. I fixed it.

@@ -43,4 +44,9 @@ constexpr int64_t MAX_NANOS = 999'999'999;
// 1 is reduced to epoch, as writer adds 1 for negative seconds.
constexpr int64_t MIN_SECONDS = INT64_MIN + (EPOCH_OFFSET - 1);

#if not __has_builtin(__builtin_bswap128)
#define __builtin_bswap128(X) \
buildInt128(__builtin_bswap64(X), __builtin_bswap64(X >> 64))
Copy link
Contributor

@Yuhta Yuhta Oct 12, 2022

Choose a reason for hiding this comment

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

Put extra parenthesis to avoid operator precedence issue: buildInt128(__builtin_bswap64((X)), __builtin_bswap64((X) >> 64))
Or just define an inline function, it's better this way because it also avoids duplicate evaluation if X is an expensive expression or has side-effect

@majetideepak majetideepak force-pushed the add-long-decimal-support-native-parquet branch 5 times, most recently from 91f8af8 to 3905d3d Compare October 13, 2022 04:08
@majetideepak
Copy link
Collaborator Author

@Yuhta, all tests are passing. Can you take another look? Thanks.

@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@majetideepak majetideepak force-pushed the add-long-decimal-support-native-parquet branch from 3905d3d to 0371d08 Compare October 14, 2022 12:27
@Yuhta
Copy link
Contributor

Yuhta commented Oct 14, 2022

@majetideepak the linux-adapters tests are failing, can you take a look?

@majetideepak
Copy link
Collaborator Author

@Yuhta fixed. I missed a change during rebase. Thanks!

@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@majetideepak majetideepak deleted the add-long-decimal-support-native-parquet branch May 3, 2023 13:41
marin-ma pushed a commit to marin-ma/velox-oap that referenced this pull request Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants