carloea2 commented on code in PR #4268:
URL: https://github.com/apache/texera/pull/4268#discussion_r3105626984
##########
amber/src/main/python/core/models/schema/attribute_type.py:
##########
@@ -78,6 +78,45 @@ class AttributeType(Enum):
}
+FROM_STRING_PARSER_MAPPING = {
+ AttributeType.STRING: str,
+ AttributeType.INT: lambda v: (
+ 0 if v is None or (isinstance(v, str) and v.strip() == "") else int(v)
+ ),
+ AttributeType.LONG: lambda v: (
+ 0 if v is None or (isinstance(v, str) and v.strip() == "") else int(v)
+ ),
+ AttributeType.DOUBLE: lambda v: (
+ 0.0 if v is None or (isinstance(v, str) and v.strip() == "") else
float(v)
+ ),
+ AttributeType.BOOL: lambda v: (
+ False
+ if v is None or (isinstance(v, str) and v.strip() == "")
+ else str(v).strip().lower() in ("true", "1", "yes")
Review Comment:
1) Done.
2) They use this on java side:
https://github.com/apache/texera/blob/ab3317b8ef12e1b56205bf0f35c5ae1edde42d9d/common/workflow-core/src/main/scala/org/apache/texera/amber/core/tuple/AttributeTypeUtils.scala#L259-L283
I will update the parser to do exactly the same.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]