j1wonpark opened a new issue, #7568:
URL: https://github.com/apache/kyuubi/issues/7568

   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   
   ### Search before asking
   
   - [X] I have searched in the 
[issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no 
similar issues.
   
   ### Describe the bug
   
   With `RangerSparkExtension` enabled, `typeof()` fails whenever it is not in 
the root plan node:
   
   ```sql
   CREATE TABLE t1 (id int, day string);
   
   SELECT typeof(id) FROM t1;                                       -- works 
(root is Project)
   SELECT typeof(id) AS t FROM t1 ORDER BY t;                       -- fails
   SELECT typeof(id) FROM t1 UNION ALL SELECT typeof(day) FROM t1;  -- fails
   SELECT typeof(id), count(*) FROM t1 GROUP BY typeof(id);         -- fails
   ```
   
   ```
   [CLASS_NOT_OVERRIDE_EXPECTED_METHOD] 
org.apache.kyuubi.plugin.spark.authz.rule.expression.TypeOfPlaceHolder
   must override either eval or nullSafeEval. SQLSTATE: 38000
   ```
   
   `RuleApplyTypeOfMarker` marks every `TypeOf` in the whole plan 
(`transformAllExpressions`), but
   since #5997 `RuleEliminateTypeOf` reverts them with 
`transformExpressionsUp`, which only visits the
   root node's expressions — the outer `transformUp` removed there as an 
unnecessary loop was what
   walked the plan. Any placeholder below the root survives into execution and 
fails, because
   `TypeOfPlaceHolder` implements `doGenCode` but no `eval`.
   
   Existing tests only cover queries whose root node is a `Project`, which is 
why this went unnoticed.
   
   ### Affects Version(s)
   
   1.9.0 and later, master
   
   ### Are you willing to submit PR?
   
   - [X] Yes. I would be willing to submit a PR with guidance from the Kyuubi 
community to fix.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to