Skip to content

Commit

Permalink
Fix test_literal_suite (#1981)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jrose authored Jul 26, 2024
1 parent 055e48b commit dbb5ded
Showing 1 changed file with 16 additions and 38 deletions.
54 changes: 16 additions & 38 deletions tests/integ/scala/test_literal_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,17 @@ def test_literal_basic_types(session):

field_str = str(df.schema.fields)

if session.sql_simplifier_enabled:
assert (
field_str == "[StructField('ID', LongType(), nullable=False), "
"StructField('NULL', StringType(), nullable=True), "
"StructField('STR', StringType(6), nullable=False), "
"StructField('CHAR', StringType(1), nullable=False), "
"StructField('BOOL', BooleanType(), nullable=True), "
"StructField('BYTES', BinaryType(), nullable=False), "
"StructField('INT', LongType(), nullable=False), "
"StructField('FLOAT', DoubleType(), nullable=False), "
"StructField('DECIMAL', DecimalType(38, 18), nullable=False)]"
)
else:
assert (
field_str == "[StructField('ID', LongType(), nullable=False), "
"StructField('NULL', StringType(16777216), nullable=True), "
"StructField('STR', StringType(6), nullable=False), "
"StructField('CHAR', StringType(1), nullable=False), "
"StructField('BOOL', BooleanType(), nullable=True), "
"StructField('BYTES', BinaryType(), nullable=False), "
"StructField('INT', LongType(), nullable=False), "
"StructField('FLOAT', DoubleType(), nullable=False), "
"StructField('DECIMAL', DecimalType(38, 18), nullable=False)]"
)
assert (
field_str == "[StructField('ID', LongType(), nullable=False), "
"StructField('NULL', StringType(), nullable=True), "
"StructField('STR', StringType(6), nullable=False), "
"StructField('CHAR', StringType(1), nullable=False), "
"StructField('BOOL', BooleanType(), nullable=True), "
"StructField('BYTES', BinaryType(), nullable=False), "
"StructField('INT', LongType(), nullable=False), "
"StructField('FLOAT', DoubleType(), nullable=False), "
"StructField('DECIMAL', DecimalType(38, 18), nullable=False)]"
)

show_str = df._show_string(10)
assert (
Expand Down Expand Up @@ -167,20 +154,11 @@ def test_special_literals(session):
.with_column("literal", lit(source_literal))
)

if session.sql_simplifier_enabled:
assert (
str(df.schema)
== "StructType([StructField('ID', LongType(), nullable=False), "
"StructField('NULL', StringType(), nullable=True), "
"StructField('LITERAL', LongType(), nullable=False)])"
)
else:
assert (
str(df.schema)
== "StructType([StructField('ID', LongType(), nullable=False), "
"StructField('NULL', StringType(16777216), nullable=True), "
"StructField('LITERAL', LongType(), nullable=False)])"
)
assert (
str(df.schema) == "StructType([StructField('ID', LongType(), nullable=False), "
"StructField('NULL', StringType(), nullable=True), "
"StructField('LITERAL', LongType(), nullable=False)])"
)

assert (
df._show_string(10)
Expand Down

0 comments on commit dbb5ded

Please sign in to comment.