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

Update template partition fields to format validation to a compile time macro #1598

Open
piyushnarang opened this issue Sep 16, 2016 · 3 comments

Comments

@piyushnarang
Copy link
Collaborator

One of the suggestions that came up in PR: #1590 was to update the validation check in TemplatePartition to a compile time macro:

  assert(
    partitionFields.size == "%s".r.findAllIn(template).length,
    "Number of partition fields %s does not correspond to template (%s)".format(partitionFields, template))

One of the potential options might look something like: https://gist.github.com/xuwei-k/4991805
I think we'll also need to extend this to handle template strings that are passed as variables.

@johnynek
Copy link
Collaborator

Actually, I am not sure how to do this now... We can look at a literal string in the code, but getting the size of the partitionFields at compile time would be a pretty big pain.

This is not quite as easy as I thought.

@piyushnarang
Copy link
Collaborator Author

@johnynek yeah, even the string part will be easy if its a literal. Might not too do able if is a variable right.

@johnynek
Copy link
Collaborator

definitely won't work with a variable.

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

No branches or pull requests

2 participants