Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
* Mark Python logical types as internal

* Mark possible investigation in Logical type instance creation in Java
  • Loading branch information
Abacn committed Sep 15, 2023
1 parent 1d96564 commit 8a24f1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ private static FieldType fieldTypeFromProtoWithoutNullable(SchemaApi.FieldType p
return FieldType.DECIMAL;
} else if (urn.startsWith("beam:logical_type:")) {
if (!logicalType.getPayload().isEmpty()) {
// logical type has a payload, try to recover the instance by deserialization
try {
return FieldType.logicalType(
(LogicalType)
Expand All @@ -454,6 +455,8 @@ private static FieldType fieldTypeFromProtoWithoutNullable(SchemaApi.FieldType p
urn);
}
} else {
// logical type does not have a payload. This happens when it is passed xlang.
// TODO(yathu) it appears this path is called heavily, consider cache the instance
LOG.debug("Constructing non-standard logical type {} as UnknownLogicalType", urn);
}
}
Expand Down
14 changes: 12 additions & 2 deletions sdks/python/apache_beam/io/jdbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,12 @@ def __init__(

@LogicalType.register_logical_type
class JdbcDateType(LogicalType[datetime.date, MillisInstant, str]):
"""Support of Legacy JdbcIO DATE logical type."""
"""
For internal use only; no backwards-compatibility guarantees.
Support of Legacy JdbcIO DATE logical type. Deemed to change when Java JDBCIO
has been migrated to Beam portable logical types.
"""
def __init__(self, argument=""):
pass

Expand Down Expand Up @@ -405,7 +410,12 @@ def _from_typing(cls, typ):

@LogicalType.register_logical_type
class JdbcTimeType(LogicalType[datetime.time, MillisInstant, str]):
"""Support of Legacy JdbcIO TIME logical type."""
"""
For internal use only; no backwards-compatibility guarantees.
Support of Legacy JdbcIO TIME logical type. . Deemed to change when Java
JDBCIO has been migrated to Beam portable logical types.
"""
def __init__(self, argument=""):
pass

Expand Down

0 comments on commit 8a24f1d

Please sign in to comment.