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 IPPREFIX type #11122

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

mohsaka
Copy link
Contributor

@mohsaka mohsaka commented Sep 27, 2024

This PR only adds the IPPrefix type classes. CAST logic is not implemented. The next PR for IPPrefix type will enhance the fuzzers for IPPrefix type. After that we will add the CAST logic so that it can be tested with fuzzers from the start itself.

The full logic for IPPrefix is available in PRs :
Original PR: #10538
Original Split PR: #10816

@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 Sep 27, 2024
Copy link

netlify bot commented Sep 27, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 96c3bc4
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/670f1be132460a0008c875e6

@mohsaka
Copy link
Contributor Author

mohsaka commented Sep 30, 2024

@aditi-pandit @czentgr Can I get a review on this? Thank you!

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @mohsaka. Looks good overall minus these comments.

velox/functions/prestosql/types/IPPrefixType.cpp Outdated Show resolved Hide resolved
velox/docs/develop/types.rst Show resolved Hide resolved
@aditi-pandit aditi-pandit changed the title Add IPPREFIX type only Add IPPREFIX type Oct 1, 2024
@Yuhta Yuhta requested a review from mbasmanova October 1, 2024 19:44

namespace facebook::velox {

class IPPrefixType : public VarbinaryType {
Copy link
Contributor

@Yuhta Yuhta Oct 1, 2024

Choose a reason for hiding this comment

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

It's a little bit waste of memory to use VARBINARY as physical type here: StringView needs 16 bytes and the string buffer needs 17 bytes per row, totally 33 bytes per row.

@mbasmanova Is this because the usage of this type is rare and we want to trade off some performance for simpler implementation? How about use ROW(HUGEINT, TINYINT)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some more information, I did try to attempt to create the type via an opaque type. However it seems that there is no support for encoding, column reader, and I presume further down. The java type is a fixed width type of 17 bytes.

Copy link
Contributor

@Yuhta Yuhta Oct 2, 2024

Choose a reason for hiding this comment

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

Did you try ROW(HUGEINT, TINYINT)? This seems the most efficient way of storing it. Also the conversion between IPPREFIX and IPADDRESS will be a no cost operation.

There is no way to read these types right out of reader anyway, you need to project a cast.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Yuhta Thank you for the suggestion. Made change to Row type with overridden arguments method. Please confirm if that is what you were thinking?

Thanks again!

Copy link
Collaborator

@czentgr czentgr left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@mohsaka : Some minor comments. But ready for review from Meta engineers.

velox/functions/prestosql/types/IPPrefixType.cpp Outdated Show resolved Hide resolved
@@ -16,11 +16,13 @@
#pragma once

#include "velox/functions/prestosql/types/IPAddressType.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add some tests in FunctionRegistryTest or CustomTypeTest to ensure that we can register functions with type IPPREFIX and retrieve them ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added simple function registration and resolution test into FunctionRegistryTest

@mohsaka
Copy link
Contributor Author

mohsaka commented Oct 16, 2024

@Yuhta Could I get a review please. Thanks you!

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.

5 participants