TheNeuralBit commented on a change in pull request #12906: URL: https://github.com/apache/beam/pull/12906#discussion_r493105830
########## File path: sdks/python/apache_beam/typehints/schemas.py ########## @@ -17,36 +17,42 @@ """ Support for mapping python types to proto Schemas and back again. -Python Schema -np.int8 <-----> BYTE -np.int16 <-----> INT16 -np.int32 <-----> INT32 -np.int64 <-----> INT64 -int ---/ -np.float32 <-----> FLOAT -np.float64 <-----> DOUBLE -float ---/ -bool <-----> BOOLEAN -Timestamp <-----> LogicalType(urn="beam:logical_type:micros_instant:v1") -Mapping <-----> MapType -Sequence <-----> ArrayType -NamedTuple <-----> RowType -beam.Row ---/ - -nullable=True on a Beam FieldType is represented in Python by wrapping the -typing in Optional. - -The mappings for STRING and BYTES are different between python 2 and python 3, -because of the changes to str: -py3: -str/unicode <-----> STRING -bytes <-----> BYTES -ByteString ---/ - -py2: -str will be rejected since it is ambiguous. -unicode <-----> STRING -ByteString <-----> BYTES +Imposes a mapping between common Python types and Beam portable schemas +(https://s.apache.org/beam-schemas):: + + Python Schema + np.int8 <-----> BYTE + np.int16 <-----> INT16 + np.int32 <-----> INT32 + np.int64 <-----> INT64 + int ---/ Review comment: It's supposed to indicate that when converting to Beam schemas int will map to INT64, but it's not a two-way mapping. Converting back from Beam schemas will produce np.int64, not int. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
