You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tamas Mate (Jira)" <ji...@apache.org> on 2020/10/02 15:46:00 UTC
[jira] [Commented] (IMPALA-9641) Query hang when containing alias
names as empty backticks
[ https://issues.apache.org/jira/browse/IMPALA-9641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17206284#comment-17206284 ]
Tamas Mate commented on IMPALA-9641:
------------------------------------
Agree, it looks like there is possible a flaw in the HiveLexer grammar, most probably [here|https://github.com/apache/hive/blob/master/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveLexerStandard.g#L38].
{code:none}
QuotedIdentifier
:
('"' ( '""' | ~('"') )* '"') { setText(StringUtils.replace(getText().substring(1, getText().length() -1 ), "\"\"", "\"")); }
| ('`' ( '``' | ~('`') )* '`') { setText(StringUtils.replace(getText().substring(1, getText().length() -1 ), "``", "`")); }
;
{code}
The lexer can not return a token, therefore it gets stuck in an infinite loop, reporting the error and trying to create the token.
> Query hang when containing alias names as empty backticks
> ---------------------------------------------------------
>
> Key: IMPALA-9641
> URL: https://issues.apache.org/jira/browse/IMPALA-9641
> Project: IMPALA
> Issue Type: Bug
> Components: Frontend
> Affects Versions: Impala 3.4.0
> Reporter: Quanlong Huang
> Assignee: Tamas Mate
> Priority: Blocker
> Labels: hang
>
> The following query will hang in an infinite loop:
> {code:java}
> select 1 as "``";
> {code}
> Stacktrace of its compiler thread:
> {code:java}
> "Thread-19" #34 prio=5 os_prio=0 tid=0x0000000012fc0000 nid=0x5514 runnable [0x00007f2abda41000]
> java.lang.Thread.State: RUNNABLE
> at java.io.FileOutputStream.writeBytes(Native Method)
> at java.io.FileOutputStream.write(FileOutputStream.java:326)
> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
> - locked <0x00000005cc90f7b8> (a java.io.BufferedOutputStream)
> at java.io.PrintStream.write(PrintStream.java:482)
> - locked <0x00000005cc90f798> (a java.io.PrintStream)
> at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
> at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
> at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
> - locked <0x00000005cc90f8d8> (a java.io.OutputStreamWriter)
> at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
> at java.io.PrintStream.write(PrintStream.java:527)
> - locked <0x00000005cc90f798> (a java.io.PrintStream)
> at java.io.PrintStream.print(PrintStream.java:669)
> at java.io.PrintStream.println(PrintStream.java:806)
> - locked <0x00000005cc90f798> (a java.io.PrintStream)
> at org.antlr.runtime.BaseRecognizer.emitErrorMessage(BaseRecognizer.java:344)
> at org.antlr.runtime.BaseRecognizer.displayRecognitionError(BaseRecognizer.java:194)
> at org.antlr.runtime.Lexer.reportError(Lexer.java:261)
> at org.antlr.runtime.Lexer.nextToken(Lexer.java:103)
> at org.apache.impala.analysis.ToSqlUtils.hiveNeedsQuotes(ToSqlUtils.java:145)
> at org.apache.impala.analysis.ToSqlUtils.getIdentSql(ToSqlUtils.java:199)
> at org.apache.impala.analysis.SlotRef.<init>(SlotRef.java:58)
> at org.apache.impala.analysis.SelectStmt$SelectAnalyzer.analyzeSelectClause(SelectStmt.java:283)
> at org.apache.impala.analysis.SelectStmt$SelectAnalyzer.analyze(SelectStmt.java:215)
> at org.apache.impala.analysis.SelectStmt$SelectAnalyzer.access$100(SelectStmt.java:199)
> at org.apache.impala.analysis.SelectStmt.analyze(SelectStmt.java:192)
> at org.apache.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:473)
> at org.apache.impala.analysis.AnalysisContext.analyzeAndAuthorize(AnalysisContext.java:437)
> at org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:1530)
> at org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:1497)
> at org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1467)
> at org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:154)
> {code}
> org.antlr.runtime.Lexer keeps emitting the same error message to stderr (which is redirected to impalad.ERROR):
> {code:java}
> line 1:0 rule Identifier failed predicate: {allowQuotedId()}?
> line 1:0 rule Identifier failed predicate: {allowQuotedId()}?
> line 1:0 rule Identifier failed predicate: {allowQuotedId()}?
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org