Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add pyarrow date64/time64('ns') to the list of supported Arrow data types in the Python client #6048

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions py/client/pydeephaven/_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
pa.time32('s'): '',
pa.time32('ms'): '',
pa.time64('us'): '',
pa.time64('ns'): '',
pa.time64('ns'): 'java.time.LocalTime',
pa.timestamp('s'): '',
pa.timestamp('ms'): '',
pa.timestamp('us'): '',
pa.timestamp('ns'): 'java.time.Instant',
pa.date32(): '',
pa.date64(): '',
pa.date64(): 'java.time.LocalDate',
pa.duration('s'): '',
pa.duration('ms'): '',
pa.duration('us'): '',
Expand Down
17 changes: 14 additions & 3 deletions py/client/tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def test_import_table_long_csv(self):
df = pa_table2.to_pandas()
self.assertEquals(1000, len(df.index))

@unittest.skip("GH ticket filed #941.")
def test_import_table_time64(self):
pa_array = pa.array([1, 2], type=pa.time64('ns'))
pa_record_batch = pa.RecordBatch.from_arrays([pa_array], names=['f1'])
Expand Down Expand Up @@ -187,8 +186,8 @@ def test_import_table_strings(self):
self.assertEqual(0, len(exception_list))

@unittest.skip("GH ticket filed #941.")
def test_import_table_dates(self):
types = [pa.date32(), pa.date64()]
def test_import_table_date32(self):
types = [pa.date32()]
exception_list = []
for t in types:
pa_array = pa.array([1245, 123456], type=t)
Expand All @@ -203,6 +202,18 @@ def test_import_table_dates(self):

self.assertEqual(0, len(exception_list))

def test_import_table_date64(self):
from datetime import datetime
pa_date1 = pa.scalar(datetime(2012, 1, 1), type=pa.date64())
pa_date2 = pa.scalar(datetime(2022, 11, 11), type=pa.date64())
pa_array = pa.array([pa_date1, pa_date2], type=pa.date64())

pa_record_batch = pa.RecordBatch.from_arrays([pa_array], names=['f1'])
pa_table = pa.Table.from_batches([pa_record_batch])
new_table = self.session.import_table(pa_table)
pa_table2 = new_table.to_arrow()
self.assertEqual(pa_table, pa_table2)

def test_input_table(self):
pa_types = [
pa.bool_(),
Expand Down