Commit 1d831f5 1 parent 5330094 commit 1d831f5 Copy full SHA for 1d831f5
File tree 1 file changed +19
-2
lines changed
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -873,13 +873,26 @@ def feast_value_type_to_pa(
873
873
874
874
875
875
def pg_type_code_to_pg_type (code : int ) -> str :
876
- return {
876
+ """ Map the postgres type code a Feast type string
877
+
878
+ Rather than raise an exception on an unknown type, we return the
879
+ string representation of the type code. This way rather than raising
880
+ an exception on unknown types, Feast will just skip the problem columns.
881
+
882
+ Note that json and jsonb are not supported but this shows up in the
883
+ log as a warning. Since postgres allows custom types we return an unknown for those cases.
884
+
885
+ See: https://jdbc.postgresql.org/documentation/publicapi/index.html?constant-values.html
886
+ """
887
+ PG_TYPE_MAP = {
877
888
16 : "boolean" ,
878
889
17 : "bytea" ,
879
890
20 : "bigint" ,
880
891
21 : "smallint" ,
881
892
23 : "integer" ,
882
893
25 : "text" ,
894
+ 114 : "json" ,
895
+ 199 : "json[]" ,
883
896
700 : "real" ,
884
897
701 : "double precision" ,
885
898
1000 : "boolean[]" ,
@@ -905,7 +918,11 @@ def pg_type_code_to_pg_type(code: int) -> str:
905
918
1700 : "numeric" ,
906
919
2950 : "uuid" ,
907
920
2951 : "uuid[]" ,
908
- }[code ]
921
+ 3802 : "jsonb" ,
922
+ 3807 : "jsonb[]" ,
923
+ }
924
+
925
+ return PG_TYPE_MAP .get (code , "unknown" )
909
926
910
927
911
928
def pg_type_code_to_arrow (code : int ) -> str :
You can’t perform that action at this time.
0 commit comments