Skip to content

Commit 827e093

Browse files
committed
address comments
1 parent 6c1f785 commit 827e093

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#### Bug Fixes
2525

2626
- Fixed a bug in local testing mode that caused a column to contain None when it should contain 0
27-
- Fixed a bug in StructField.from_json that prevented TimestampTypes with tzinfo from being parsed correctly.
2827
- Fixed a bug in `StructField.from_json` that prevented TimestampTypes with tzinfo from being parsed correctly.
2928
- Fixed a bug in function `date_format` that caused an error when the input column was date type or timestamp type.
3029
- Fixed a bug in dataframe that null value can be inserted in a non-nullable column.

src/snowflake/snowpark/_internal/analyzer/snowflake_plan_node.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,11 @@ def is_contain_illegal_null_value(self) -> bool:
165165
rows_to_compare = min(
166166
ARRAY_BIND_THRESHOLD // len(self.output) + 1, len(self.data)
167167
)
168-
for i in range(rows_to_compare):
169-
for j in range(len(self.output)):
170-
if self.data[i][j] is None and not self.output[j].nullable:
171-
return True
168+
for j in range(len(self.output)):
169+
if not self.output[j].nullable:
170+
for i in range(rows_to_compare):
171+
if self.data[i][j] is None:
172+
return True
172173
return False
173174

174175
@property

tests/integ/test_dataframe.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,8 +1827,10 @@ def test_create_dataframe_with_schema_col_names(session):
18271827
for field, expected_name in zip(df.schema.fields, col_names[:2] + ["_3", "_4"]):
18281828
assert Utils.equals_ignore_case(field.name, expected_name)
18291829

1830-
# the column names provided via schema keyword will overwrite other column names
1830+
# specify nullable in structtype to avoid insert null value into non-nullable column
18311831
struct_col_name = StructType([StructField(col, StringType()) for col in col_names])
1832+
1833+
# the column names provided via schema keyword will overwrite other column names
18321834
df = session.create_dataframe(
18331835
[{"aa": 1, "bb": 2, "cc": 3, "dd": 4}], schema=struct_col_name
18341836
)

0 commit comments

Comments
 (0)