ptars 0.0.1rc1__tar.gz → 0.0.2rc2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/Cargo.lock +55 -48
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/Cargo.toml +3 -3
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/DEVELOPMENT.md +9 -1
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/PKG-INFO +2 -1
- ptars-0.0.2rc2/protos/ptars_protos/imported.proto +20 -0
- ptars-0.0.2rc2/protos/ptars_protos/importer.proto +16 -0
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/pyproject.toml +2 -1
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/python/ptars/internal.py +29 -6
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/scripts/protoc.py +1 -1
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/src/lib.rs +11 -0
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/LICENSE +0 -0
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/Makefile +0 -0
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/README.md +0 -0
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/poetry.lock +0 -0
- {ptars-0.0.1rc1/protos → ptars-0.0.2rc2/protos/ptars_protos}/bench.proto +0 -0
- {ptars-0.0.1rc1/protos → ptars-0.0.2rc2/protos/ptars_protos}/simple.proto +0 -0
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/python/__init__.py +0 -0
- {ptars-0.0.1rc1 → ptars-0.0.2rc2}/python/ptars/__init__.py +0 -0
@@ -306,9 +306,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
|
306
306
|
|
307
307
|
[[package]]
|
308
308
|
name = "cc"
|
309
|
-
version = "1.0.
|
309
|
+
version = "1.0.95"
|
310
310
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
311
|
-
checksum = "
|
311
|
+
checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b"
|
312
312
|
|
313
313
|
[[package]]
|
314
314
|
name = "cfg-if"
|
@@ -318,16 +318,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
318
318
|
|
319
319
|
[[package]]
|
320
320
|
name = "chrono"
|
321
|
-
version = "0.4.
|
321
|
+
version = "0.4.38"
|
322
322
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
323
|
-
checksum = "
|
323
|
+
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
324
324
|
dependencies = [
|
325
325
|
"android-tzdata",
|
326
326
|
"iana-time-zone",
|
327
327
|
"js-sys",
|
328
328
|
"num-traits",
|
329
329
|
"wasm-bindgen",
|
330
|
-
"windows-targets 0.52.
|
330
|
+
"windows-targets 0.52.5",
|
331
331
|
]
|
332
332
|
|
333
333
|
[[package]]
|
@@ -602,9 +602,9 @@ dependencies = [
|
|
602
602
|
|
603
603
|
[[package]]
|
604
604
|
name = "num"
|
605
|
-
version = "0.4.
|
605
|
+
version = "0.4.2"
|
606
606
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
607
|
-
checksum = "
|
607
|
+
checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41"
|
608
608
|
dependencies = [
|
609
609
|
"num-bigint",
|
610
610
|
"num-complex",
|
@@ -713,9 +713,9 @@ checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
|
|
713
713
|
|
714
714
|
[[package]]
|
715
715
|
name = "proc-macro2"
|
716
|
-
version = "1.0.
|
716
|
+
version = "1.0.81"
|
717
717
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
718
|
-
checksum = "
|
718
|
+
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
|
719
719
|
dependencies = [
|
720
720
|
"unicode-ident",
|
721
721
|
]
|
@@ -742,7 +742,7 @@ dependencies = [
|
|
742
742
|
|
743
743
|
[[package]]
|
744
744
|
name = "ptarslib"
|
745
|
-
version = "0.0.
|
745
|
+
version = "0.0.2-rc2"
|
746
746
|
dependencies = [
|
747
747
|
"arrow",
|
748
748
|
"arrow-array",
|
@@ -817,9 +817,9 @@ dependencies = [
|
|
817
817
|
|
818
818
|
[[package]]
|
819
819
|
name = "quote"
|
820
|
-
version = "1.0.
|
820
|
+
version = "1.0.36"
|
821
821
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
822
|
-
checksum = "
|
822
|
+
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
823
823
|
dependencies = [
|
824
824
|
"proc-macro2",
|
825
825
|
]
|
@@ -891,18 +891,18 @@ checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
|
|
891
891
|
|
892
892
|
[[package]]
|
893
893
|
name = "serde"
|
894
|
-
version = "1.0.
|
894
|
+
version = "1.0.198"
|
895
895
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
896
|
-
checksum = "
|
896
|
+
checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc"
|
897
897
|
dependencies = [
|
898
898
|
"serde_derive",
|
899
899
|
]
|
900
900
|
|
901
901
|
[[package]]
|
902
902
|
name = "serde_derive"
|
903
|
-
version = "1.0.
|
903
|
+
version = "1.0.198"
|
904
904
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
905
|
-
checksum = "
|
905
|
+
checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9"
|
906
906
|
dependencies = [
|
907
907
|
"proc-macro2",
|
908
908
|
"quote",
|
@@ -911,9 +911,9 @@ dependencies = [
|
|
911
911
|
|
912
912
|
[[package]]
|
913
913
|
name = "serde_json"
|
914
|
-
version = "1.0.
|
914
|
+
version = "1.0.116"
|
915
915
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
916
|
-
checksum = "
|
916
|
+
checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
|
917
917
|
dependencies = [
|
918
918
|
"itoa",
|
919
919
|
"ryu",
|
@@ -934,9 +934,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|
934
934
|
|
935
935
|
[[package]]
|
936
936
|
name = "syn"
|
937
|
-
version = "2.0.
|
937
|
+
version = "2.0.60"
|
938
938
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
939
|
-
checksum = "
|
939
|
+
checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3"
|
940
940
|
dependencies = [
|
941
941
|
"proc-macro2",
|
942
942
|
"quote",
|
@@ -951,18 +951,18 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
|
|
951
951
|
|
952
952
|
[[package]]
|
953
953
|
name = "thiserror"
|
954
|
-
version = "1.0.
|
954
|
+
version = "1.0.59"
|
955
955
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
956
|
-
checksum = "
|
956
|
+
checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa"
|
957
957
|
dependencies = [
|
958
958
|
"thiserror-impl",
|
959
959
|
]
|
960
960
|
|
961
961
|
[[package]]
|
962
962
|
name = "thiserror-impl"
|
963
|
-
version = "1.0.
|
963
|
+
version = "1.0.59"
|
964
964
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
965
|
-
checksum = "
|
965
|
+
checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66"
|
966
966
|
dependencies = [
|
967
967
|
"proc-macro2",
|
968
968
|
"quote",
|
@@ -1062,7 +1062,7 @@ version = "0.52.0"
|
|
1062
1062
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1063
1063
|
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
1064
1064
|
dependencies = [
|
1065
|
-
"windows-targets 0.52.
|
1065
|
+
"windows-targets 0.52.5",
|
1066
1066
|
]
|
1067
1067
|
|
1068
1068
|
[[package]]
|
@@ -1082,17 +1082,18 @@ dependencies = [
|
|
1082
1082
|
|
1083
1083
|
[[package]]
|
1084
1084
|
name = "windows-targets"
|
1085
|
-
version = "0.52.
|
1085
|
+
version = "0.52.5"
|
1086
1086
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1087
|
-
checksum = "
|
1087
|
+
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
1088
1088
|
dependencies = [
|
1089
|
-
"windows_aarch64_gnullvm 0.52.
|
1090
|
-
"windows_aarch64_msvc 0.52.
|
1091
|
-
"windows_i686_gnu 0.52.
|
1092
|
-
"
|
1093
|
-
"
|
1094
|
-
"
|
1095
|
-
"
|
1089
|
+
"windows_aarch64_gnullvm 0.52.5",
|
1090
|
+
"windows_aarch64_msvc 0.52.5",
|
1091
|
+
"windows_i686_gnu 0.52.5",
|
1092
|
+
"windows_i686_gnullvm",
|
1093
|
+
"windows_i686_msvc 0.52.5",
|
1094
|
+
"windows_x86_64_gnu 0.52.5",
|
1095
|
+
"windows_x86_64_gnullvm 0.52.5",
|
1096
|
+
"windows_x86_64_msvc 0.52.5",
|
1096
1097
|
]
|
1097
1098
|
|
1098
1099
|
[[package]]
|
@@ -1103,9 +1104,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
|
1103
1104
|
|
1104
1105
|
[[package]]
|
1105
1106
|
name = "windows_aarch64_gnullvm"
|
1106
|
-
version = "0.52.
|
1107
|
+
version = "0.52.5"
|
1107
1108
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1108
|
-
checksum = "
|
1109
|
+
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
1109
1110
|
|
1110
1111
|
[[package]]
|
1111
1112
|
name = "windows_aarch64_msvc"
|
@@ -1115,9 +1116,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
|
1115
1116
|
|
1116
1117
|
[[package]]
|
1117
1118
|
name = "windows_aarch64_msvc"
|
1118
|
-
version = "0.52.
|
1119
|
+
version = "0.52.5"
|
1119
1120
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1120
|
-
checksum = "
|
1121
|
+
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
1121
1122
|
|
1122
1123
|
[[package]]
|
1123
1124
|
name = "windows_i686_gnu"
|
@@ -1127,9 +1128,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
|
1127
1128
|
|
1128
1129
|
[[package]]
|
1129
1130
|
name = "windows_i686_gnu"
|
1130
|
-
version = "0.52.
|
1131
|
+
version = "0.52.5"
|
1132
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1133
|
+
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
1134
|
+
|
1135
|
+
[[package]]
|
1136
|
+
name = "windows_i686_gnullvm"
|
1137
|
+
version = "0.52.5"
|
1131
1138
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1132
|
-
checksum = "
|
1139
|
+
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
1133
1140
|
|
1134
1141
|
[[package]]
|
1135
1142
|
name = "windows_i686_msvc"
|
@@ -1139,9 +1146,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
|
1139
1146
|
|
1140
1147
|
[[package]]
|
1141
1148
|
name = "windows_i686_msvc"
|
1142
|
-
version = "0.52.
|
1149
|
+
version = "0.52.5"
|
1143
1150
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1144
|
-
checksum = "
|
1151
|
+
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
1145
1152
|
|
1146
1153
|
[[package]]
|
1147
1154
|
name = "windows_x86_64_gnu"
|
@@ -1151,9 +1158,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
|
1151
1158
|
|
1152
1159
|
[[package]]
|
1153
1160
|
name = "windows_x86_64_gnu"
|
1154
|
-
version = "0.52.
|
1161
|
+
version = "0.52.5"
|
1155
1162
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1156
|
-
checksum = "
|
1163
|
+
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
1157
1164
|
|
1158
1165
|
[[package]]
|
1159
1166
|
name = "windows_x86_64_gnullvm"
|
@@ -1163,9 +1170,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
|
1163
1170
|
|
1164
1171
|
[[package]]
|
1165
1172
|
name = "windows_x86_64_gnullvm"
|
1166
|
-
version = "0.52.
|
1173
|
+
version = "0.52.5"
|
1167
1174
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1168
|
-
checksum = "
|
1175
|
+
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
1169
1176
|
|
1170
1177
|
[[package]]
|
1171
1178
|
name = "windows_x86_64_msvc"
|
@@ -1175,9 +1182,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
|
1175
1182
|
|
1176
1183
|
[[package]]
|
1177
1184
|
name = "windows_x86_64_msvc"
|
1178
|
-
version = "0.52.
|
1185
|
+
version = "0.52.5"
|
1179
1186
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1180
|
-
checksum = "
|
1187
|
+
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
1181
1188
|
|
1182
1189
|
[[package]]
|
1183
1190
|
name = "zerocopy"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "ptarslib"
|
3
|
-
version = "0.0.
|
3
|
+
version = "0.0.2-rc2"
|
4
4
|
authors = ["0x26res <0x26res@gmail.net>"]
|
5
5
|
edition = "2021"
|
6
6
|
description = "Fast python conversion from protobuf to arrow using rust"
|
@@ -27,8 +27,8 @@ pyo3 = { version = "0.20.3" }
|
|
27
27
|
arrow = { version = "51.0.0", features = ["pyarrow"] }
|
28
28
|
arrow-array = { version = "51.0.0" }
|
29
29
|
arrow-schema = { version = "51.0.0" }
|
30
|
-
protobuf = { version = "3.
|
31
|
-
chrono = { version = "0.4.
|
30
|
+
protobuf = { version = "3.4.0" }
|
31
|
+
chrono = { version = "0.4.38" }
|
32
32
|
[features]
|
33
33
|
extension-module = ["pyo3/extension-module"]
|
34
34
|
default = ["extension-module"]
|
@@ -20,10 +20,18 @@ export CARGO_BUILD_TARGET=x86_64-apple-darwin
|
|
20
20
|
## Testing
|
21
21
|
|
22
22
|
```shell
|
23
|
-
cargo build && maturin develop && RUST_BACKTRACE=1
|
23
|
+
cargo build && maturin develop && RUST_BACKTRACE=1 pytest python/test
|
24
24
|
```
|
25
25
|
|
26
26
|
|
27
|
+
## Releasing
|
28
|
+
|
29
|
+
- Update the version in [Cargo.toml](./Cargo.toml)
|
30
|
+
- Update cargo lock file `cargo generate-lockfile`
|
31
|
+
- Update the version in [pyproject.toml](./pyproject.toml)
|
32
|
+
- Update the poetry lock file `poetry lock --no-update`
|
33
|
+
- Tag and push the tag (don't forget to preprend a `v` to the version when tagging)
|
34
|
+
|
27
35
|
## TODO
|
28
36
|
|
29
37
|
- [ ] arrow to proto
|
@@ -1,9 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: ptars
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.2rc2
|
4
4
|
Classifier: Programming Language :: Rust
|
5
5
|
Classifier: Operating System :: POSIX :: Linux
|
6
6
|
Requires-Dist: protobuf >3
|
7
|
+
Requires-Dist: pyarrow >15
|
7
8
|
License-File: LICENSE
|
8
9
|
Summary: Fast python conversion from protobuf to arrow using rust
|
9
10
|
Home-Page: https://github.com/0x26res/ptars
|
@@ -0,0 +1,20 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
import "google/protobuf/timestamp.proto";
|
4
|
+
import "google/protobuf/wrappers.proto";
|
5
|
+
import "google/type/date.proto";
|
6
|
+
|
7
|
+
|
8
|
+
enum ImportedEnum {
|
9
|
+
UNKNOWN_CORE_ENUM = 0;
|
10
|
+
CORE_ENUM_FOO = 1;
|
11
|
+
CORE_ENUM_BAR = 2;
|
12
|
+
}
|
13
|
+
|
14
|
+
message ImportedMessage {
|
15
|
+
string string_value = 1;
|
16
|
+
ImportedEnum imported_enum = 2;
|
17
|
+
google.protobuf.DoubleValue double_value = 3;
|
18
|
+
google.type.Date date = 4;
|
19
|
+
google.protobuf.Timestamp timestamp = 5;
|
20
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
import "ptars_protos/imported.proto";
|
4
|
+
import "google/protobuf/timestamp.proto";
|
5
|
+
import "google/protobuf/wrappers.proto";
|
6
|
+
import "google/type/date.proto";
|
7
|
+
|
8
|
+
|
9
|
+
message ImporterMessage {
|
10
|
+
string string_value = 1;
|
11
|
+
ImportedEnum imported_enum = 2;
|
12
|
+
google.protobuf.DoubleValue double_value = 3;
|
13
|
+
google.type.Date date = 4;
|
14
|
+
google.protobuf.Timestamp timestamp = 5;
|
15
|
+
ImportedMessage imported_message = 6;
|
16
|
+
}
|
@@ -11,11 +11,12 @@ classifiers = [
|
|
11
11
|
requires-python = ">=3.8"
|
12
12
|
dependencies = [
|
13
13
|
'protobuf > 3',
|
14
|
+
"pyarrow > 15",
|
14
15
|
]
|
15
16
|
|
16
17
|
[tool.poetry]
|
17
18
|
name = "ptars"
|
18
|
-
version = "0.0.
|
19
|
+
version = "0.0.2-rc2"
|
19
20
|
description = "Convert from protobuf to arrow and back in rust"
|
20
21
|
authors = ["Tradewell Tech <engineering@tradewelltech.co>"]
|
21
22
|
maintainers = ["0x26res <0x26res@gmail.com>"]
|
@@ -1,3 +1,7 @@
|
|
1
|
+
import warnings
|
2
|
+
|
3
|
+
import pyarrow as pa
|
4
|
+
from google._upb._message import Message, MessageMeta
|
1
5
|
from google.protobuf.descriptor import Descriptor, FileDescriptor
|
2
6
|
from google.protobuf.descriptor_pb2 import FileDescriptorProto
|
3
7
|
|
@@ -10,16 +14,21 @@ def _file_descriptor_to_bytes(fd: FileDescriptor) -> bytes:
|
|
10
14
|
return file_descriptor.SerializeToString()
|
11
15
|
|
12
16
|
|
13
|
-
def
|
17
|
+
def _get_dependencies(
|
14
18
|
file_descriptor: FileDescriptor, results: list[FileDescriptor] = None
|
15
19
|
) -> list[FileDescriptor]:
|
20
|
+
"""
|
21
|
+
Return list of FileDescriptor that this file depends on, including this one.
|
22
|
+
|
23
|
+
Results are in topological order (least dependent first).
|
24
|
+
"""
|
16
25
|
if results is None:
|
17
26
|
results = []
|
18
|
-
results.append(file_descriptor)
|
19
27
|
for dependency in file_descriptor.dependencies:
|
20
28
|
if dependency not in results:
|
21
|
-
|
22
|
-
|
29
|
+
_get_dependencies(dependency, results)
|
30
|
+
results.append(file_descriptor)
|
31
|
+
return results[::-1]
|
23
32
|
|
24
33
|
|
25
34
|
class HandlerPool:
|
@@ -28,16 +37,30 @@ class HandlerPool:
|
|
28
37
|
self._pool = {}
|
29
38
|
|
30
39
|
def get_for_message(self, descriptor: Descriptor) -> MessageHandler:
|
40
|
+
if isinstance(descriptor, MessageMeta):
|
41
|
+
warnings.warn(
|
42
|
+
f"Received {MessageMeta.__name__} instead of {Descriptor.__name__}"
|
43
|
+
)
|
44
|
+
descriptor = descriptor.DESCRIPTOR
|
45
|
+
if not isinstance(descriptor, Descriptor):
|
46
|
+
raise TypeError(f"Expecting {Descriptor.__name__}")
|
47
|
+
|
31
48
|
assert isinstance(descriptor, Descriptor)
|
32
49
|
try:
|
33
|
-
self._pool[descriptor.full_name]
|
50
|
+
return self._pool[descriptor.full_name]
|
34
51
|
except KeyError:
|
35
52
|
file_descriptor = descriptor.file
|
36
53
|
|
37
|
-
dependencies =
|
54
|
+
dependencies = _get_dependencies(file_descriptor)
|
38
55
|
payloads = [_file_descriptor_to_bytes(d) for d in dependencies]
|
39
56
|
message_handler = self._proto_cache.create_for_message(
|
40
57
|
"." + descriptor.full_name, payloads
|
41
58
|
)
|
42
59
|
self._pool[descriptor.full_name] = message_handler
|
43
60
|
return message_handler
|
61
|
+
|
62
|
+
def messages_to_record_batch(
|
63
|
+
self, messages: list[Message], descriptor: Descriptor
|
64
|
+
) -> pa.RecordBatch:
|
65
|
+
handler = self.get_for_message(descriptor)
|
66
|
+
return handler.list_to_record_batch([m.SerializeToString() for m in messages])
|
@@ -38,7 +38,7 @@ def main():
|
|
38
38
|
"--proto_path={}".format(_GOOGLE_COMMON_PROTOS_ROOT_DIR),
|
39
39
|
"--proto_path={}".format(_GRPC_PROTOS_INCLUDE),
|
40
40
|
"--proto_path={}".format(_SRC_DIR),
|
41
|
-
"--python_out={}".format(
|
41
|
+
"--python_out={}".format(_ROOT_DIR),
|
42
42
|
] + proto_files
|
43
43
|
print(" ".join(proto_args))
|
44
44
|
run_protoc(proto_args)
|
@@ -565,6 +565,17 @@ impl MessageHandler {
|
|
565
565
|
batch.to_pyarrow(py)
|
566
566
|
}
|
567
567
|
|
568
|
+
fn just_convert(&self, values: Vec<Vec<u8>>, _py: Python<'_>) {
|
569
|
+
let _unused: Vec<Box<dyn MessageDyn>> = values
|
570
|
+
.iter()
|
571
|
+
.map(|x| {
|
572
|
+
self.message_descriptor
|
573
|
+
.parse_from_bytes(x.as_slice())
|
574
|
+
.unwrap()
|
575
|
+
})
|
576
|
+
.collect();
|
577
|
+
}
|
578
|
+
|
568
579
|
fn record_batch_to_array(&self, record_batch: &PyAny, py: Python<'_>) -> PyResult<PyObject> {
|
569
580
|
let _arrow_record_batch = RecordBatch::from_pyarrow(record_batch);
|
570
581
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|