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

SHOW CREATE TABLE for row type match reserved SQL keywords fails #2130

Closed
ebyhr opened this issue Nov 28, 2019 · 0 comments · Fixed by #2226
Closed

SHOW CREATE TABLE for row type match reserved SQL keywords fails #2130

ebyhr opened this issue Nov 28, 2019 · 0 comments · Fixed by #2226
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ebyhr
Copy link
Member

ebyhr commented Nov 28, 2019

Steps to reproduce:

presto> create table memory.default.test (c1 row("from" integer));
CREATE TABLE
presto> show columns in memory.default.test;
 Column |       Type        | Extra | Comment 
--------+-------------------+-------+---------
 c1     | row(from integer) |       |         
(1 row)

presto> select * from memory.default.test;
 c1 
----
(0 rows)

presto> show create table memory.default.test;
Query 20191128_083045_00003_iysy5 failed: line 1:5: mismatched input 'from'. Expecting: <identifier>, <type>
io.prestosql.sql.parser.ParsingException: line 1:5: mismatched input 'from'. Expecting: <identifier>, <type>
        at io.prestosql.sql.parser.ErrorHandler.syntaxError(ErrorHandler.java:107)
        at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
        at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
        at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310)
        at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:136)
        at io.prestosql.sql.parser.SqlBaseParser.type(SqlBaseParser.java:10217)
        at io.prestosql.sql.parser.SqlBaseParser.standaloneType(SqlBaseParser.java:385)
        at io.prestosql.sql.parser.SqlParser.invokeParser(SqlParser.java:164)
        at io.prestosql.sql.parser.SqlParser.createType(SqlParser.java:114)
        at io.prestosql.sql.analyzer.TypeSignatureTranslator.toSqlType(TypeSignatureTranslator.java:62)
        at io.prestosql.sql.rewrite.ShowQueriesRewrite$Visitor.lambda$visitShowCreate$8(ShowQueriesRewrite.java:469)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
        at io.prestosql.sql.rewrite.ShowQueriesRewrite$Visitor.visitShowCreate(ShowQueriesRewrite.java:471)
        at io.prestosql.sql.rewrite.ShowQueriesRewrite$Visitor.visitShowCreate(ShowQueriesRewrite.java:156)
        at io.prestosql.sql.tree.ShowCreate.accept(ShowCreate.java:67)
        at io.prestosql.sql.tree.AstVisitor.process(AstVisitor.java:27)
        at io.prestosql.sql.rewrite.ShowQueriesRewrite.rewrite(ShowQueriesRewrite.java:153)
        at io.prestosql.sql.rewrite.StatementRewrite.rewrite(StatementRewrite.java:57)
        at io.prestosql.sql.analyzer.Analyzer.analyze(Analyzer.java:80)
        at io.prestosql.sql.analyzer.Analyzer.analyze(Analyzer.java:75)
        at io.prestosql.execution.SqlQueryExecution.analyze(SqlQueryExecution.java:219)
        at io.prestosql.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:178)
        at io.prestosql.execution.SqlQueryExecution.<init>(SqlQueryExecution.java:95)
        at io.prestosql.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:715)
        at io.prestosql.dispatcher.LocalDispatchQueryFactory.lambda$createDispatchQuery$0(LocalDispatchQueryFactory.java:119)
        at io.prestosql.$gen.Presto_null__testversion____20191128_082928_2.call(Unknown Source)
        at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
        at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
        at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.antlr.v4.runtime.NoViableAltException
        at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2028)
        at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467)
        at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393)
        at io.prestosql.sql.parser.SqlBaseParser.type(SqlBaseParser.java:9903)
        ... 33 more
show create table memory.default.test

Ref: #1962

@ebyhr ebyhr added the bug Something isn't working label Nov 28, 2019
@findepi findepi added this to the 329 milestone Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants