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

feature/choose-hyper-version #296

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

Conversation

davidsonhr1
Copy link

A hyper file version support on hyperprocess

@jorwoods
Copy link
Collaborator

jorwoods commented May 24, 2024

@davidsonhr1 Have you checked what happens if a version 2 writer attempts to write to an existing version 0 or version 1 hyper file?

@davidsonhr1
Copy link
Author

@davidsonhr1 Have you checked if a version 2 writer attempts to write to an existing version 0 or version 1 hyper file?

So far I have only tested with files that I use in my company and they are version 2, I have only tested the scenario of a 100% new file, but I can test other scenarios

Copy link
Collaborator

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Thanks for the PR - this is a nice change

src/pantab/_writer.py Outdated Show resolved Hide resolved
@WillAyd
Copy link
Collaborator

WillAyd commented May 24, 2024

How old is the version 2? I very loosely only have pantab supporting technologies that are 1.5 to 2 years max. If version 2 has been out that long, I would also be fine to make that the default value.

Of course still want to know a little bit more about what @jorwoods is asking - I would hate to change that value and break things for users that are appending to Hyper databases created with prior verions of pantab

@jorwoods
Copy link
Collaborator

If it's fully backwards compatible, then defaulting to version 2 might be preferable.

@@ -540,7 +541,8 @@ void write_to_hyper(
}

const std::unordered_map<std::string, std::string> params = {
{"log_config", ""}};
{"log_config", ""}, {"default_database_version", std::to_string(version)}};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there any other configuration items worth passing through? The other design consideration is if we want to explicitly enumerate these in our API (which puts some onus on us to manage backwards compatability) or if we would rather just accept a dictionary argument for hyper_params

Copy link
Author

Choose a reason for hiding this comment

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

I like the way of letting the user pass a dictionary of parameters, as each person may want to use it differently, there are other parameters in the hyperprocess, such as "use_tcp_port"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good. Let's try that here then. I don't know that the Hyper C++ API can handle complete forwarding of the dict, but we can at least unpack the ones we know about in the extension layer via nb::try_cast and warn for any others we cannot process

@@ -519,7 +519,8 @@ void write_to_hyper(
const std::map<SchemaAndTableName, nb::capsule> &dict_of_capsules,
const std::string &path, const std::string &table_mode,
nb::iterable not_null_columns, nb::iterable json_columns,
nb::iterable geo_columns) {
nb::iterable geo_columns,
const int8_t version) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since the HyperProcess constructor expects all parameters to be strings, I think you can just declare a parameter here of const std::map<std::string, std::string> process_params and pass that to the HyperProcess constructor.

To make it easier you can map all of the parameter values to strings in Python before sending through to the extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants