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

Fix escaping of some edge identifiers like '$' #5122

Merged
merged 1 commit into from Jan 14, 2019

Conversation

tpoterba
Copy link
Contributor

Fixes #5119

@@ -215,7 +215,7 @@ package object utils extends Logging
.filter(s => !s.isEmpty)

def prettyIdentifier(str: String): String = {
if (str.matches("""\p{javaJavaIdentifierStart}\p{javaJavaIdentifierPart}*"""))
if (str.matches("""[_a-zA-Z]\w*"""))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is much more conservative. There is no reason to use the java identifier stuff if we don't have a good idea what's in it -- apparently "currency" characters are valid identifier starts!

@@ -178,7 +178,10 @@ def unescape_parsable(s):


def escape_id(s):
return Env.jutils().escapeIdentifier(s)
if re.fullmatch(r'[_a-zA-Z]\w*', s):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

avoid some JVM trips

Copy link
Collaborator

@danking danking left a comment

Choose a reason for hiding this comment

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

Did you also check that the rest of our stack correctly reads a column header with a dollar sign? I'm a little weary that another bug might show up when Nik tries.

@tpoterba
Copy link
Contributor Author

The rest of the stack does handle weird named fields, the problem was that this wasn't getting escaped correctly (well, that our python type parser had different assumptions about escaping than the string escaper).

@danking danking merged commit 562fc97 into hail-is:master Jan 14, 2019
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

2 participants