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

StructType.toString throws UnsupportedOperationException #24

Open
ibzib opened this issue Jan 28, 2020 · 3 comments · May be fixed by #31
Open

StructType.toString throws UnsupportedOperationException #24

ibzib opened this issue Jan 28, 2020 · 3 comments · May be fixed by #31

Comments

@ibzib
Copy link

ibzib commented Jan 28, 2020

Doing String.format or any other function that calls toString fails on a struct type.

java.lang.UnsupportedOperationException
	at com.google.zetasql.ZetaSQLStrings.toIdentifierLiteral(ZetaSQLStrings.java:39)
	at com.google.zetasql.StructType.debugString(StructType.java:177)
	at com.google.zetasql.Type.toString(Type.java:334)
	at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2886)
	at java.util.Formatter$FormatSpecifier.print(Formatter.java:2763)
	at java.util.Formatter.format(Formatter.java:2520)
	at java.util.Formatter.format(Formatter.java:2455)
	at java.lang.String.format(String.java:2942)
@kanterov
Copy link

Our solution to the problem was overriding this class on the classpath with the version that has an implementation.

@ibzib
Copy link
Author

ibzib commented Jan 30, 2020

Which version has an implementation?

@kanterov
Copy link

There nothing publicly available that I'm aware of, but such version could look like:

public class ZetaSQLStrings {
...
  public static String toIdentifierLiteral(String str) {
    return str; // TODO escape if needed
  }
...
}

@janhicken janhicken linked a pull request Mar 5, 2020 that will close this issue
aceforeverd pushed a commit to aceforeverd/zetasql that referenced this issue Oct 14, 2021
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 a pull request may close this issue.

2 participants