Conversation
ad4156b to
9f635ed
Compare
There was a problem hiding this comment.
These if clause seems fragile from changes on Avatica request types (such as new request type), but I'm not sure if there is a better way..
There was a problem hiding this comment.
Agreed, it's a bit fragile, however, that, I'm afraid, is the nature of protobufs. I'm not sure how likely they are to add new request types without significant overhaul to Calcite though
|
@lkm besides my comments above, would you please fix the conflicts? |
361fe79 to
14ebeeb
Compare
|
Thanks for you time, @jihoonson. I've added the spotbugs exclude and documentation for it now. |
14ebeeb to
a64e16b
Compare
clintropolis
left a comment
There was a problem hiding this comment.
Sorry for the delayed review, overall LGTM 👍
We also have ITJdbcQueryTest, it would be useful I think to add coverage for the protobuf endpoint to the integration tests (and pretty easily) by adding additional connection strings, e.g. https://github.com/apache/druid/blob/master/integration-tests/src/test/java/org/apache/druid/tests/query/ITJdbcQueryTest.java#L56 but with the protobuf path and serialization=protobuf, which afaict should control the wire format: https://calcite.apache.org/avatica/docs/client_reference.html
There was a problem hiding this comment.
side note, since we now have avatica stuff as dependencies to this project, it probably makes sense in a follow-up to modify the JSON version to use the types like this is doing instead of deserializing to a map.
There was a problem hiding this comment.
I'm not sure how much there is to gain from that, what are you thinking would be the advantage? Also, looking through it I can't find an easy to use class like ProtobufTranslationImpl for json.
There was a problem hiding this comment.
BTW, I guess the reason would be defensive for the most part, to more strongly type the check so that whenever we upgrade the library, stuff would fail at compile time instead of just fail in strange ways at run time if any of the requests ever change, however unlikely.
Some of the unit tests for the json path are using the avatica types for json to test this area already, so was just thinking since its used as a runtime depend now we could use the expected types for non tests too. But yeah, its definitely not necessary and doesn't provide a lot of gain, nor do I think we should do it in this PR or anything.
There was a problem hiding this comment.
i wonder if this was causing some problem before... looking at other implementations some do check for null on this field, 👍
There was a problem hiding this comment.
nit: I wonder if this test would be better using @RunWith(JUnitParamsRunner.class) with the different handler implementations instead of making it an abstract class
There was a problem hiding this comment.
Would that not make the test harder to read? You mean parameterising each test case? I was going for a lighter touch approach, the abstracted methods are called in setUp, which would then need rewriting
|
very sorry for the delay @lkm, PR lgtm, could you fix up conflicts (again, sorry) and we can get this merged? |
|
@clintropolis Sure. Pushed a bit too early there. Will try to get this fixed up before Friday |
|
@clintropolis I apologise for dragging my feet on this one. I've properly rebased against most recent master now. So it should be good to go |
|
@clintropolis will this be included in the upcoming 0.21 release? Should I provide a backport? |
0.21 branch is already created and we only backport bug and security fixes after the branch has been cut, so this will have to wait until the next release. Since 0.21 was created a few months ago and was delayed by 0.20.1 and 0.20.2 releases, it should be released very soon, but we will probably begin with the 0.22 release within the next month so hopefully it won't be too long. |
|
Alright, I understand. Thanks for the quick response. |
* IMPLY-6556 remove offending settings.xml for intellij inspections * GCS lookup support (apache#11026) * GCS lookup support * checkstyle fix * review comments * review comments * remove unused import * remove experimental from Kinesis with caveats (apache#10998) * remove experimental from Kinesis with caveats * add suggested known issue * spelling fixes * Bump aliyun SDK to 3.11.3 (apache#11044) * Update reset-cluster.md (apache#10990) fixed Error: Could not find or load main class org.apache.druid.cli.Main * Make imply-view-manager non-experimental (apache#316) * Make druid.indexer.task.ignoreTimestampSpecForDruidInputSource default to true, for backwards compat (apache#315) * Add explicit EOF and use assert instead of exception (apache#11041) * Add Calcite Avatica protobuf handler (apache#10543) * bump to latest of same version node and npm versions, bump frontend-maven-plugin (apache#11057) * request logs through kafka emitter (apache#11036) * request logs through kafka emitter * travis fixes * review comments * kafka emitter unit test * new line * travis checks * checkstyle fix * count request lost when request topic is null * IMPLY-6556 map local repository instead .m2 * remove outdated info from faq (apache#11053) * remove outdated info from faq * Add an option for ingestion task to drop (mark unused) all existing segments that are contained by interval in the ingestionSpec (apache#11025) * Auto-Compaction can run indefinitely when segmentGranularity is changed from coarser to finer. * Add option to drop segments after ingestion * fix checkstyle * add tests * add tests * add tests * fix test * add tests * fix checkstyle * fix checkstyle * add docs * fix docs * address comments * address comments * fix spelling * Allow list for JDBC connection properties to address CVE-2021-26919 (apache#11047) * Allow list for JDBC connection properties to address CVE-2021-26919 * fix tests for java 11 * Fix compile issue from dropExisting in ingest-service (apache#320) Co-authored-by: Slava Mogilevsky <triggerwoods91@gmail.com> Co-authored-by: Parag Jain <pjain1@apache.org> Co-authored-by: Charles Smith <38529548+techdocsmith@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: frank chen <frank.chen021@outlook.com> Co-authored-by: Tushar Raj <43772524+tushar-1728@users.noreply.github.com> Co-authored-by: Jonathan Wei <jon-wei@users.noreply.github.com> Co-authored-by: Jihoon Son <jihoonson@apache.org> Co-authored-by: Lasse Krogh Mammen <lkm@bookboon.com> Co-authored-by: Clint Wylie <cwylie@apache.org> Co-authored-by: Maytas Monsereenusorn <maytasm@apache.org>
Description
Druid hadn't implemented the
AvaticaProtobufHandlerand only supported Json serialisation for Avatica connections. Protocol buffers have much less overhead than Json and thus I would expect the transfer rate to be increased when using it. I'll try to build some benchmarking tools to test this, circumstantial evidence from test suites seems to indicate a speed increase:As a side note, for the officially supported Avatica Golang driver there isn't any Json serialisation support and thus will only work with this patch.
I was forced to add
org.apache.calcite.avaticato druid-server in order to parse the pb messages and retrieve the connection id. The connection id is used to stabilise the choice of brokers when the request goes through the router.One further note, I've chosen to add another url (
/druid/v2/sql/avatica-pb/) for protocol buffers, ideally it would simply be controlled with acontent-type, that is unfortunately not implemented in the JDBC driver so it will not work for the time being, however, the aforementioned golang driver does send content-type asapplication/x-google-protobuf.Fixed the bug ...
Renamed the class ...
Added a forbidden-apis entry ...
This PR has: