Comments (7)
Never checked on CentOS, but I failed to reproduce manually on a Mac with Python 3.7.6 (Clang 11.0.0) using the 0.2.0 release.
The CI runs the tests on Ubuntu and Mac (with 3.6, 37, 3.8).
platform darwin-- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1 -- /usr/local/opt/bin/python3.7
cachedir: .pytest_cache
rootdir: /Users/noirello/pyorc
collected 11 items
tests/test_writer.py::test_write_primitive_type[string-values0] PASSED
tests/test_writer.py::test_write_primitive_type[binary-values1] PASSED
tests/test_writer.py::test_write_primitive_type[int-values2] PASSED
tests/test_writer.py::test_write_primitive_type[bigint-values3] PASSED
tests/test_writer.py::test_write_primitive_type[float-values4] PASSED
tests/test_writer.py::test_write_primitive_type[double-values5] PASSED
tests/test_writer.py::test_write_primitive_type[boolean-values6] PASSED
tests/test_writer.py::test_write_primitive_type[timestamp-values7] PASSED
tests/test_writer.py::test_write_primitive_type[date-values8] PASSED
tests/test_writer.py::test_write_primitive_type[decimal(10,7)-values9] PASSED
tests/test_writer.py::test_write_primitive_type[decimal(38,6)-values10] PASSED
You can create an own Date converters and change the default one. A converter that prints the input params before converting them to the Writer/Reader can give us more insights what goes wrong.
from pyorc.
I added print statements to the date converter. I believe that the issue is a timezone issue. The input was correct, however, the return is causing an issue. Here's a simple python script that illustrates the issue:
from datetime import datetime, date, timezone
print(datetime.fromtimestamp(0))
print(datetime.fromtimestamp(0, timezone.utc))
print(date.fromtimestamp(0))
with the output from my machine:
1969-12-31 19:00:00
1970-01-01 00:00:00+00:00
1969-12-31
In converters.py, in the timestamp converter, the from_orc function is passing timezone.utc to the fromtimestamp function. Ideally, we would do the same in the date converter, however, date's fromtimestamp function does not support passing in a timezone. I changed the from_orc function in the date converter to:
return datetime.fromtimestamp(days * 24 * 60 * 60, timezone.utc).date()
and then the tests started passing for me.
from pyorc.
Note that if the machine that you run the tests on is on utc, then you wouldn't see this problem because the local time and utc would be the same thing.
from pyorc.
Thank you for looking into it.
All of my test runs were in timezones with non-negative UTC offsets. I should fix that.
For solution, I'm planning to leave out the fromtimestamp
method entirely, and add timedelta days to the epoch date. Thus the from_orc
will be similar to its to_orc
counterpart.
from pyorc.
Awesome! Thanks!
from pyorc.
Can you create a new release with this fix?
from pyorc.
Done. Sorry for taking so long.
from pyorc.
Related Issues (20)
- How to edit the readme document? HOT 1
- Support for missing values in integer types HOT 2
- Installation on clean pypy3 environment fails: pybind11 missing HOT 5
- Reader can filter HOT 6
- pyorc.errors.ParseError: Footer is corrupt: types(1701470799) not exists HOT 2
- Invalid orc version
- Private Network Build HOT 2
- Possible to control filesize ? HOT 1
- Support for timestamp with local time zone HOT 2
- Add support to release Linux aarch64 wheels
- PyPI release for pyorc with orc v1.7.0 HOT 4
- set_metadata() casts to str() HOT 2
- Rec skips during sequencial reads HOT 2
- predicate to skip rows doesn't seem to work for timestamps HOT 6
- Apple Silicon Support? HOT 3
- can't find '__main__' module HOT 3
- orc Minimum is error? HOT 3
- Cannot install pyorc on Mac M1 HOT 2
- Please make python 3.11 wheels available from pypi HOT 1
- handle uniontype HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyorc.