-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Minor fixes and enhancements in UnionQuery handling #17483
Conversation
...core/multi-stage-query/src/test/java/org/apache/druid/msq/test/CalciteUnionQueryMSQTest.java
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just had a few comments/questions, nothing worth blocking the PR on, so approving.
@@ -62,13 +62,12 @@ protected QueryTestBuilder testBuilder() | |||
*/ | |||
@Test | |||
@Override | |||
public void testUnionIsUnplannable() | |||
public void testUnionIsUnplannableInNative() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the name change, why does this evaluate native-only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the original wording have made me end up with an unfortunate name; renamed it to testUnionDifferentColumnOrder
@@ -372,6 +372,20 @@ public void testDefaultEnableQueryDebugging() | |||
assertTrue(QueryContext.of(ImmutableMap.of(QueryContexts.ENABLE_DEBUG, true)).isDebug()); | |||
} | |||
|
|||
@Test | |||
public void testDefaultIsDecoupled() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps also test what happens when a completely different, random value is set. Like "bilyBob"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the testcase:
- renamed it to
testIsDecoupled
- added check for when its set to
garbage
I'm not sure what are the gains of having this as a string based setting;
I don't think it will have more variations...
it could be a boolean with the name like decoupledMode
if (queryContext().isDecoupledMode()) { | ||
throw InvalidSqlInput.exception(formatText, arguments); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not have a "DecoupledPlannerContext" or something that just overrides this method and throws the exception instead of checks the context? I don't actually know where the PlannerContext is created, so no clue how hard/easy it is to do it, but this check feels ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this whole class should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryContext
is passed as a Map
instead of QueryContext
I'll do this as a separate change
@@ -53,6 +53,9 @@ public DruidUnion( | |||
boolean all) | |||
{ | |||
super(cluster, traits, hints, inputs, all); | |||
if (!all) { | |||
throw InvalidInput.exception("SQL requires 'UNION' but only 'UNION ALL' is supported."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: InvalidSqlInput
Fixes some union related issues
UnionDataSource
orUnionQuery
for decoupled modePlannerConfig
toQueryContexts