korbit-ai[bot] commented on code in PR #33847: URL: https://github.com/apache/superset/pull/33847#discussion_r2159464806
########## superset/sql/dialects/dremio.py: ########## @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from sqlglot import exp, generator, parser +from sqlglot.dialects.dialect import Dialect, rename_func + + +class DremioRegexpSplit(exp.Func): + """ + Custom REGEXP_SPLIT function for Dremio that supports 4 arguments. + """ + + arg_types = { + "this": True, # string to split + "expression": True, # delimiter pattern + "mode": True, # mode (like 'ALL') - required in Dremio + "limit": True, # limit - required in Dremio + } Review Comment: ### Missing mode parameter validation in REGEXP_SPLIT <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The DremioRegexpSplit function lacks validation for the 'mode' parameter which must be 'ALL' in Dremio. ###### Why this matters Without validation, incorrect mode values could be passed through, causing runtime errors in Dremio SQL execution. ###### Suggested change ∙ *Feature Preview* Add a validate method to enforce the 'ALL' mode requirement: ```python def validate(self) -> None: super().validate() mode = self.args.get("mode") if not isinstance(mode, exp.Literal) or mode.this != "ALL": raise ValueError("REGEXP_SPLIT mode must be 'ALL' in Dremio") ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/c1c94aaf-7ea4-45a5-98e3-e5bbf2faf6ca/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/c1c94aaf-7ea4-45a5-98e3-e5bbf2faf6ca?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/c1c94aaf-7ea4-45a5-98e3-e5bbf2faf6ca?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/c1c94aaf-7ea4-45a5-98e3-e5bbf2faf6ca?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/c1c94aaf-7ea4-45a5-98e3-e5bbf2faf6ca) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:ee324907-63f9-49c2-b8a1-dbdf8be4d975 --> [](ee324907-63f9-49c2-b8a1-dbdf8be4d975) -- 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]
