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

SQL: Router is not SQL aware #4683

Closed
gianm opened this issue Aug 11, 2017 · 7 comments
Closed

SQL: Router is not SQL aware #4683

gianm opened this issue Aug 11, 2017 · 7 comments

Comments

@gianm
Copy link
Contributor

gianm commented Aug 11, 2017

The router redirects /druid/v2/sql/ to /druid/v2/ and so JSON-over-HTTP SQL queries do not work. I bet something similar applies to the Avatica route at /druid/v2/sql/avatica/.

The router should become aware of SQL. I'm not sure how this will fit in with the router's query-aware routing capabilities, since lacks the SQL metadata infrastructure that the broker uses to plan and understand SQL queries. Maybe the query-aware routing won't apply to SQL at first?

@gianm gianm added the Bug label Aug 11, 2017
@gianm gianm added this to the 0.11.0 milestone Aug 11, 2017
@randerzander
Copy link

The calcite-druid JDBC driver hasn't worked for me, so I'm hoping Druid's native SQL HTTP API gives my app a path forward.

Is there a workaround for this, perhaps a temporary patch to the query router? If you can point to a starting point, I could try to contribute a fix.

@gianm
Copy link
Contributor Author

gianm commented Sep 5, 2017

@randerzander, I take it you're using the Druid Router? (Druid SQL does work fine against the Broker)

The changes would need to start in AsyncQueryForwardingServlet. There's a part that assumes any request like POST /druid/v2* is a Druid native query. It's not a good assumption though, since /druid/v2/sql/ would be a Druid SQL query, not a Druid native query.

@randerzander
Copy link

Hi @gianm, are the docs here out of date? I tried the curl example query but get 405s:

curl -XPOST -H'Content-Type: application/json' http://localhost:8082/druid/v2/sql/ -d '{"query":"SELECT COUNT(*) FROM data_source"}'

  • About to connect() to localhost port 8082 (#0)
  • Trying 127.0.0.1...
  • Connected to localhost (127.0.0.1) port 8082 (#0)

POST /druid/v2/sql/ HTTP/1.1
User-Agent: curl/7.29.0
Host: localhost:8082
Accept: /
Content-Type: application/json
Content-Length: 44

  • upload completely sent off: 44 out of 44 bytes
    < HTTP/1.1 405 Method Not Allowed
    < Date: Wed, 20 Sep 2017 12:14:55 GMT
    < Allow: DELETE,OPTIONS
    < Content-Length: 0
    < Server: Jetty(9.3.19.v20170502)
    <
  • Connection #0 to host localhost left intact

@gianm
Copy link
Contributor Author

gianm commented Sep 21, 2017

@randerzander You might need to set druid.sql.enable = true to get SQL up and running. See http://druid.io/docs/latest/querying/sql.html for details on that.

@gianm gianm modified the milestones: 0.11.0, 0.11.1 Sep 21, 2017
@randerzander
Copy link

@gianm , thanks for the suggestion!

For future reference for others, I followed the docs and configured the druid.sql.* properties in $DRUID_HOME/conf/druid/runtime.properties, but my environment was running using the settings in $DRUID_HOME/conf-quickstart instead which confused things for awhile.

@gianm
Copy link
Contributor Author

gianm commented Oct 11, 2017

@randerzander great to hear!

@gianm
Copy link
Contributor Author

gianm commented Oct 11, 2017

Fixed by #4851.

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

No branches or pull requests

2 participants