postman - 使用 Postman 查询 Apache Druid
问题描述
我部署了 Apache Druid 0.21 并提取了 Wikipedia 示例数据以使用 SQL 对其进行查询。当我尝试像这样使用 curl 查询它时,它工作正常并且我获得了行数:
curl -X 'POST' -H 'Content-Type:application/json' -d "{\"query\":\"select count(*) from wikipedia\"}" http://localhost:8888/druid/v2/sql
当我在 Postman (8.5.1) 上尝试相同的查询时,即使用以下主体作为“原始”JSON 数据执行 POST 请求:
{
"query": "select count(*) from wikipedia"
}
我在 Druid 代理日志中出现 500 错误并显示以下错误消息:
WARN [qtp52477555-156] org.eclipse.jetty.server.HttpChannel - /druid/v2/sql
java.lang.NullPointerException: null
at org.apache.druid.sql.http.SqlResource.doPost(SqlResource.java:92) ~[druid-sql-0.21.0.jar:0.21.0]
at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_221]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_221]
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) ~[jersey-server-1.19.3.jar:1.19.3]
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) ~[jersey-server-1.19.3.jar:1.19.3]
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) ~[jersey-server-1.19.3.jar:1.19.3]
有趣的是,当我从 Postman 获取代码片段并在终端窗口中尝试时,它运行良好:
curl --location --request POST 'localhost:8888/druid/v2/sql' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": "select count(*) from wikipedia"
}'
我也尝试过使用 SOAP UI,它工作正常。
知道出了什么问题吗?是邮递员还是德鲁伊?
谢谢 - 克里斯蒂安
解决方案
推荐阅读
- .net - System.ComponentModel.Win32Exception(2):没有那个文件或目录
- c# - 将 .NET Framework 项目升级到 .NET 5 时,将业务逻辑迁移到 .NET Standard 2.0 作为中间地带是否有意义?
- windows - 未找到 wmic 终止进程
- javascript - Vuejs 3 和 laravel:组件缺少模板或渲染功能
- r - 当一列具有重复字符串时,如何合并 R 数据框中的两行(或多行)?
- machine-learning - 是否应该将确定性模型训练拆分为训练数据集、测试数据集?
- ios - 将存档发送到 App Store Connect 时出错
- reactjs - material-ui dropzone 文件在验证时拒绝
- node.js - Mongoose 聚合图
- python - 如何合并和求和多索引数据帧