diff --git a/hybridse/tools/documentation/udf_doxygen/export_udf_doc.py b/hybridse/tools/documentation/udf_doxygen/export_udf_doc.py index 4faaa796bf1..caa3cbf0d34 100755 --- a/hybridse/tools/documentation/udf_doxygen/export_udf_doc.py +++ b/hybridse/tools/documentation/udf_doxygen/export_udf_doc.py @@ -54,12 +54,22 @@ def process_doc(doc): lines[i] = lines[i][indent:] return "\n".join(lines) +def surrond_backquote(t): + return f"`{t}`" + +def to_list_type(t): + return f"`list<{t}>`" + + +numeric_types = frozenset(["int16", "int32", "int64", "float", "double"]) +all_basic_types = frozenset(["bool", "int16", "int32", "int64", "float", "double", "string", "timestamp", "date"]) + +numeric_types_code = list(map(surrond_backquote, numeric_types)) +list_numeric_types_code = list(map(to_list_type, numeric_types)) +all_types_code = list(map(surrond_backquote, all_basic_types)) +list_all_types_code = list(map(to_list_type, all_basic_types)) def merge_arith_types(signature_set): - arith_types = frozenset(["`int16`", "`int32`", "`int64`", "`float`", "`double`"]) - arith_list_types = frozenset(["`list`", "`list`", "`list`", "`list`", "`list`"]) - all_basic_types = frozenset(["`bool`", "`int16`", "`int32`", "`int64`", - "`float`", "`double`", "`string`", "`timestamp`", "`date`"]) found = True def _find_and_merge(arg_types, idx, list_ty, merge_ty): @@ -87,14 +97,17 @@ def _find_and_merge(arg_types, idx, list_ty, merge_ty): for key in signature_set: arg_types = [_ for _ in signature_set[key]] for i in range(len(arg_types)): - if _find_and_merge(arg_types, i, all_basic_types, "`any`"): + if _find_and_merge(arg_types, i, all_types_code, "`any`"): # NOTE: must merge any before number found = True break - elif _find_and_merge(arg_types, i, arith_types, "`number`"): + elif _find_and_merge(arg_types, i, list_all_types_code, "`list`"): + found = True + break + elif _find_and_merge(arg_types, i, numeric_types_code, "`number`"): found = True break - elif _find_and_merge(arg_types, i, arith_list_types, "`list`"): + elif _find_and_merge(arg_types, i, list_numeric_types_code, "`list`"): found = True break if found: diff --git a/hybridse/tools/documentation/udf_doxygen/patch_markdown.sh b/hybridse/tools/documentation/udf_doxygen/patch_markdown.sh index 6d9baf49e4d..0a5f17aa26d 100755 --- a/hybridse/tools/documentation/udf_doxygen/patch_markdown.sh +++ b/hybridse/tools/documentation/udf_doxygen/patch_markdown.sh @@ -26,8 +26,9 @@ Types in documents here may a little different from real types in OpenMLDB SQL, \n\ | Type literal | Same as any of those types in OpenMLDB SQL |\n\ | --------- | -------------------------------------- |\n\ -| number | \`int16, int32, int64, float, double\` |\n\ -| any | \`bool, int16, int32, int64, float, double, string, timestamp, date\` |\n\ -| list | \`list, list, list, list, list\` |\n\ +| \`number\` | \`int16, int32, int64, float, double\` |\n\ +| \`any\` | \`bool, int16, int32, int64, float, double, string, timestamp, date\` |\n\ +| \`list\` | \`list, list, list, list, list\` |\n\ +| \`list\` | \`list, list, list, list, list, list, list, list, list\` |\n\ \n\ ## Functions/g" "$PATCH_FILE"