Skip to content

Commit 051d837

Browse files
SNOW-1877144: Use only small values in dummy input for type inference (#2839)
<!--- Please answer these questions before creating your pull request. Thanks! ---> 1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR. <!--- In this section, please add a Snowflake Jira issue number. Note that if a corresponding GitHub issue exists, you should still include the Snowflake Jira issue number. For example, for GitHub issue #1400, you should add "SNOW-1335071" here. ---> Fixes SNOW-1877144 2. Fill out the following pre-review checklist: - [ ] I am adding a new automated test(s) to verify correctness of my new code - [ ] If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing - [ ] I am adding new logging messages - [ ] I am adding a new telemetry message - [ ] I am adding new credentials - [ ] I am adding a new dependency - [ ] If this is a new feature/behavior, I'm adding the Local Testing parity changes. - [ ] I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: [Thread-safe Developer Guidelines](https://github.com/snowflakedb/snowpark-python/blob/main/CONTRIBUTING.md#thread-safe-development) 3. Please describe how your code solves the related issue. Use only small dummy values here to avoid the risk of certain callables taking a long time to execute (where execution time is a function of the input value). As a downside this reduces diversity in input data so will reduce the effectiveness type inference framework in some rare cases.
1 parent 98330fa commit 051d837

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/snowflake/snowpark/modin/plugin/_internal/apply_utils.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -842,15 +842,13 @@ def convert_numpy_int_result_to_int(value: Any) -> Any:
842842

843843

844844
DUMMY_BOOL_INPUT = native_pd.Series([False, True])
845-
DUMMY_INT_INPUT = native_pd.Series(
846-
[-37, -9, -2, -1, 0, 2, 3, 5, 7, 9, 13, 16, 20]
847-
+ np.power(10, np.arange(19)).tolist()
848-
+ np.multiply(-1, np.power(10, np.arange(19))).tolist()
849-
)
845+
# Note: we use only small dummy values here to avoid the risk of certain callables
846+
# taking a long time to execute (where execution time is a function of the input value).
847+
# As a downside this reduces diversity in input data so will reduce the effectiveness
848+
# type inference framework in some rare cases.
849+
DUMMY_INT_INPUT = native_pd.Series([-37, -9, -2, -1, 0, 2, 3, 5, 7, 9, 13, 16, 20, 101])
850850
DUMMY_FLOAT_INPUT = native_pd.Series(
851-
[-9.9, -2.2, -1.0, 0.0, 0.5, 0.33, None, 0.99, 2.0, 3.0, 5.0, 7.7, 9.898989]
852-
+ np.power(10.1, np.arange(19)).tolist()
853-
+ np.multiply(-1.0, np.power(10.1, np.arange(19))).tolist()
851+
[-9.9, -2.2, -1.0, 0.0, 0.5, 0.33, None, 0.99, 2.0, 3.0, 5.0, 7.7, 9.898989, 100.1]
854852
)
855853
DUMMY_STRING_INPUT = native_pd.Series(
856854
["", "a", "A", "0", "1", "01", "123", "-1", "-12", "true", "True", "false", "False"]

0 commit comments

Comments
 (0)