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

CSV export over REST API leads to NPE #231

Closed
Selvinaz1984 opened this issue Jun 14, 2016 · 11 comments
Closed

CSV export over REST API leads to NPE #231

Selvinaz1984 opened this issue Jun 14, 2016 · 11 comments

Comments

@Selvinaz1984
Copy link

The CSV export functionality over REST API leads to NullPointerException:

{

"error": {
    "root_cause": [
        {
            "type": "null_pointer_exception",
            "reason": null
        }
    ],
    "type": "null_pointer_exception",
    "reason": null
},
"status": ​500

}

@Selvinaz1984
Copy link
Author

Will there be a fix soon?

@shi-yuan
Copy link
Member

shi-yuan commented Jul 23, 2016

Which version? Can you tell me more information?
I use es 2.3.4, no problem.

@Selvinaz1984
Copy link
Author

Hello version 2.3.1.

@Selvinaz1984
Copy link
Author

There is no problem if I use the web UI, but I want to have a csv export over REST api via statement format=csv it leads to nullpointerexecption.

@shi-yuan
Copy link
Member

shi-yuan commented Jul 25, 2016

I try es 2.3.1:
http://localhost:9200/_sql?format=csv&sql=select name from test
no problem.

Can you give me es error logs?

@Selvinaz1984
Copy link
Author

[2016-07-25 13:00:53,282][WARN ][rest.suppressed ] /_sql Params: {format=csv, sql=select * from esh;event;event_0.4;2016-06-20_00-00-00-000;2016-06-26_23-59-59-999 where source.sourceType='VEHICLE'}
java.lang.NullPointerException
at org.elasticsearch.plugin.nlpcn.executors.CSVResultsExtractor.findFieldValue(CSVResultsExtractor.java:300)
at org.elasticsearch.plugin.nlpcn.executors.CSVResultsExtractor.createCSVLinesFromDocs(CSVResultsExtractor.java:248)
at org.elasticsearch.plugin.nlpcn.executors.CSVResultsExtractor.extractResults(CSVResultsExtractor.java:45)
at org.elasticsearch.plugin.nlpcn.executors.CSVResultRestExecutor.execute(CSVResultRestExecutor.java:29)
at org.elasticsearch.plugin.nlpcn.RestSqlAction.handleRequest(RestSqlAction.java:45)
at org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:54)
at org.elasticsearch.rest.RestController.executeHandler(RestController.java:205)
at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:166)
at org.elasticsearch.http.HttpServer.internalDispatchRequest(HttpServer.java:128)
at org.elasticsearch.http.HttpServer$Dispatcher.dispatchRequest(HttpServer.java:86)
at org.elasticsearch.http.netty.NettyHttpServerTransport.dispatchRequest(NettyHttpServerTransport.java:449)
at org.elasticsearch.http.netty.HttpRequestHandler.messageReceived(HttpRequestHandler.java:61)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.elasticsearch.http.netty.pipelining.HttpPipeliningHandler.messageReceived(HttpPipeliningHandler.java:60)
at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:88)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:145)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.jboss.netty.handler.codec.http.HttpContentDecoder.messageReceived(HttpContentDecoder.java:108)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:459)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536)
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:75)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

@Selvinaz1984
Copy link
Author

I Have fixed this bug, it occurrs if the value of the header is null, I have changed the line doc.get(header).toString() to String.valueOf(doc.get(header)). Do I have to make a pull request now?

@shi-yuan
Copy link
Member

Thanks! If you want, you can make a pull request!

@tqyq
Copy link

tqyq commented Sep 19, 2016

issue still exists in 2.3.5
such as:
http://eshost/_sql?sql=select * from symbol where exchange='nyse'&format=csv
data sample:

"_source": {
"sector": "Consumer Services",
"ipo_year": null,
"market_cap": 23671428,
"name": "A.H. Belo Corporation",
"exchange": "nyse",
"symbol": "AHC",
"last_sale": 574,
"industry": "Newspapers/Magazines"
}

you see, ipo_year is null, it outputs:
{ "error": { "root_cause": [ { "type": "null_pointer_exception", "reason": null } ], "type": "null_pointer_exception", "reason": null }, "status": 500 }

@shi-yuan
Copy link
Member

Sorry!I will fix it!

@tqyq
Copy link

tqyq commented Sep 20, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants