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

Minor fixes and enhancements in UnionQuery handling #17483

Merged
merged 111 commits into from
Nov 28, 2024

Conversation

kgyrtkirk
Copy link
Member

@kgyrtkirk kgyrtkirk commented Nov 15, 2024

Fixes some union related issues

  • plan consistently with either UnionDataSource or UnionQuery for decoupled mode
  • expose errors
  • move decoupled related setting from PlannerConfig to QueryContexts

@kgyrtkirk kgyrtkirk marked this pull request as ready for review November 21, 2024 13:49
@github-actions github-actions bot added Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Nov 21, 2024
Copy link
Contributor

@imply-cheddar imply-cheddar left a 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()
Copy link
Contributor

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?

Copy link
Member Author

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()
Copy link
Contributor

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"

Copy link
Member Author

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

Comment on lines +512 to +514
if (queryContext().isDecoupledMode()) {
throw InvalidSqlInput.exception(formatText, arguments);
}
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Member Author

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.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: InvalidSqlInput

@kgyrtkirk kgyrtkirk changed the title Decouple union fixes Minor fixes and enhancements in UnionQuery handling Nov 28, 2024
@kgyrtkirk kgyrtkirk merged commit c1ef38b into apache:master Nov 28, 2024
83 checks passed
@adarshsanjeev adarshsanjeev added this to the 32.0.0 milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area - Batch Ingestion Area - Dependencies Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 Area - Querying
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants