Abacn commented on code in PR #22561:
URL: https://github.com/apache/beam/pull/22561#discussion_r938064298


##########
sdks/python/apache_beam/typehints/schemas.py:
##########
@@ -647,9 +648,36 @@ def _from_typing(cls, typ):
                                     ('micros', np.int64)])
 
 
[email protected]_logical_type
+class DateTimeLogicalType(NoArgumentLogicalType[Timestamp, np.int64]):

Review Comment:
   ah messed up local virtualenv. Remove `@LogicalType.register_logical_type` 
or the entire class here causes the following error:
   ```
   Traceback (most recent call last):
     File 
"...virtualenv/py38beam/lib/python3.8/site-packages/apache_beam/typehints/schemas.py",
 line 408, in typing_from_runner_api
       field_py_type = self.typing_from_runner_api(field.type)
     File 
"...virtualenv/py38beam/lib/python3.8/site-packages/apache_beam/typehints/schemas.py",
 line 362, in typing_from_runner_api
       base = self.typing_from_runner_api(base_type)
     File 
"...virtualenv/py38beam/lib/python3.8/site-packages/apache_beam/typehints/schemas.py",
 line 447, in typing_from_runner_api
       return LogicalType.from_runner_api(
     File 
"...virtualenv/py38beam/lib/python3.8/site-packages/apache_beam/typehints/schemas.py",
 line 621, in from_runner_api
       raise ValueError(
   ValueError: No logical type registered for URN 
'beam:logical_type:datetime:v1'
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
   ...
     File 
"...virtualenv/py38beam/lib/python3.8/site-packages/apache_beam/typehints/schemas.py",
 line 179, in typing_from_runner_api
       return SchemaTranslation(
     File 
"...virtualenv/py38beam/lib/python3.8/site-packages/apache_beam/typehints/schemas.py",
 line 412, in typing_from_runner_api
       raise ValueError(
   ValueError: Failed to decode schema due to an issue with Field proto:
   
   name: "f_timestamp"
   type {
     nullable: true
     logical_type {
       urn: "beam:logical_type:datetime:v1"
       representation {
         atomic_type: INT64
       }
     }
   }
   id: 1
   encoding_position: 1
   
   ```
   Still need this to register the URN.



-- 
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]

Reply via email to