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

Stamatis Zampetakis commented on HIVE-24600:
--------------------------------------------

Most likely the solution would be to add something like the following in 
[SemanticAnalyzer#genJoinOperatorTypeCheck|https://github.com/apache/hive/blob/fe23eaf61c8f1d0a326325028a0ff13c9c1c8c13/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java#L9611].

{code:java}
TypeCheckCtx ctx = new TypeCheckCtx(null);
TypeCheckProcFactory<ExprNodeDesc>.DefaultExprProcessor processor = 
ExprNodeTypeCheck.getExprNodeDefaultExprProcessor();
processor.validateUDF(null, false, ctx, FunctionRegistry.getFunctionInfo("="), 
Lists.newArrayList(keys[0][k], keys[i][k]));
commonType = FunctionRegistry.getCommonClassForComparison(a, b);
{code}


> Strict type checks are not enforced on join conditions when CBO disabled
> ------------------------------------------------------------------------
>
>                 Key: HIVE-24600
>                 URL: https://issues.apache.org/jira/browse/HIVE-24600
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>
> When {{hive.strict.checks.type.safety}} property is set to true, queries with 
> unsafe comparisons should fail with an appropriate exception no matter if CBO 
> is enabled or not ({{hive.cbo.enable}}).
> At the moment the safety checks are not applied in join conditions present in 
> the ON clause when CBO is disabled.
> For example, both queries below should fail.
> {code:sql}
> set hive.strict.checks.type.safety=true;
> set hive.cbo.enable=false;
> SELECT * FROM biginttbl INNER JOIN strtbl ON bigintcol=strcol;
> SELECT * FROM biginttbl INNER JOIN strtbl WHERE bigintcol=strcol;
> {code}
> At the moment, the second query (with WHERE clause) will fail but not the 
> first one (with ON clause).



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

Reply via email to