Skip to content

Commit

Permalink
Combined 'array<' and 'array' condition check
Browse files Browse the repository at this point in the history
  • Loading branch information
Akash Verma authored and Akash Verma committed Jan 10, 2025
1 parent ecb4baa commit f7480e1
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,16 @@ def _parse_datatype_string( # pylint: disable=too-many-return-statements
# pylint: disable=too-many-branches
data_type = data_type.lower().strip()
data_type = data_type.replace(" ", "")
if data_type.startswith("array<"):
if data_type.startswith("array"):
# Set arrayDataType to UNKNOWN for Snowflake table array columns
# to prevent validation error requiring non-null arrayDataType
if data_type == "array":
data_type_string = {
"dataType": "ARRAY",
"arrayDataType": DataType.UNKNOWN.value,
"dataTypeDisplay": data_type,
}
return data_type_string
if data_type[-1] != ">":
raise ValueError(f"expected '>' found: {data_type}")
arr_data_type = ColumnTypeParser._parse_primitive_datatype_string(
Expand Down Expand Up @@ -385,13 +394,7 @@ def _parse_datatype_string( # pylint: disable=too-many-return-statements
return ColumnTypeParser._parse_struct_fields_string(data_type[7:-1])
if ":" in data_type:
return ColumnTypeParser._parse_struct_fields_string(data_type)
if data_type == "array":
data_type_string = {
"dataType": "ARRAY",
"arrayDataType": DataType.UNKNOWN,
"dataTypeDisplay": data_type,
}
return data_type_string


return ColumnTypeParser._parse_primitive_datatype_string(data_type)

Expand Down

0 comments on commit f7480e1

Please sign in to comment.