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

[FEA] Support lazy quantifier and specified group index in regexp_extract function #8806

Closed
nvliyuan opened this issue Jul 26, 2023 · 3 comments · Fixed by #10208
Closed
Assignees
Labels
feature request New feature or request

Comments

@nvliyuan
Copy link
Collaborator

It would be nice if we could support lazy quantifier and specified group index in regexp_extract function.
For example:

create a hive table and insert some rows:
hive> show create table datavalid3;
OK
CREATE EXTERNAL TABLE `datavalid3`(
  `col1` int,
  `col2` bigint,
  `col3` tinyint,
  `col4` string,
  `col5` date,
  `col6` map<string,string>,
  `col7` map<string,array<string>>,
  `col8` decimal(5,3))
PARTITIONED BY (
  `col9` string)
ROW FORMAT SERDE
  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
  'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
  'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'

run below SQL:
spark.sql("select regexp_extract(col4,'\"xst\":\"(.*?)\"') from datavalid3").show

fallback info:

!Exec <ProjectExec> cannot run on GPU because not all expressions can be replaced
    @Expression <Alias> regexp_extract(col4#3, "xst":"(.*?)", 1) AS regexp_extract(col4, "xst":"(.*?)", 1)#21 could run on GPU
      !Expression <RegExpExtract> regexp_extract(col4#3, "xst":"(.*?)", 1) cannot run on GPU because regex group count is 0, but the specified group index is 1; Lazy quantifier *? not supported near index 10
@nvliyuan nvliyuan added feature request New feature or request ? - Needs Triage Need team to review and classify labels Jul 26, 2023
@revans2
Copy link
Collaborator

revans2 commented Jul 26, 2023

The specified group count issue I think is a side effect of not being able to support the lazy quantifier. I think we stopped parsing the regexp and didn't see the capture group around the lazy quantifier.

@mattahrens mattahrens removed the ? - Needs Triage Need team to review and classify label Aug 8, 2023
@revans2
Copy link
Collaborator

revans2 commented Nov 7, 2023

It looks like CUDF does support this feature already.

>>> import cudf
>>> s = cudf.Series(['a:"hello"', 'a:"there"'])
>>> s
0    a:"hello"
1    a:"there"
dtype: object
>>> s.str.extract('a:"(.*?)"')
       0
0  hello
1  there

So this is probably mostly a feature for us to figure out how to transpile .*? into something that will match exactly with what java/spark does with the regexp.

@nvliyuan
Copy link
Collaborator Author

It will take more time for the customer to double-confirm the priority.

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

Successfully merging a pull request may close this issue.

4 participants