Skip to content

Commit

Permalink
Fix 13970: Fix Consecutive Array issue (open-metadata#14852)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush-shah authored Jan 25, 2024
1 parent d1460b6 commit e30ffd7
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ingestion/src/metadata/ingestion/source/database/athena/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,28 @@ def _get_column_type(self, type_):
"struct": sqa_types.SQAStruct,
"row": sqa_types.SQAStruct,
"map": sqa_types.SQAMap,
"decimal": types.DECIMAL,
"varchar": types.VARCHAR,
"char": types.CHAR,
}
if name in ["decimal"]:
col_type = types.DECIMAL
if name in ["decimal", "char", "varchar"]:
col_type = col_map[name]
if length:
precision, scale = length.split(",")
args = [int(precision), int(scale)]
elif name in ["char"]:
col_type = types.CHAR
if length:
args = [int(length)]
elif name in ["varchar"]:
col_type = types.VARCHAR
if length:
args = [int(length)]
args = [int(l) for l in length.split(",")]
elif type_.startswith("array"):
parsed_type = (
ColumnTypeParser._parse_datatype_string( # pylint: disable=protected-access
type_
)
)
col_type = col_map["array"]
args = [col_map.get(parsed_type.get("arrayDataType").lower(), types.String)]
if parsed_type["arrayDataType"].lower().startswith("array"):
# as OpenMetadata doesn't store any details on children of array, we put
# in type as string as default to avoid Array item_type required issue
# from sqlalchemy types
args = [types.String]
else:
args = [col_map.get(parsed_type.get("arrayDataType").lower(), types.String)]
elif col_map.get(name):
col_type = col_map.get(name)
else:
Expand Down

0 comments on commit e30ffd7

Please sign in to comment.