首页 > 解决方案 > regexp_substr oracle 函数转换为 pyspark

问题描述

我正在尝试将使用内置函数的现有 Oracle sql 转换regexp_substr为 pyspark sql。这个 oracle sql 正在获取用户输入值并应用 regexp_substr 函数来获取所需的输出字符串。

示例 - 下面的 1BBC 字符串是用户输入值

1. select nvl(regexp_substr('1BBC', 'BBB\+|BBB|CCC|AAA|BB|CC|AA|B|A|C'), 'XYZ') from dual

Output - BB

2. BBB++ string below is the user input value select nvl(regexp_substr('BBB++', 'BBB\+|BBB|CCC|AAA|BB|CC|AA|B|A|C'), 'XYZ') from dual

Output - BBB+

有没有办法使用 pyspark sql 或数据框操作来实现类似的输出?

标签: oraclepysparkpyspark-sql

解决方案


推荐阅读