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

Calcite tests remove expected exception #16046

Merged

Conversation

kgyrtkirk
Copy link
Member

@kgyrtkirk kgyrtkirk commented Mar 5, 2024

  • update testcases using expectedException to utilize assertThrows instead
  • remove BaseCalciteQueryTest#expectedException
  • fixes cannotVectorize so it doesn't anymore stops further processing
  • msqIncompatible is not anymore toggles a boolean - its an Assume instead

Fixes #15423

This PR has:

  • been self-reviewed.

* update testcases using `expectedException` to utilize `assertThrows` instead
* remove `BaseCalciteQueryTest#expectedException`
* fixes `cannotVectorize` so it doesn't anymore stops further processing
* `msqIncompatible` is not anymore toggles a boolean - its an `Assume` instead

Fixes apache#15423
@kgyrtkirk kgyrtkirk marked this pull request as ready for review March 5, 2024 08:34
@github-actions github-actions bot added Area - Batch Ingestion Area - Querying Area - Dependencies Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Mar 5, 2024
@kgyrtkirk
Copy link
Member Author

failure of jdk11 static checks seem unrelated

Copy link
Contributor

@abhishekrb19 abhishekrb19 left a comment

Choose a reason for hiding this comment

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

Thanks @kgyrtkirk - nice cleanup overall. I left a few suggestions.

ImmutableList.of()
);
});
assertTrue(exception.getMessage().contains("The number of values in the IN clause for [dim6] in query exceeds configured maxNumericFilter limit of [2] for INs. Cast [3] values of IN clause to String"));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you please break this up to accommodate smaller screen length?
Also, please use one consistently between MatcherAssert.assertThat and assertTrue (given assertThat is deprecated).

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 think its better to use static imports than write out the class the actual assert/assume/etc comes from;
if the usecase would require to use 2 of those static imported methods from 2 different sources at the same time I would see differently - but if there is only one then I think it as something which reduces the readability with no added benefit

ImmutableList.of()
);
});
assertTrue(exception.getMessage().contains("__time column"));
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto here and below

@kgyrtkirk
Copy link
Member Author

thank you @abhishekrb19 for taking a look; I plan to later also run
https://docs.openrewrite.org/recipes/java/testing/junit5/usehamcrestassertthat
to get rid of old methods - but I have not seen any differences so far between the assertThat methods

@@ -295,15 +298,11 @@ public static Map<String, Object> getTimeseriesContextWithFloorTime(
public final SqlEngine engine0;
final boolean useDefault = NullHandling.replaceWithDefault();

@Rule(order = 1)
public ExpectedException expectedException = ExpectedException.none();

@Rule(order = 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can also remove the junit rule order or re-order the rules (same applies to @Rule(order = 3) queryFrameworkRule:

Suggested change
@Rule(order = 2)
@Rule

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 agree that these could be changed; however one of the followup changes is to upgrade calcite* tests to junit5 - can we postpone this cleanup to that patch?

@abhishekrb19
Copy link
Contributor

The rule ordering cleanup changes can come in a later patch

@abhishekrb19 abhishekrb19 merged commit 2eb7d7a into apache:master Mar 11, 2024
84 checks passed
@adarshsanjeev adarshsanjeev added this to the 30.0.0 milestone May 6, 2024
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.

interpretation of cannotVectorize in tests may stop further processing of the testcase
3 participants