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

Support FetchOrientation.FetchFirst #27

Closed
yaooqinn opened this issue Mar 20, 2018 · 0 comments
Closed

Support FetchOrientation.FetchFirst #27

yaooqinn opened this issue Mar 20, 2018 · 0 comments
Assignees
Projects
Milestone

Comments

@yaooqinn
Copy link
Member

Expected behavior

Actual behavior.

Steps to reproduce the problem.

Specifications like the version of the project, operating system, or hardware.

@yaooqinn yaooqinn added this to To do in kyuubi via automation Mar 20, 2018
@yaooqinn yaooqinn self-assigned this Mar 26, 2018
@yaooqinn yaooqinn added this to the v0.1.0 milestone Mar 27, 2018
@yaooqinn yaooqinn closed this as completed Apr 8, 2018
kyuubi automation moved this from To do to Done Apr 8, 2018
yaooqinn pushed a commit that referenced this issue Nov 15, 2023
### _Why are the changes needed?_
To close #5677
Typeof expression miss column information, in this pr we add a place holder to support this.

For sql
```
SELECT typeof(id), typeof(age) FROM default.t1 LIMIT 1
```

Without this pr, typeof after optimizer passed to PrivilegeBuild is just an attribute, miss the origin child expression info.
```
GlobalLimit 21
+- LocalLimit 21
   +- Project [int AS typeof(id)#27, int AS typeof(age)#28]
      +- Relation default.t1[id#18,age#19,part#20] parquet
```

When handle this plan's project list, it's an attribute and miss expression when expression result is a constant value, then we can't extract the `TypeOf`'s child expression.
![image](https://github.com/apache/kyuubi/assets/46485123/d27e324d-4db9-4fb5-bba4-fa795601d7f7)

This is caused by `TypeOf`  expression is foldable
<img width="778" alt="image" src="https://github.com/apache/kyuubi/assets/46485123/770a36fc-235f-4f26-bca7-a5058e120919">

It will be convert to a constant value after spark optimizer, then cause we miss the child expression, then can't extract columns by `collectLeaves`

In this pr we wrap the `TypeOf` by a non-foldable expression placeholder then we can get the expression contains column of table when `mergeProjection`
After this pr, the plan is like below
```
GlobalLimit 21
+- LocalLimit 21
   +- Project [typeofplaceholder(id#21) AS typeof(id)#30, typeofplaceholder(day#23) AS typeof(day)#31]
      +- HiveTableRelation [`default`.`table1`, org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [id#21, scope#22, day#23], Partition Cols: []]

```

### _How was this patch tested?_
- [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request

### _Was this patch authored or co-authored using generative AI tooling?_
No

Closes #5678 from AngersZhuuuu/KYUUBO-5677.

Closes #5677

273cd61 [Angerszhuuuu] Update TypeOfPlaceHolder.scala
8b4383d [Angerszhuuuu] done
af5dae5 [Angerszhuuuu] Update RangerSparkExtensionSuite.scala
37edcdf [Angerszhuuuu] fix for spark-3.1
df15599 [Angerszhuuuu] update
a7dd3c4 [Angerszhuuuu] Update RangerSparkExtension.scala
6b76dac [Angerszhuuuu] [KYUUBI #5677][AUTHZ] Typeof expression miss column information
f8a94c7 [Angerszhuuuu] [KYUUBI #5677][AUTHZ] Typeof expression miss column information

Authored-by: Angerszhuuuu <angers.zhu@gmail.com>
Signed-off-by: Kent Yao <yao@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
kyuubi
  
Done
Development

No branches or pull requests

1 participant