Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit a99f835

Browse files
strip illegal chars from cloud func name
1 parent fef3abe commit a99f835

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

bigframes/functions/_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import hashlib
1717
import inspect
1818
import json
19+
import re
1920
import sys
2021
import typing
2122
from typing import Any, cast, Optional, Sequence, Set
@@ -221,7 +222,9 @@ def get_cloud_function_name(
221222
"Get a name for the cloud function for the given user defined function."
222223
parts = [_BIGFRAMES_FUNCTION_PREFIX]
223224
if user_given_name:
224-
parts.append(user_given_name)
225+
user_given_name_alphanumeric = re.sub(r"[^a-zA-Z0-9_]", "", user_given_name)
226+
if user_given_name_alphanumeric:
227+
parts.append(user_given_name_alphanumeric)
225228
if session_id:
226229
parts.append(session_id)
227230
parts.append(function_hash)

tests/unit/functions/test_remote_function_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_get_remote_function_locations(
4646
[
4747
(
4848
"hash123",
49-
"my_func",
49+
" my_func ***",
5050
None,
5151
None,
5252
"bigframes-my_func-hash123",

0 commit comments

Comments
 (0)