鳞癌是什么意思| 四季春茶是什么茶| 十月初三是什么星座| 肺结节吃什么药最好| 鼻子下面长痘什么原因| 嗜酸性粒细胞偏低是什么原因| 遭罪什么意思| 扁桃体发炎喉咙痛吃什么药| 2023什么年| 吃牛油果有什么好处和坏处| 秋天能干什么| 检查梅毒挂什么科| 静谧是什么意思| 偏光镜片是什么意思| 血糖高什么水果不能吃| dady是什么意思| 食管裂孔疝是什么原因造成的| 三十年婚姻是什么婚| 喉咙发苦是什么原因造成的| 南京菜属于什么菜系| 割包皮属于什么科| sweet什么意思| 肋软骨炎挂什么科| 董明珠什么星座| 氯吡格雷是什么药| 无忧什么意思| 外耳道炎用什么药| 118代表什么意思| 菊花和枸杞泡水喝有什么功效| 虾腹部的黑线是什么| mb什么意思| 为什么会有白头发| 丝瓜为什么会变黑| 减胎对另一个胎儿有什么影响| 表面是什么意思| 大公鸡是什么牌子| 为什么会有流星雨| 蓝色牛仔裤配什么颜色短袖| 7.9什么星座| 文科女生学什么专业就业前景好| 为什么会突然流鼻血| 小腿抽筋什么原因| hpv45型阳性是什么意思| 拔河是什么意思| 姜子牙姓什么| 玻尿酸是干什么用的| 什么是清淡饮食| 吃什么东西会长胖| dw是什么牌子| 颈椎头晕吃什么药| 西地那非是什么药物| 肠炎用什么药好| 住院医师是什么职称| 邋遢是什么意思| 左边肋骨下面是什么器官| hisense什么牌子| 减胎对另一个胎儿有什么影响| 纤维条索灶是什么意思| 岁运并临是什么意思| 吃什么养颜美容抗衰老| 疖肿是什么意思| 塘鲺是什么鱼| 螃蟹为什么吐泡泡| 老婆的妹妹叫什么| 心口窝疼是什么原因| 一进大门看见什么最好| 逍遥丸什么人不能吃| 昕字五行属什么| 什么是碱性食物有哪些| cpr是什么| 1.25什么星座| 左手发麻什么原因| 躯体化障碍是什么病| 什么叫做绝对值| 芦芽是什么| 眼睫毛脱落是什么原因| 93年属什么今年多大| 表妹是什么关系| 什么是低筋面粉| 青春不散场什么意思| 郁金香的花语是什么| 心率快吃什么药效果好| 被子植物是什么| 今天突然拉稀拉出血什么原因| 皮肤为什么会痒| 语言障碍挂什么科| 右肋骨下方是什么器官| 无性婚姻会有什么好处| 晨勃是什么意思啊| 咖喱是什么材料做的| 善字五行属什么| 人红是非多什么意思| 沛是什么意思| 滇红是什么茶| 鹅厂是什么意思| 心律不齐吃什么药好| 耐信是什么药| 衣带渐宽终不悔是什么意思| 死海为什么叫死海| 银色山泉香水什么牌子| 县人民医院是什么级别| 久卧伤什么| 感同身受什么意思| 肌钙蛋白低说明什么| 北戴河是什么海| 晨咳是什么原因引起的| 圣诞节送什么好| 糖耐量受损是什么意思| 土豆炒什么好吃| 头疼看什么科| 铁树开花是什么生肖| 刻薄是什么意思| 老好人是什么意思| 养肝吃什么药| 鸽子拉水便是什么原因| 胃胀消化不好吃什么药| rinnai是什么品牌| 迅速的反义词是什么| 慢性气管炎吃什么药最有效| 口气臭吃什么能改善| 男生剪什么发型好看| 心功能不全是什么意思| 皮肤溃烂用什么药治愈最快| 电解水是什么水| 华人是什么意思| 夏天容易出汗是什么原因| 保肝降酶药首选什么药| 婴儿不睡觉是什么原因| 基因突变是什么病| 给猫咪取什么名字好听| 梦见数字是什么意思| 小腿肌肉痛什么原因| 什么眼霜比较好用| 犬子是什么意思| 英语一和英语二有什么区别| 人老是犯困想睡觉是什么原因| 陈凯歌为什么不娶倪萍| 打招呼是什么意思| 乖乖是什么意思| 为什么会肾结石| 糯叽叽什么意思| 吃什么东西会长胖| 07年属什么生肖| 今日属相是什么生肖| 梦见自己的头发长长了是什么意思| 芋头是什么| 腰闪了是什么症状| hospital是什么意思| 是否是什么意思| 黄墙绿地的作用是什么| 吃二甲双胍为什么会瘦| 女性肛门坠胀看什么科| 油漆味对人有什么危害| 馐什么意思| 什么地溜达| 指甲发青是什么原因| 副处级干部是什么级别| 急性上呼吸道感染是什么引起的| 修造是什么意思| 单核细胞高是什么原因| 滨海新区有什么好玩的地方| 白羊座男生喜欢什么样的女生| 宫颈纳囊什么意思| 快穿是什么意思| 什么是什么的眼睛| 怀孕会有什么反应| 什么补血效果最好最快| 停止长高有什么征兆| 土界读什么| 喝什么茶能降血压| 精神科主要看什么病| 医是什么结构的字| 刚怀孕肚子有什么变化| 郭富城属什么生肖| 病毒感染咳嗽吃什么药| 食言是什么意思| 冬瓜炒什么好吃| nt 是什么检查| 粉色裤子配什么上衣| 背沟深代表什么| 三点水一个金读什么| 电磁炉用什么锅最好| mru是什么检查| 经期不能吃什么水果| 4月13号是什么星座| 送男生什么生日礼物| 梦见血是什么预兆解梦| 骨关节炎是什么原因引起的| 鸡打瞌睡吃什么药| 五马长枪是什么意思| 语字五行属什么| 打无痛对身体有什么影响吗| 钓鲈鱼用什么饵最好| 碳足迹是什么| 日午念什么| 傧相是什么意思| 尿液白细胞高是什么原因| 米醋和白醋有什么区别| 土方是什么| 10月28日什么星座| 舌头上长泡是什么原因| 水火不容是什么意思| 纪年是什么意思| 干眼症用什么药| 吃什么可以提高记忆力| 智能眼镜有什么功能| 眼压高是什么原因| 绿茶什么时候喝最好| 女生什么时候绝经| 人活着到底有什么意义| 左眼跳代表什么| 心急吃不了热豆腐什么意思| 抹茶是什么意思| 红艳桃花是什么意思| 6月18日是什么节日| 85年属什么的| 动脉硬化是什么意思| 学中医需要什么学历| u熊是什么意思| rmssd是什么意思| 白带发黄吃什么药| 今日什么冲什么生肖| 堂号是什么意思| 大驿土是什么意思| 萎谢是什么意思| 餐边柜放什么东西| 什么叫袖珍人| 氨咖黄敏胶囊治什么| 疯子是什么意思| grace什么意思中文| 违反禁令标志指示什么意思| 二氧化硅是什么| 女生下面叫什么| 血吸虫是什么动物| 检查盆腔炎做什么检查| 什么时候做nt| 20年属什么生肖| 电磁炉滴滴响不加热是什么原因| 王加呈念什么| 大便排不出来是什么原因| 孕妇有血窦要注意什么| 什么是耳鸣| 热痱子用什么药| 孩子发烧吃什么药| 竹笋炒什么好吃| 脚后跟疼是什么情况| 女朋友生日送什么礼物好| 表面活性剂是什么| 什么叫排比句| 孕妇晚餐吃什么比较好| 紫癜有什么危害| 嘴唇肿是什么原因| 戍是什么意思| 口疮反复发作什么原因| 96年出生的属什么| 梦见磕头下跪什么意思| 地黄长什么样| 什么叫中出| 什么情况下必须做胃镜| 什么是童话故事| 霉菌孢子是什么意思| 小儿风寒感冒吃什么药| 禾加一笔是什么字| 谷丙转氨酶是什么意思| 百度
Skip to content

[CALCITE-7122] Eliminate nested calls for idempotent unary functions upper/lower/abs #4488

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

xuzifu666
Copy link
Member

/**
* Runs simplification unary function by eliminating idempotent.
*/
private RexCall simplifUnaryFunction(RexCall rexCall) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can simplify lower(upper(lower(x))) to upper(lower(x)) or lower(upper(x))?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit like a special case, because the two functions have opposite effects. Maybe can hand this case, and it will not affect the default behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, my example was too specific. What I meant is that there are two idempotent functions, f and g, which may have multiple repetitions and can be combined arbitrarily, but will ultimately simplify to either f(g(x)) or g(f(x)). Of course, special cases like the one I mentioned above are exceptions.

Copy link
Member Author

@xuzifu666 xuzifu666 Aug 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes,currently this goal can be achieved based on this PR. For example, lower(lower(upper(uper('a')))) will be simplified to lower(upper('a')).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @julianhyde provided in the case of Jira, these two functions do not have opposite effects, so this case is not need to be simplified.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think simplifyIdempotentUnaryFunction is more appropriate.

@@ -333,7 +337,9 @@ RexNode simplify(RexNode e, RexUnknownAs unknownAs) {
return simplifyM2v((RexCall) e);
default:
if (e.getClass() == RexCall.class) {
return simplifyGenericNode((RexCall) e);
RexCall rexCall = (RexCall) e;
rexCall = simplifUnaryFunction(rexCall);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you should keep the same format as before, using case upper/lower/abs.

Copy link
Member Author

@xuzifu666 xuzifu666 Aug 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to do this at first, but it is handled according to SqlKind. The SqlKind of upper/lower/abs is OTHER_FUNCTION. If I need to add a new SqlKind and modify the SqlKind of these functions because of this, it doesn’t feel necessary.
For example, if a new XXX function is added in future, the corresponding SqlKind must also be added. The coupling feels a bit strong, but it is very convenient to put it directly in the List.

@julianhyde
Copy link
Contributor

Can we take this discussion to Jira? We need to have a conversation about specification. Those conversations belong in Jira.

Also please STOP logging a jira case just the moment before you push a PR. We know that you have been working on the PR for a few days. Give the rest of us chance to weigh in on the specification before you write the implementation.

Please fix the reference to the jira case. Is it 7122 or 7112?

@xuzifu666 xuzifu666 changed the title [CALCITE-7112] Eliminate nested calls for idempotent unary functions upper/lower/abs [CALCITE-7122] Eliminate nested calls for idempotent unary functions upper/lower/abs Aug 4, 2025
@xuzifu666
Copy link
Member Author

Can we take this discussion to Jira? We need to have a conversation about specification. Those conversations belong in Jira.

Also please STOP logging a jira case just the moment before you push a PR. We know that you have been working on the PR for a few days. Give the rest of us chance to weigh in on the specification before you write the implementation.

Please fix the reference to the jira case. Is it 7122 or 7112?

OK, thanks for the reminder. I will list the JIRA in advance so that everyone can evaluate it together. @julianhyde

/**
* Runs simplification unary function by eliminating idempotent.
*/
private RexCall simplifUnaryFunction(RexCall rexCall) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think simplifyIdempotentUnaryFunction is more appropriate.

@@ -88,6 +89,9 @@ public class RexSimplify {

private static final Strong STRONG = new Strong();

private static final List<SqlOperator> IDEMOTENT_UNARY_FUNCTIONS =
Arrays.asList(SqlStdOperatorTable.UPPER, SqlStdOperatorTable.LOWER, SqlStdOperatorTable.ABS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImmutableList is better

Copy link
Member Author

@xuzifu666 xuzifu666 Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your points and had changed them, thanks @silundong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
什么的帽子 什么样的女孩容易招鬼 什么是甲减 七宗罪分别是什么 羊字五行属什么
太阳指什么生肖 什么水果降血糖 pg是什么 肛塞什么感觉 大腿根部痒用什么药膏
为什么16岁不能吃维生素B 吃蝎子有什么好处 蒲公英的约定表达什么 耵聍是什么意思 大便培养是检查什么的
木加号读什么 飞机烧的是什么油 乙肝表面抗体偏高是什么意思 鑫字属于五行属什么 50岁今年属什么生肖
生肖羊生什么生肖最好hcv7jop7ns4r.cn 老流口水是什么原因hcv7jop7ns2r.cn 小腿肿胀是什么原因引起的hcv7jop5ns6r.cn vivian是什么意思hcv9jop5ns6r.cn 窦性心律不齐吃什么药hcv7jop6ns5r.cn
誉之曰的之是什么意思hcv8jop6ns0r.cn 等着我为什么停播了hcv7jop6ns3r.cn 血稠有什么症状hcv8jop2ns8r.cn 经常尿路感染是什么原因hcv8jop3ns6r.cn 右眼睛跳是什么预兆hcv8jop6ns6r.cn
手指甲上的月牙代表什么hcv7jop5ns0r.cn 血压突然升高是什么原因hcv7jop9ns3r.cn 脊髓是什么hcv9jop0ns3r.cn 啪啪是什么意思hcv9jop4ns0r.cn 桑葚和什么泡酒壮阳hcv9jop4ns5r.cn
心智不成熟是什么意思hcv8jop2ns1r.cn 物色什么意思hcv8jop7ns8r.cn 怀孕的脉象是什么样的hcv9jop6ns4r.cn 纯阳之人有什么特征hcv8jop9ns0r.cn 减肥晚上吃什么比较好hcv9jop1ns0r.cn
百度