[ 
https://issues.apache.org/jira/browse/IMPALA-9763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17368940#comment-17368940
 ] 

ASF subversion and git services commented on IMPALA-9763:
---------------------------------------------------------

Commit 9b7507390dd7259be5b2319a022899989036df41 in impala's branch 
refs/heads/master from liuyao
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=9b75073 ]

IMPALA-9763: builtin functions throw unknown exception

There is a read-write contention in FunctionName#analyze()
when a FunctionName object is shared to two threads: check if there
is a builtin function in wrong database, when 'db_' is temporarily
modified by the other thread.

This patch fix this issue. For analyze FunctionName, if no database is
specified, check builtinDb first; if FunctionName is not in builtinDb,
set the database to defaultDb.Avoid setting the database of
FunctionName to a temporary value

Detailed description:

This problem is caused by shallow copies. In the function
FromClause::analyze(Analyzer analyzer), if the table is FeView,
the analyzer will clone SelectStmt from the view's MetaData,
which should be a deep copy. But in the copy constructor of
FunctionCallExpr, fnName_ = other.fnName_, this is a shallow copy,
which makes the fnName_ of multiple queries refer to the same block of
memory. When the query is analyzed, the database of fnName_ will be
set.But this will change the fnName_ of other queries.

For example:

create view1 as select coalesce(col1, 2) from table1;

User A and User B check the same view1 at the same time. When
user A’s query is analyzed, it runs to db_ = analyzer.getDefaultDb() of
FunctionName::analyze. User B’s query is also analyzed and runs to
FunctionCallExpr::analyzeImpl, and just completed FunctionName::analyze
at this time, the step of user A's db_ = analyzer.getDefaultDb() will
change the db_ attribute of user B's fnName_ to defaultDb, and then
user B will continue to check whether the function is defaultDb,
Throw an exception: coalesce() unknown for database .......

Change-Id: Ifd77f5a7cd9a674340770233fe26eb5dc26e666a
Reviewed-on: http://gerrit.cloudera.org:8080/17604
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> impala查询偶尔报错 -- Impala queries occasionally report errors
> ---------------------------------------------------------
>
>                 Key: IMPALA-9763
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9763
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Catalog
>    Affects Versions: Impala 3.2.0
>            Reporter: liqinglong
>            Assignee: liuyao
>            Priority: Major
>              Labels: bug
>             Fix For: Impala 3.2.0
>
>         Attachments: 1.png, 2.png, 3.png, long_text_2020-05-19-17-00-29.txt
>
>
> 用 superset  链接impala 
> 视图查询,打开看板偶尔会报如图3的的错,都是在解析SQL时找不到内置函数的错,但是强制刷新看板重新查询又不再报错,连续多次查询都会报,但是过一会再强制刷新查询又会报错,前后查询SQL语句一致,见图1和图2,日志见附件文档,能不能帮忙提一下意见是哪方面bug
>  
> Adding the Google-translated English version (laszlog):
> Use the superset to link the impala view query. When you open the kanban 
> board, you will occasionally report the error as shown in Figure 3. It is the 
> error that you cannot find the built-in function when parsing the SQL. 
> However, after a while, you will be forced to refresh the query again and you 
> will get an error. The query SQL statement is consistent before and after, 
> see Figure 1 and Figure 2, the log is in the attached document, can you help 
> to mention what is the bug?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to