Skip to content

Py4JJavaError: An error occurred while calling o2.iterator. #1

@Vimos

Description

@Vimos

Hi, I am trying to read an orc file.

In [1]: from orcreader import OrcReader
   ...: reader = OrcReader('dt=2017-05-14_os=android_part=000004_0')
   ...: reader.open()
   ...: 

I have successfully get the schema like this

In [3]: reader.schema()
Out[3]: 
OrderedDict([(u'log_id', u'string'),
             (u'city_id', u'string'),
             (u'city_name', u'string'),
             (u'city_name_en', u'string'),
             (u'province_id', u'string'),
             (u'province_name', u'string'),
 ...  
             (u'activity_flag', u'string')])

But when I am trying to read rows, it reports the following error

In [2]: for row in reader:
   ...:     print row
   ...:     
---------------------------------------------------------------------------
Py4JJavaError                             Traceback (most recent call last)
<ipython-input-2-df0cbab3b6b5> in <module>()
----> 1 for row in reader:
      2     print row
      3 

/usr/local/lib/python2.7/dist-packages/python_orc-0.0.1-py2.7.egg/orcreader/reader.pyc in __iter__(self)
     79 
     80     def __iter__(self):
---> 81         return OrcRecordIterator(self.reader.iterator())
     82 
     83     def __enter__(self):

/usr/local/lib/python2.7/dist-packages/py4j-0.10.4-py2.7.egg/py4j/java_gateway.pyc in __call__(self, *args)
   1131         answer = self.gateway_client.send_command(command)
   1132         return_value = get_return_value(
-> 1133             answer, self.gateway_client, self.target_id, self.name)
   1134 
   1135         for temp_arg in temp_args:

/usr/local/lib/python2.7/dist-packages/py4j-0.10.4-py2.7.egg/py4j/protocol.pyc in get_return_value(answer, gateway_client, target_id, name)
    317                 raise Py4JJavaError(
    318                     "An error occurred while calling {0}{1}{2}.\n".
--> 319                     format(target_id, ".", name), value)
    320             else:
    321                 raise Py4JError(

Py4JJavaError: An error occurred while calling o2.iterator.
: java.lang.RuntimeException: Unable to init iterator
	at com.pythonorc.SimplifiedOrcReader.iterator(SimplifiedOrcReader.java:72)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
	at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
	at py4j.Gateway.invoke(Gateway.java:280)
	at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
	at py4j.commands.CallCommand.execute(CallCommand.java:79)
	at py4j.GatewayConnection.run(GatewayConnection.java:214)
	at java.lang.Thread.run(Thread.java:748)

Any suggestions on how to debug this error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions