Skip to content

Commit

Permalink
Add pa date64/time64('ns') to the supported list
Browse files Browse the repository at this point in the history
  • Loading branch information
jmao-denver committed Sep 11, 2024
1 parent 4b8e20f commit a8971aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
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

0 comments on commit a8971aa

Please sign in to comment.