Uploaded image for project: 'Python Integrations'
  1. Python Integrations
  2. INTPYTHON-241

Checking list types raises an error in _normalize_typeid

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.5
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Context

      Github Issue

      When struct is put inside a list
       {{schema = pymongoarrow.api.Schema(

      Unknown macro: {'_id'}

      )}}
       
      it raises
       {{> raise ValueError(msg)
      E ValueError: Unsupported type identifier <class 'pyarrow.lib.StructType'> for field 0}}
       
      As the case for lists in the function _normalize_typeid exists, then it seems that it should be supported, but there is a bug.

      Expected behavior:
       {{<Schema

      Unknown macro: {'_id'}

      >}}
       
      See #223 for a fix.

      Further problem is setting bson.ObjectId inside the struct inside the list
       {{schema = pymongoarrow.api.Schema(

      Unknown macro: {'_id'}

      )}}
       
      which raises a TypeError:
       {{_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
      pyarrow/types.pxi:4711: in pyarrow.lib.struct
      ???
      pyarrow/types.pxi:3417: in pyarrow.lib.field
      ???
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

      > ???
      E TypeError: DataType expected, got <class 'type'>

      pyarrow/types.pxi:5066: TypeError}}
       
      It is fine in the case of list of only bson.ObjectId:
       {{schema = pymongoarrow.api.Schema(

      Unknown macro: {'_id'}

      )
      ->
      <Schema

      Unknown macro: {'_id'}

      >}}

      Definition of done

      What must be done to consider the task complete?

      Bugfix supplied

      Test to confirm bug will not recur supplied

      Pitfalls

      What should the implementer watch out for? What are the risks?

            Assignee:
            jib.adegunloye@mongodb.com Jib Adegunloye
            Reporter:
            jib.adegunloye@mongodb.com Jib Adegunloye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: