mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 17:34:41 +00:00
Fix 13970: Fix Consecutive Array issue (#14852)
This commit is contained in:
parent
d1460b675b
commit
e30ffd71ce
@ -93,20 +93,14 @@ def _get_column_type(self, type_):
|
|||||||
"struct": sqa_types.SQAStruct,
|
"struct": sqa_types.SQAStruct,
|
||||||
"row": sqa_types.SQAStruct,
|
"row": sqa_types.SQAStruct,
|
||||||
"map": sqa_types.SQAMap,
|
"map": sqa_types.SQAMap,
|
||||||
|
"decimal": types.DECIMAL,
|
||||||
|
"varchar": types.VARCHAR,
|
||||||
|
"char": types.CHAR,
|
||||||
}
|
}
|
||||||
if name in ["decimal"]:
|
if name in ["decimal", "char", "varchar"]:
|
||||||
col_type = types.DECIMAL
|
col_type = col_map[name]
|
||||||
if length:
|
if length:
|
||||||
precision, scale = length.split(",")
|
args = [int(l) for l in 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)]
|
|
||||||
elif type_.startswith("array"):
|
elif type_.startswith("array"):
|
||||||
parsed_type = (
|
parsed_type = (
|
||||||
ColumnTypeParser._parse_datatype_string( # pylint: disable=protected-access
|
ColumnTypeParser._parse_datatype_string( # pylint: disable=protected-access
|
||||||
@ -114,7 +108,13 @@ def _get_column_type(self, type_):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
col_type = col_map["array"]
|
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):
|
elif col_map.get(name):
|
||||||
col_type = col_map.get(name)
|
col_type = col_map.get(name)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user