rapidsai / cudf

cuDF - GPU DataFrame Library
https://docs.rapids.ai/api/cudf/stable/
Apache License 2.0
8.41k stars 899 forks source link

[BUG] `sr.dt.tz_localize(...)` fails on timezone-aware dask-cuDF series #13602

Closed charlesbluca closed 1 year ago

charlesbluca commented 1 year ago

Describe the bug We currently get a TypeError during meta construction when attempting sr.dt.tz_localize(...) on a timezone-aware dask-cuDF series:

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/dask/dataframe/accessor.py:14, in _bind_method.<locals>.func(self, *args, **kwargs)
     13 def func(self, *args, **kwargs):
---> 14     return self._function_map(attr, *args, **kwargs)

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/dask/dataframe/accessor.py:111, in Accessor._function_map(self, attr, *args, **kwargs)
    108     meta = kwargs.pop("meta")
    109 else:
    110     meta = self._delegate_method(
--> 111         self._series._meta_nonempty, self._accessor_name, attr, args, kwargs
    112     )
    113 token = f"{self._accessor_name}-{attr}"
    114 return self._series.map_partitions(
    115     self._delegate_method,
    116     self._accessor_name,
   (...)
    122     token=token,
    123 )

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/dask/dataframe/core.py:566, in _Frame._meta_nonempty(self)
    563 @property
    564 def _meta_nonempty(self):
    565     """A non-empty version of `_meta` with fake data."""
--> 566     return meta_nonempty(self._meta)

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/dask/utils.py:642, in Dispatch.__call__(self, arg, *args, **kwargs)
    638 """
    639 Call the corresponding method based on type of argument.
    640 """
    641 meth = self.dispatch(type(arg))
--> 642 return meth(arg, *args, **kwargs)

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/nvtx/nvtx.py:101, in annotate.__call__.<locals>.inner(*args, **kwargs)
     98 @wraps(func)
     99 def inner(*args, **kwargs):
    100     libnvtx_push_range(self.attributes, self.domain.handle)
--> 101     result = func(*args, **kwargs)
    102     libnvtx_pop_range(self.domain.handle)
    103     return result

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/dask_cudf/backends.py:142, in _nonempty_series(s, idx)
    140 if idx is None:
    141     idx = _nonempty_index(s.index)
--> 142 data = _get_non_empty_data(s._column)
    144 return cudf.Series(data, name=s.name, index=idx)

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/nvtx/nvtx.py:101, in annotate.__call__.<locals>.inner(*args, **kwargs)
     98 @wraps(func)
     99 def inner(*args, **kwargs):
    100     libnvtx_push_range(self.attributes, self.domain.handle)
--> 101     result = func(*args, **kwargs)
    102     libnvtx_pop_range(self.domain.handle)
    103     return result

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/dask_cudf/backends.py:131, in _get_non_empty_data(s)
    127         data = cudf.core.column.as_column(
    128             cp.arange(start=0, stop=2, dtype=s.dtype)
    129         )
    130     else:
--> 131         data = cudf.core.column.as_column(
    132             cp.arange(start=0, stop=2, dtype="int64")
    133         ).astype(s.dtype)
    134 return data

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/cudf/core/column/column.py:987, in ColumnBase.astype(self, dtype, **kwargs)
    985 elif is_decimal_dtype(dtype):
    986     return self.as_decimal_column(dtype, **kwargs)
--> 987 elif np.issubdtype(cast(Any, dtype), np.datetime64):
    988     return self.as_datetime_column(dtype, **kwargs)
    989 elif np.issubdtype(cast(Any, dtype), np.timedelta64):

File /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/lib/python3.9/site-packages/numpy/core/numerictypes.py:416, in issubdtype(arg1, arg2)
    358 r"""
    359 Returns True if first argument is a typecode lower/equal in type hierarchy.
    360 
   (...)
    413 
    414 """
    415 if not issubclass_(arg1, generic):
--> 416     arg1 = dtype(arg1).type
    417 if not issubclass_(arg2, generic):
    418     arg2 = dtype(arg2).type

TypeError: Cannot interpret 'datetime64[ns, UTC]' as a data type

Steps/Code to reproduce bug

import cudf
import dask.dataframe as dd
import pandas as pd

ps = pd.Series(pd.date_range("1970-01-01", "1980-01-01", freq="1T"))
gs = cudf.from_pandas(ps) 
dgs = dd.from_pandas(gs, npartitions=1)

# succeeds because dgs is timezone-naive
dgs = dgs.dt.tz_localize("UTC")

# fails
dgs.dt.tz_localize(None)

Expected behavior Would expect this operation to pass and change the timezone of the datetime data accordingly.

Environment overview (please complete the following information)

Environment details

Click here to see environment details

     **git***
     commit a7b95f26196d4a7f83d55b6249b47bc538be6c46 (HEAD -> pandas-2-compat)
     Merge: 1279ce32 c9eeb2c1
     Author: Charles Blackmon-Luca <20627856+charlesbluca@users.noreply.github.com>
     Date:   Wed Jun 21 13:10:16 2023 -0700

     Merge remote-tracking branch 'origin/main' into pandas-2-compat
     **git submodules***

     ***OS Information***
     DGX_NAME="DGX Server"
     DGX_PRETTY_NAME="NVIDIA DGX Server"
     DGX_SWBUILD_DATE="2023-03-27-13-31-04"
     DGX_SWBUILD_VERSION="5.5.0"
     DGX_COMMIT_ID="b2e06e0"
     DGX_PLATFORM="DGX Server for DGX-1"
     DGX_SERIAL_NUMBER="QTFCOU8220024"
     DISTRIB_ID=Ubuntu
     DISTRIB_RELEASE=20.04
     DISTRIB_CODENAME=focal
     DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
     NAME="Ubuntu"
     VERSION="20.04.6 LTS (Focal Fossa)"
     ID=ubuntu
     ID_LIKE=debian
     PRETTY_NAME="Ubuntu 20.04.6 LTS"
     VERSION_ID="20.04"
     HOME_URL="https://www.ubuntu.com/"
     SUPPORT_URL="https://help.ubuntu.com/"
     BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
     PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
     VERSION_CODENAME=focal
     UBUNTU_CODENAME=focal
     Linux dgx14 5.4.0-149-generic #166-Ubuntu SMP Tue Apr 18 16:51:45 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

     ***GPU Information***
     Wed Jun 21 14:34:01 2023
     +-----------------------------------------------------------------------------+
     | NVIDIA-SMI 525.105.17   Driver Version: 525.105.17   CUDA Version: 12.0     |
     |-------------------------------+----------------------+----------------------+
     | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
     | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
     |                               |                      |               MIG M. |
     |===============================+======================+======================|
     |   0  Tesla V100-SXM2...  On   | 00000000:06:00.0 Off |                    0 |
     | N/A   31C    P0    47W / 300W |      3MiB / 32768MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+
     |   1  Tesla V100-SXM2...  On   | 00000000:07:00.0 Off |                    0 |
     | N/A   33C    P0    41W / 300W |      3MiB / 32768MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+
     |   2  Tesla V100-SXM2...  On   | 00000000:0A:00.0 Off |                    0 |
     | N/A   31C    P0    42W / 300W |      3MiB / 32768MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+
     |   3  Tesla V100-SXM2...  On   | 00000000:0B:00.0 Off |                    0 |
     | N/A   29C    P0    42W / 300W |      3MiB / 32768MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+
     |   4  Tesla V100-SXM2...  On   | 00000000:85:00.0 Off |                    0 |
     | N/A   31C    P0    43W / 300W |      3MiB / 32768MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+
     |   5  Tesla V100-SXM2...  On   | 00000000:86:00.0 Off |                    0 |
     | N/A   30C    P0    42W / 300W |      3MiB / 32768MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+
     |   6  Tesla V100-SXM2...  On   | 00000000:89:00.0 Off |                    0 |
     | N/A   33C    P0    43W / 300W |      3MiB / 32768MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+
     |   7  Tesla V100-SXM2...  On   | 00000000:8A:00.0 Off |                    0 |
     | N/A   28C    P0    42W / 300W |      3MiB / 32768MiB |      0%      Default |
     |                               |                      |                  N/A |
     +-------------------------------+----------------------+----------------------+

     +-----------------------------------------------------------------------------+
     | Processes:                                                                  |
     |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
     |        ID   ID                                                   Usage      |
     |=============================================================================|
     |  No running processes found                                                 |
     +-----------------------------------------------------------------------------+

     ***CPU***
     Architecture:                    x86_64
     CPU op-mode(s):                  32-bit, 64-bit
     Byte Order:                      Little Endian
     Address sizes:                   46 bits physical, 48 bits virtual
     CPU(s):                          80
     On-line CPU(s) list:             0-79
     Thread(s) per core:              2
     Core(s) per socket:              20
     Socket(s):                       2
     NUMA node(s):                    2
     Vendor ID:                       GenuineIntel
     CPU family:                      6
     Model:                           79
     Model name:                      Intel(R) Xeon(R) CPU E5-2698 v4 @ 2.20GHz
     Stepping:                        1
     CPU MHz:                         2440.585
     CPU max MHz:                     3600.0000
     CPU min MHz:                     1200.0000
     BogoMIPS:                        4390.30
     Virtualization:                  VT-x
     L1d cache:                       1.3 MiB
     L1i cache:                       1.3 MiB
     L2 cache:                        10 MiB
     L3 cache:                        100 MiB
     NUMA node0 CPU(s):               0-19,40-59
     NUMA node1 CPU(s):               20-39,60-79
     Vulnerability Itlb multihit:     KVM: Mitigation: Split huge pages
     Vulnerability L1tf:              Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
     Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
     Vulnerability Meltdown:          Mitigation; PTI
     Vulnerability Mmio stale data:   Mitigation; Clear CPU buffers; SMT vulnerable
     Vulnerability Retbleed:          Not affected
     Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
     Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
     Vulnerability Spectre v2:        Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
     Vulnerability Srbds:             Not affected
     Vulnerability Tsx async abort:   Mitigation; Clear CPU buffers; SMT vulnerable
     Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts md_clear flush_l1d

     ***CMake***
     /usr/bin/cmake
     cmake version 3.16.3

     CMake suite maintained and supported by Kitware (kitware.com/cmake).

     ***g++***
     /usr/bin/g++
     g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
     Copyright (C) 2019 Free Software Foundation, Inc.
     This is free software; see the source for copying conditions.  There is NO
     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

     ***nvcc***
     /usr/local/cuda/bin/nvcc
     nvcc: NVIDIA (R) Cuda compiler driver
     Copyright (c) 2005-2022 NVIDIA Corporation
     Built on Wed_Sep_21_10:33:58_PDT_2022
     Cuda compilation tools, release 11.8, V11.8.89
     Build cuda_11.8.r11.8/compiler.31833905_0

     ***Python***
     /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/bin/python
     Python 3.9.16

     ***Environment Variables***
     PATH                            : /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39/bin:/home/nfs/charlesb/.local/bin:/home/nfs/charlesb/.vscode-server/bin/4cb974a7aed77a74c7813bdccd99ee0d04901215/bin/remote-cli:/datasets/charlesb/micromamba/condabin:/home/nfs/charlesb/.local/bin:/usr/local/cuda/bin:/opt/bin/:/home/nfs/charlesb/.cargo/bin:/usr/local/cuda/bin:/opt/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
     LD_LIBRARY_PATH                 :
     NUMBAPRO_NVVM                   :
     NUMBAPRO_LIBDEVICE              :
     CONDA_PREFIX                    : /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39
     PYTHON_PATH                     :

     ***conda packages***
     /datasets/charlesb/micromamba/condabin/conda
     # packages in environment at /datasets/charlesb/micromamba/envs/dask-sql-gpuci-py39:
     #
     # Name                    Version                   Build  Channel
     _libgcc_mutex             0.1                 conda_forge    conda-forge
     _openmp_mutex             4.5                       2_gnu    conda-forge
     adagio                    0.2.4              pyhd8ed1ab_0    conda-forge
     alabaster                 0.7.13             pyhd8ed1ab_0    conda-forge
     alembic                   1.11.1             pyhd8ed1ab_0    conda-forge
     antlr-python-runtime      4.11.1             pyhd8ed1ab_0    conda-forge
     antlr4-python3-runtime    4.11.1             pyh1a96a4e_0    conda-forge
     anyio                     3.7.0              pyhd8ed1ab_1    conda-forge
     appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
     asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
     attrs                     23.1.0             pyh71513ae_1    conda-forge
     aws-c-auth                0.6.27               he072965_1    conda-forge
     aws-c-cal                 0.5.26               hf677bf3_1    conda-forge
     aws-c-common              0.8.19               hd590300_0    conda-forge
     aws-c-compression         0.2.16               hbad4bc6_7    conda-forge
     aws-c-event-stream        0.2.20               hb4b372c_7    conda-forge
     aws-c-http                0.7.7                h2632f9a_4    conda-forge
     aws-c-io                  0.13.21              h9fef7b8_5    conda-forge
     aws-c-mqtt                0.8.11               h2282364_1    conda-forge
     aws-c-s3                  0.3.0                hcb5a9b2_2    conda-forge
     aws-c-sdkutils            0.1.9                hbad4bc6_2    conda-forge
     aws-checksums             0.1.14               hbad4bc6_7    conda-forge
     aws-crt-cpp               0.20.2               he0fdcb3_0    conda-forge
     aws-sdk-cpp               1.10.57             h059227d_13    conda-forge
     babel                     2.12.1             pyhd8ed1ab_1    conda-forge
     backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
     backports                 1.0                pyhd8ed1ab_3    conda-forge
     backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
     bcrypt                    3.2.2            py39hb9d737c_1    conda-forge
     binutils                  2.39                 hdd6e379_1    conda-forge
     binutils_impl_linux-64    2.39                 he00db2b_1    conda-forge
     binutils_linux-64         2.39                h5fc0e48_13    conda-forge
     blinker                   1.6.2              pyhd8ed1ab_0    conda-forge
     bokeh                     2.4.3              pyhd8ed1ab_3    conda-forge
     brotli                    1.0.9                h166bdaf_8    conda-forge
     brotli-bin                1.0.9                h166bdaf_8    conda-forge
     bzip2                     1.0.8                h7f98852_4    conda-forge
     c-ares                    1.19.1               hd590300_0    conda-forge
     c-compiler                1.5.2                h0b41bf4_0    conda-forge
     ca-certificates           2023.5.7             hbcca054_0    conda-forge
     cachetools                5.3.0              pyhd8ed1ab_0    conda-forge
     certifi                   2023.5.7           pyhd8ed1ab_0    conda-forge
     cffi                      1.15.1           py39he91dace_3    conda-forge
     cfgv                      3.3.1              pyhd8ed1ab_0    conda-forge
     charset-normalizer        3.1.0              pyhd8ed1ab_0    conda-forge
     ciso8601                  2.3.0            py39h72bdee0_0    conda-forge
     click                     8.1.3           unix_pyhd8ed1ab_2    conda-forge
     cloudpickle               2.2.1              pyhd8ed1ab_0    conda-forge
     colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
     configparser              5.3.0              pyhd8ed1ab_0    conda-forge
     contourpy                 1.0.7            py39h4b4f3f3_0    conda-forge
     coverage                  7.2.7            py39hd1e30aa_0    conda-forge
     cryptography              41.0.1           py39hd4f0224_0    conda-forge
     cubinlinker               0.3.0            py39hac6bf05_0    rapidsai
     cuda-profiler-api         11.8.86                       0    nvidia
     cuda-python               11.8.2           py39h2405124_0    conda-forge
     cuda-version              11.5                 h6c6c5af_2    conda-forge
     cudatoolkit               11.5.1              h59c8dcf_11    conda-forge
     cudf                      23.08.00a       cuda11_py39_230621_g1854ac86d0_115    rapidsai-nightly
     cuml                      23.08.00a       cuda11_py39_230621_g57c17572f_25    rapidsai-nightly
     cupy                      12.0.0           py39hc3c280e_3    conda-forge
     cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
     cytoolz                   0.12.0           py39hb9d737c_1    conda-forge
     dask                      2023.5.1           pyhd8ed1ab_0    conda-forge
     dask-core                 2023.5.1           pyhd8ed1ab_0    conda-forge
     dask-cuda                 23.08.00a       py39_230621_g83c6476_22    rapidsai-nightly
     dask-cudf                 23.08.00a       cuda11_py39_230621_g1854ac86d0_115    rapidsai-nightly
     dask-sql                  2023.6.0+17.g1279ce32          pypi_0    pypi
     databricks-cli            0.17.7             pyhd8ed1ab_0    conda-forge
     deap                      1.3.3            py39h4661b88_1    conda-forge
     decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
     distlib                   0.3.6              pyhd8ed1ab_0    conda-forge
     distributed               2023.5.1           pyhd8ed1ab_0    conda-forge
     dlpack                    0.5                  h9c3ff4c_0    conda-forge
     docker-py                 6.1.0              pyhd8ed1ab_0    conda-forge
     docutils                  0.20.1           py39hf3d152e_0    conda-forge
     entrypoints               0.4                pyhd8ed1ab_0    conda-forge
     exceptiongroup            1.1.1              pyhd8ed1ab_0    conda-forge
     execnet                   1.9.0              pyhd8ed1ab_0    conda-forge
     executing                 1.2.0              pyhd8ed1ab_0    conda-forge
     fastapi                   0.86.0             pyhd8ed1ab_0    conda-forge
     fastrlock                 0.8              py39h5a03fae_3    conda-forge
     filelock                  3.12.0             pyhd8ed1ab_0    conda-forge
     flask                     2.3.2              pyhd8ed1ab_0    conda-forge
     fmt                       9.1.0                h924138e_0    conda-forge
     fonttools                 4.39.4           py39hd1e30aa_0    conda-forge
     freetype                  2.12.1               hca18f0e_1    conda-forge
     fs                        2.4.16             pyhd8ed1ab_0    conda-forge
     fsspec                    2023.5.0           pyh1a96a4e_0    conda-forge
     fugue                     0.8.5              pyhd8ed1ab_0    conda-forge
     fugue-sql-antlr           0.1.6              pyhd8ed1ab_1    conda-forge
     future                    0.18.3             pyhd8ed1ab_0    conda-forge
     gcc                       11.3.0              h02d0930_13    conda-forge
     gcc_impl_linux-64         11.3.0              hab1b70f_19    conda-forge
     gcc_linux-64              11.3.0              he6f903b_13    conda-forge
     gflags                    2.2.2             he1b5a44_1004    conda-forge
     gitdb                     4.0.10             pyhd8ed1ab_0    conda-forge
     gitpython                 3.1.31             pyhd8ed1ab_0    conda-forge
     glog                      0.6.0                h6f12383_0    conda-forge
     gmock                     1.13.0               ha770c72_1    conda-forge
     greenlet                  2.0.2            py39h3d6467e_1    conda-forge
     gtest                     1.13.0               h00ab1b0_1    conda-forge
     gunicorn                  20.1.0           py39hf3d152e_3    conda-forge
     h11                       0.14.0             pyhd8ed1ab_0    conda-forge
     identify                  2.5.24             pyhd8ed1ab_0    conda-forge
     idna                      3.4                pyhd8ed1ab_0    conda-forge
     imagesize                 1.4.1              pyhd8ed1ab_0    conda-forge
     importlib-metadata        6.6.0              pyha770c72_0    conda-forge
     importlib-resources       5.12.0             pyhd8ed1ab_0    conda-forge
     importlib_metadata        6.6.0                hd8ed1ab_0    conda-forge
     importlib_resources       5.12.0             pyhd8ed1ab_0    conda-forge
     iniconfig                 2.0.0              pyhd8ed1ab_0    conda-forge
     intake                    0.7.0              pyhd8ed1ab_0    conda-forge
     ipython                   8.14.0             pyh41d4057_0    conda-forge
     itsdangerous              2.1.2              pyhd8ed1ab_0    conda-forge
     jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
     jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
     joblib                    1.2.0              pyhd8ed1ab_0    conda-forge
     jsonschema                4.17.3             pyhd8ed1ab_0    conda-forge
     kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge
     keyutils                  1.6.1                h166bdaf_0    conda-forge
     kiwisolver                1.4.4            py39hf939315_1    conda-forge
     krb5                      1.20.1               h81ceb04_0    conda-forge
     lcms2                     2.15                 haa2dc70_1    conda-forge
     ld_impl_linux-64          2.39                 hcc3a1bd_1    conda-forge
     lerc                      4.0.0                h27087fc_0    conda-forge
     libabseil                 20230125.2      cxx17_h59595ed_2    conda-forge
     libarrow                  11.0.0          hc00ebf5_25_cpu    conda-forge
     libblas                   3.9.0           17_linux64_openblas    conda-forge
     libbrotlicommon           1.0.9                h166bdaf_8    conda-forge
     libbrotlidec              1.0.9                h166bdaf_8    conda-forge
     libbrotlienc              1.0.9                h166bdaf_8    conda-forge
     libcblas                  3.9.0           17_linux64_openblas    conda-forge
     libcrc32c                 1.1.2                h9c3ff4c_0    conda-forge
     libcublas                 11.11.3.6                     0    nvidia
     libcublas-dev             11.11.3.6                     0    nvidia
     libcudf                   23.08.00a       cuda11_230621_g1854ac86d0_115    rapidsai-nightly
     libcufft                  10.9.0.58                     0    nvidia
     libcufile                 1.4.0.31                      0    nvidia
     libcufile-dev             1.4.0.31                      0    nvidia
     libcuml                   23.08.00a       cuda11_230621_g57c17572f_25    rapidsai-nightly
     libcumlprims              23.08.00a       cuda11_230519_g1751dc9_0    rapidsai-nightly
     libcurand                 10.3.0.86                     0    nvidia
     libcurand-dev             10.3.0.86                     0    nvidia
     libcurl                   8.1.2                h409715c_0    conda-forge
     libcusolver               11.4.1.48                     0    nvidia
     libcusolver-dev           11.4.1.48                     0    nvidia
     libcusparse               11.7.5.86                     0    nvidia
     libcusparse-dev           11.7.5.86                     0    nvidia
     libdeflate                1.18                 h0b41bf4_0    conda-forge
     libedit                   3.1.20191231         he28a2e2_2    conda-forge
     libev                     4.33                 h516909a_1    conda-forge
     libevent                  2.1.12               hf998b51_1    conda-forge
     libffi                    3.4.2                h7f98852_5    conda-forge
     libgcc-devel_linux-64     11.3.0              h210ce93_19    conda-forge
     libgcc-ng                 13.1.0               he5830b7_0    conda-forge
     libgfortran-ng            13.1.0               h69a702a_0    conda-forge
     libgfortran5              13.1.0               h15d22d2_0    conda-forge
     libgomp                   13.1.0               he5830b7_0    conda-forge
     libgoogle-cloud           2.11.0               hac9eb74_1    conda-forge
     libgrpc                   1.54.2               hb20ce57_2    conda-forge
     libjpeg-turbo             2.1.5.1              h0b41bf4_0    conda-forge
     libkvikio                 23.08.00a       cuda11_230621_g56d48ef_23    rapidsai-nightly
     liblapack                 3.9.0           17_linux64_openblas    conda-forge
     libllvm14                 14.0.6               hcd5def8_3    conda-forge
     libnghttp2                1.52.0               h61bc06f_0    conda-forge
     libnsl                    2.0.0                h7f98852_0    conda-forge
     libnuma                   2.0.16               h0b41bf4_1    conda-forge
     libopenblas               0.3.23          pthreads_h80387f5_0    conda-forge
     libpng                    1.6.39               h753d276_0    conda-forge
     libpq                     15.3                 hbcd7760_1    conda-forge
     libprotobuf               3.21.12              h3eb15da_0    conda-forge
     libraft                   23.08.00a       cuda11_230621_g2da93a10_32    rapidsai-nightly
     libraft-headers           23.08.00a       cuda11_230621_g2da93a10_32    rapidsai-nightly
     libraft-headers-only      23.08.00a       cuda11_230621_g2da93a10_32    rapidsai-nightly
     librmm                    23.08.00a       cuda11_230621_ge2122569_18    rapidsai-nightly
     libsanitizer              11.3.0              h239ccf8_19    conda-forge
     libsodium                 1.0.18               h36c2ea0_1    conda-forge
     libsqlite                 3.42.0               h2797004_0    conda-forge
     libssh2                   1.11.0               h0841786_0    conda-forge
     libstdcxx-ng              13.1.0               hfd8a6a1_0    conda-forge
     libthrift                 0.18.1               h8fd135c_2    conda-forge
     libtiff                   4.5.0                ha587672_6    conda-forge
     libutf8proc               2.8.0                h166bdaf_0    conda-forge
     libuuid                   2.38.1               h0b41bf4_0    conda-forge
     libwebp-base              1.3.0                h0b41bf4_0    conda-forge
     libxcb                    1.15                 h0b41bf4_0    conda-forge
     libxgboost                1.7.5dev.rapidsai23.08        cuda11_0    rapidsai-nightly
     libzlib                   1.2.13               h166bdaf_4    conda-forge
     lightgbm                  3.3.5            py39h227be39_0    conda-forge
     llvmlite                  0.40.0           py39h174d805_0    conda-forge
     locket                    1.0.0              pyhd8ed1ab_0    conda-forge
     lz4                       4.3.2            py39h724f13c_0    conda-forge
     lz4-c                     1.9.4                hcb278e6_0    conda-forge
     mako                      1.2.4              pyhd8ed1ab_0    conda-forge
     markdown                  3.4.3              pyhd8ed1ab_0    conda-forge
     markupsafe                2.1.3            py39hd1e30aa_0    conda-forge
     matplotlib-base           3.7.1            py39he190548_0    conda-forge
     matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
     maturin                   1.1.0            py39hd4f0224_0    conda-forge
     mlflow                    2.4.1            py39ha39b057_0    conda-forge
     mock                      5.0.2              pyhd8ed1ab_0    conda-forge
     msgpack-python            1.0.5            py39h4b4f3f3_0    conda-forge
     munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
     nccl                      2.17.1.1             h17a0586_1    conda-forge
     ncurses                   6.4                  hcb278e6_0    conda-forge
     nodeenv                   1.8.0              pyhd8ed1ab_0    conda-forge
     numba                     0.57.0           py39hb75a051_1    conda-forge
     numpy                     1.24.3           py39h6183b62_0    conda-forge
     nvtx                      0.2.5            py39h72bdee0_0    conda-forge
     oauthlib                  3.2.2              pyhd8ed1ab_0    conda-forge
     openjpeg                  2.5.0                hfec8fc6_2    conda-forge
     openssl                   3.1.1                hd590300_1    conda-forge
     orc                       1.8.4                h2f23424_0    conda-forge
     packaging                 23.1               pyhd8ed1ab_0    conda-forge
     pandas                    1.5.3            py39h2ad29b5_1    conda-forge
     paramiko                  3.2.0              pyhd8ed1ab_0    conda-forge
     parso                     0.8.3              pyhd8ed1ab_0    conda-forge
     partd                     1.4.0              pyhd8ed1ab_0    conda-forge
     pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
     pickleshare               0.7.5                   py_1003    conda-forge
     pillow                    9.5.0            py39haaeba84_1    conda-forge
     pip                       23.1.2             pyhd8ed1ab_0    conda-forge
     pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
     platformdirs              3.5.1              pyhd8ed1ab_0    conda-forge
     pluggy                    1.0.0              pyhd8ed1ab_5    conda-forge
     pooch                     1.7.0              pyha770c72_3    conda-forge
     pre-commit                3.3.3              pyha770c72_0    conda-forge
     prometheus_client         0.17.0             pyhd8ed1ab_0    conda-forge
     prometheus_flask_exporter 0.22.4             pyhd8ed1ab_0    conda-forge
     prompt-toolkit            3.0.38             pyha770c72_0    conda-forge
     prompt_toolkit            3.0.38               hd8ed1ab_0    conda-forge
     protobuf                  4.21.12          py39h227be39_0    conda-forge
     psutil                    5.9.5            py39h72bdee0_0    conda-forge
     psycopg2                  2.9.3            py39h24a400a_2    conda-forge
     pthread-stubs             0.4               h36c2ea0_1001    conda-forge
     ptxcompiler               0.8.1            py39h2405124_0    conda-forge
     ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
     pure-sasl                 0.6.2              pyhd8ed1ab_0    conda-forge
     pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
     py-xgboost                1.7.5dev.rapidsai23.08   cuda11_py39_0    rapidsai-nightly
     pyarrow                   11.0.0          py39he4327e9_25_cpu    conda-forge
     pycparser                 2.21               pyhd8ed1ab_0    conda-forge
     pydantic                  1.10.8           py39hd1e30aa_0    conda-forge
     pygments                  2.15.1             pyhd8ed1ab_0    conda-forge
     pyhive                    0.6.5              pyhd8ed1ab_0    conda-forge
     pyjwt                     2.7.0              pyhd8ed1ab_0    conda-forge
     pylibraft                 23.08.00a       cuda11_py39_230621_g2da93a10_32    rapidsai-nightly
     pynacl                    1.5.0            py39hb9d737c_2    conda-forge
     pynvml                    11.4.1             pyhd8ed1ab_0    conda-forge
     pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
     pyrsistent                0.19.3           py39h72bdee0_0    conda-forge
     pysocks                   1.7.1              pyha2e5f31_6    conda-forge
     pytest                    7.3.2              pyhd8ed1ab_1    conda-forge
     pytest-cov                4.1.0              pyhd8ed1ab_0    conda-forge
     pytest-rerunfailures      11.1.2             pyhd8ed1ab_0    conda-forge
     pytest-xdist              3.3.1              pyhd8ed1ab_0    conda-forge
     python                    3.9.16          h2782a2a_0_cpython    conda-forge
     python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
     python_abi                3.9                      3_cp39    conda-forge
     pytz                      2023.3             pyhd8ed1ab_0    conda-forge
     pywin32-on-windows        0.1.0              pyh1179c8e_3    conda-forge
     pyyaml                    6.0              py39hb9d737c_5    conda-forge
     qpd                       0.4.3              pyhd8ed1ab_0    conda-forge
     querystring_parser        1.2.4                      py_0    conda-forge
     raft-dask                 23.08.00a       cuda11_py39_230620_g2da93a10_32    rapidsai-nightly
     rdma-core                 28.9                 h59595ed_1    conda-forge
     re2                       2023.03.02           h8c504da_0    conda-forge
     readline                  8.2                  h8228510_1    conda-forge
     requests                  2.31.0             pyhd8ed1ab_0    conda-forge
     rmm                       23.08.00a       cuda11_py39_230621_ge2122569_18    rapidsai-nightly
     s2n                       1.3.44               h06160fa_0    conda-forge
     scikit-learn              1.2.2            py39hc236052_2    conda-forge
     scipy                     1.10.1           py39h6183b62_3    conda-forge
     semantic_version          2.10.0             pyhd8ed1ab_0    conda-forge
     setuptools                67.7.2             pyhd8ed1ab_0    conda-forge
     setuptools-rust           1.6.0              pyhd8ed1ab_0    conda-forge
     six                       1.16.0             pyh6c4a22f_0    conda-forge
     smmap                     3.0.5              pyh44b312d_0    conda-forge
     snappy                    1.1.10               h9fff704_0    conda-forge
     sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
     snowballstemmer           2.2.0              pyhd8ed1ab_0    conda-forge
     sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
     spdlog                    1.11.0               h9b3ece8_1    conda-forge
     sphinx                    7.0.1              pyhd8ed1ab_0    conda-forge
     sphinxcontrib-applehelp   1.0.4              pyhd8ed1ab_0    conda-forge
     sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
     sphinxcontrib-htmlhelp    2.0.1              pyhd8ed1ab_0    conda-forge
     sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
     sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
     sphinxcontrib-serializinghtml 1.1.5              pyhd8ed1ab_2    conda-forge
     sqlalchemy                1.4.46           py39h72bdee0_0    conda-forge
     sqlglot                   15.0.0             pyhd8ed1ab_0    conda-forge
     sqlparse                  0.4.4              pyhd8ed1ab_0    conda-forge
     stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
     starlette                 0.20.4             pyhd8ed1ab_1    conda-forge
     stopit                    1.1.2                      py_0    conda-forge
     sysroot_linux-64          2.12                he073ed8_15    conda-forge
     tabulate                  0.9.0              pyhd8ed1ab_1    conda-forge
     tblib                     1.7.0              pyhd8ed1ab_0    conda-forge
     threadpoolctl             3.1.0              pyh8a188c0_0    conda-forge
     thrift                    0.18.1           py39h227be39_0    conda-forge
     thrift_sasl               0.4.3              pyhd8ed1ab_2    conda-forge
     tk                        8.6.12               h27826a3_0    conda-forge
     toml                      0.10.2             pyhd8ed1ab_0    conda-forge
     tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
     toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
     tornado                   6.3.2            py39hd1e30aa_0    conda-forge
     tpot                      0.12.0             pyhd8ed1ab_0    conda-forge
     tqdm                      4.65.0             pyhd8ed1ab_1    conda-forge
     traitlets                 5.9.0              pyhd8ed1ab_0    conda-forge
     treelite                  3.2.0            py39h5f9d723_0    conda-forge
     treelite-runtime          3.2.0                    pypi_0    pypi
     triad                     0.9.0              pyhd8ed1ab_0    conda-forge
     typing-extensions         4.6.3                hd8ed1ab_0    conda-forge
     typing_extensions         4.6.3              pyha770c72_0    conda-forge
     tzdata                    2023c                h71feb2d_0    conda-forge
     tzlocal                   5.0.1            py39hf3d152e_0    conda-forge
     ucx                       1.14.1               h4a2ce2d_2    conda-forge
     ucx-proc                  1.0.0                       gpu    rapidsai
     ucx-py                    0.33.00a        py39_230621_g869c3f6_15    rapidsai-nightly
     ukkonen                   1.0.1            py39hf939315_3    conda-forge
     unicodedata2              15.0.0           py39hb9d737c_0    conda-forge
     update_checker            0.18.0             pyh9f0ad1d_0    conda-forge
     urllib3                   2.0.3              pyhd8ed1ab_0    conda-forge
     uvicorn                   0.22.0           py39hf3d152e_0    conda-forge
     virtualenv                20.23.0            pyhd8ed1ab_0    conda-forge
     wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
     websocket-client          1.5.2              pyhd8ed1ab_0    conda-forge
     werkzeug                  2.3.4              pyhd8ed1ab_0    conda-forge
     wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
     xgboost                   1.7.5dev.rapidsai23.08   cuda11_py39_0    rapidsai-nightly
     xorg-libxau               1.0.11               hd590300_0    conda-forge
     xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
     xz                        5.2.6                h166bdaf_0    conda-forge
     yaml                      0.2.5                h7f98852_2    conda-forge
     zict                      3.0.0              pyhd8ed1ab_0    conda-forge
     zipp                      3.15.0             pyhd8ed1ab_0    conda-forge
     zlib                      1.2.13               h166bdaf_4    conda-forge
     zstd                      1.5.2                h3eb15da_6    conda-forge

shwina commented 1 year ago

Thanks @charlesbluca -- the following patch fixes this particular issue for me, but are you able to try it out with some other tests to see if things more or less work? If so, I'll go ahead and make a PR:

diff --git a/python/dask_cudf/dask_cudf/backends.py b/python/dask_cudf/dask_cudf/backends.py
index 378f46de22..e926911364 100644
--- a/python/dask_cudf/dask_cudf/backends.py
+++ b/python/dask_cudf/dask_cudf/backends.py
@@ -6,6 +6,7 @@ from collections.abc import Iterator
 import cupy as cp
 import numpy as np
 import pandas as pd
+from pandas.core.tools.datetimes import is_datetime64tz_dtype
 import pyarrow as pa
 from pandas.api.types import is_scalar

@@ -122,6 +123,11 @@ def _get_non_empty_data(s):
         data = cudf.core.column.as_column(data, dtype=s.dtype)
     elif is_string_dtype(s.dtype):
         data = pa.array(["cat", "dog"])
+    elif is_datetime64tz_dtype(s.dtype):
+        from cudf.utils.dtypes import get_time_unit
+
+        data = cudf.date_range("2001-01-01", periods=2, freq=get_time_unit(s))
+        data = data.tz_localize(str(s.dtype.tz))._column
     else:
         if pd.api.types.is_numeric_dtype(s.dtype):
             data = cudf.core.column.as_column(