prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [BUG-REPORT] TypeError: can't pickle vaex.superutils.ordered_set
  **Description**
  If I use `df.func.where` with `isin`, I can't pickle the resulted state.
  This is for machine learning pipelines. 
  
  reproduce:
  ```
  import vaex
  import pickle
  
  df = vaex.from_dict({'a':[1,2,3]})
  df['b'] = df.func.where(df['a'].isin([1]),1,2)
  pickle.dumps(df.state_get())
  ...
  TypeError: can't pickle vaex.superutils.ordered_set_int64 objects
  ```
  
  
  **Software information**
   - vaex-core==4.0.0a11
   - Vaex was installed via: pip
   - OS: Mac
   
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `packages/vaex-core/vaex/hash.py`
  Content:
  ```
  1 import os
  2 
  3 
  4 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
  5 if not on_rtd:
  6     from .superutils import *
  7     from . import superutils
  8     ordered_set = tuple([cls for name, cls in vars(superutils).items() if name.startswith('ordered_set')])
  9 
  10 
  11 def counter_type_from_dtype(dtype, transient=True):
  12     from .array_types import is_string_type
  13     if is_string_type(dtype):
  14         if transient:
  15             postfix = 'string'
  16         else:
  17             postfix = 'string' # view not support atm
  18     else:
  19         postfix = str(dtype)
  20         if postfix == '>f8':
  21             postfix = 'float64'
  22         if postfix == 'double':  # arrow
  23             postfix = 'float64'
  24     name = 'counter_' + postfix
  25     return globals()[name]
  26 
  27 def ordered_set_type_from_dtype(dtype, transient=True):
  28     from .array_types import is_string_type
  29     if is_string_type(dtype):
  30         if transient:
  31             postfix = 'string'
  32         else:
  33             postfix = 'string' #  not support atm
  34     else:
  35         postfix = str(dtype)
  36         if postfix == '>f8':
  37             postfix = 'float64'
  38     name = 'ordered_set_' + postfix
  39     return globals()[name]
  40 
  41 def index_type_from_dtype(dtype, transient=True, prime_growth=False):
  42     from .array_types import is_string_type
  43     if is_string_type(dtype):
  44         if transient:
  45             postfix = 'string'
  46         else:
  47             postfix = 'string' #  not support atm
  48     else:
  49         postfix = str(dtype)
  50         if postfix == '>f8':
  51             postfix = 'float64'
  52     name = 'index_hash_' + postfix
  53     if prime_growth:
  54         name += "_prime_growth"
  55     return globals()[name]
  56 
  57 # from numpy import *
  58 # import IPython
  59 # IPython.embed()
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/packages/vaex-core/vaex/hash.py b/packages/vaex-core/vaex/hash.py
  --- a/packages/vaex-core/vaex/hash.py
  +++ b/packages/vaex-core/vaex/hash.py
  @@ -1,12 +1,19 @@
   import os
  +import copyreg
   
   
   on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
   if not on_rtd:
       from .superutils import *
       from . import superutils
  +
       ordered_set = tuple([cls for name, cls in vars(superutils).items() if name.startswith('ordered_set')])
   
  +    def pickle(x):
  +        return type(x), (x.extract(), x.count, x.nan_count, x.null_count)
  +    for cls in ordered_set:
  +        copyreg.pickle(cls, pickle)
  +
   
   def counter_type_from_dtype(dtype, transient=True):
       from .array_types import is_string_type
  @@ -24,6 +31,7 @@
       name = 'counter_' + postfix
       return globals()[name]
   
  +
   def ordered_set_type_from_dtype(dtype, transient=True):
       from .array_types import is_string_type
       if is_string_type(dtype):
  @@ -38,6 +46,7 @@
       name = 'ordered_set_' + postfix
       return globals()[name]
   
  +
   def index_type_from_dtype(dtype, transient=True, prime_growth=False):
       from .array_types import is_string_type
       if is_string_type(dtype):
  @@ -53,7 +62,3 @@
       if prime_growth:
           name += "_prime_growth"
       return globals()[name]
  -
  -# from numpy import *
  -# import IPython
  -# IPython.embed()
  \ No newline at end of file
  
verification_info: {"golden_diff": "diff --git a/packages/vaex-core/vaex/hash.py b/packages/vaex-core/vaex/hash.py\n--- a/packages/vaex-core/vaex/hash.py\n+++ b/packages/vaex-core/vaex/hash.py\n@@ -1,12 +1,19 @@\n import os\n+import copyreg\n \n \n on_rtd = os.environ.get('READTHEDOCS', None) == 'True'\n if not on_rtd:\n     from .superutils import *\n     from . import superutils\n+\n     ordered_set = tuple([cls for name, cls in vars(superutils).items() if name.startswith('ordered_set')])\n \n+    def pickle(x):\n+        return type(x), (x.extract(), x.count, x.nan_count, x.null_count)\n+    for cls in ordered_set:\n+        copyreg.pickle(cls, pickle)\n+\n \n def counter_type_from_dtype(dtype, transient=True):\n     from .array_types import is_string_type\n@@ -24,6 +31,7 @@\n     name = 'counter_' + postfix\n     return globals()[name]\n \n+\n def ordered_set_type_from_dtype(dtype, transient=True):\n     from .array_types import is_string_type\n     if is_string_type(dtype):\n@@ -38,6 +46,7 @@\n     name = 'ordered_set_' + postfix\n     return globals()[name]\n \n+\n def index_type_from_dtype(dtype, transient=True, prime_growth=False):\n     from .array_types import is_string_type\n     if is_string_type(dtype):\n@@ -53,7 +62,3 @@\n     if prime_growth:\n         name += \"_prime_growth\"\n     return globals()[name]\n-\n-# from numpy import *\n-# import IPython\n-# IPython.embed()\n\\ No newline at end of file\n", "issue": "[BUG-REPORT] TypeError: can't pickle vaex.superutils.ordered_set\n**Description**\r\nIf I use `df.func.where` with `isin`, I can't pickle the resulted state.\r\nThis is for machine learning pipelines. \r\n\r\nreproduce:\r\n```\r\nimport vaex\r\nimport pickle\r\n\r\ndf = vaex.from_dict({'a':[1,2,3]})\r\ndf['b'] = df.func.where(df['a'].isin([1]),1,2)\r\npickle.dumps(df.state_get())\r\n...\r\nTypeError: can't pickle vaex.superutils.ordered_set_int64 objects\r\n```\r\n\r\n\r\n**Software information**\r\n - vaex-core==4.0.0a11\r\n - Vaex was installed via: pip\r\n - OS: Mac\r\n \n", "before_files": [{"content": "import os\n\n\non_rtd = os.environ.get('READTHEDOCS', None) == 'True'\nif not on_rtd:\n    from .superutils import *\n    from . import superutils\n    ordered_set = tuple([cls for name, cls in vars(superutils).items() if name.startswith('ordered_set')])\n\n\ndef counter_type_from_dtype(dtype, transient=True):\n    from .array_types import is_string_type\n    if is_string_type(dtype):\n        if transient:\n            postfix = 'string'\n        else:\n            postfix = 'string' # view not support atm\n    else:\n        postfix = str(dtype)\n        if postfix == '>f8':\n            postfix = 'float64'\n        if postfix == 'double':  # arrow\n            postfix = 'float64'\n    name = 'counter_' + postfix\n    return globals()[name]\n\ndef ordered_set_type_from_dtype(dtype, transient=True):\n    from .array_types import is_string_type\n    if is_string_type(dtype):\n        if transient:\n            postfix = 'string'\n        else:\n            postfix = 'string' #  not support atm\n    else:\n        postfix = str(dtype)\n        if postfix == '>f8':\n            postfix = 'float64'\n    name = 'ordered_set_' + postfix\n    return globals()[name]\n\ndef index_type_from_dtype(dtype, transient=True, prime_growth=False):\n    from .array_types import is_string_type\n    if is_string_type(dtype):\n        if transient:\n            postfix = 'string'\n        else:\n            postfix = 'string' #  not support atm\n    else:\n        postfix = str(dtype)\n        if postfix == '>f8':\n            postfix = 'float64'\n    name = 'index_hash_' + postfix\n    if prime_growth:\n        name += \"_prime_growth\"\n    return globals()[name]\n\n# from numpy import *\n# import IPython\n# IPython.embed()", "path": "packages/vaex-core/vaex/hash.py"}], "after_files": [{"content": "import os\nimport copyreg\n\n\non_rtd = os.environ.get('READTHEDOCS', None) == 'True'\nif not on_rtd:\n    from .superutils import *\n    from . import superutils\n\n    ordered_set = tuple([cls for name, cls in vars(superutils).items() if name.startswith('ordered_set')])\n\n    def pickle(x):\n        return type(x), (x.extract(), x.count, x.nan_count, x.null_count)\n    for cls in ordered_set:\n        copyreg.pickle(cls, pickle)\n\n\ndef counter_type_from_dtype(dtype, transient=True):\n    from .array_types import is_string_type\n    if is_string_type(dtype):\n        if transient:\n            postfix = 'string'\n        else:\n            postfix = 'string' # view not support atm\n    else:\n        postfix = str(dtype)\n        if postfix == '>f8':\n            postfix = 'float64'\n        if postfix == 'double':  # arrow\n            postfix = 'float64'\n    name = 'counter_' + postfix\n    return globals()[name]\n\n\ndef ordered_set_type_from_dtype(dtype, transient=True):\n    from .array_types import is_string_type\n    if is_string_type(dtype):\n        if transient:\n            postfix = 'string'\n        else:\n            postfix = 'string' #  not support atm\n    else:\n        postfix = str(dtype)\n        if postfix == '>f8':\n            postfix = 'float64'\n    name = 'ordered_set_' + postfix\n    return globals()[name]\n\n\ndef index_type_from_dtype(dtype, transient=True, prime_growth=False):\n    from .array_types import is_string_type\n    if is_string_type(dtype):\n        if transient:\n            postfix = 'string'\n        else:\n            postfix = 'string' #  not support atm\n    else:\n        postfix = str(dtype)\n        if postfix == '>f8':\n            postfix = 'float64'\n    name = 'index_hash_' + postfix\n    if prime_growth:\n        name += \"_prime_growth\"\n    return globals()[name]\n", "path": "packages/vaex-core/vaex/hash.py"}]}