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

chore: removing Druid from front- and back- end #20338

Conversation

AAfghahi
Copy link
Member

@AAfghahi AAfghahi commented Jun 9, 2022

SUMMARY

This is the first pass at the Druid specific conditionals.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Jun 9, 2022

Codecov Report

Merging #20338 (4be9f7e) into master (4bfa622) will increase coverage by 0.02%.
The diff coverage is 81.25%.

@@            Coverage Diff             @@
##           master   #20338      +/-   ##
==========================================
+ Coverage   66.84%   66.86%   +0.02%     
==========================================
  Files        1754     1753       -1     
  Lines       65731    65664      -67     
  Branches     6950     6921      -29     
==========================================
- Hits        43940    43909      -31     
+ Misses      20028    19997      -31     
+ Partials     1763     1758       -5     
Flag Coverage Δ
hive 53.79% <ø> (+<0.01%) ⬆️
javascript 51.85% <81.25%> (+0.01%) ⬆️
mysql 82.42% <ø> (+0.01%) ⬆️
postgres 82.50% <ø> (+0.01%) ⬆️
presto 53.65% <ø> (+<0.01%) ⬆️
python 82.93% <ø> (+0.01%) ⬆️
sqlite 82.28% <ø> (+0.01%) ⬆️
unit 50.78% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ckages/superset-ui-chart-controls/src/constants.ts 100.00% <ø> (ø)
...perset-ui-chart-controls/src/sections/sections.tsx 100.00% <ø> (ø)
...et-ui-chart-controls/src/shared-controls/index.tsx 51.26% <ø> (-0.41%) ⬇️
...ges/superset-ui-core/src/query/buildQueryObject.ts 100.00% <ø> (ø)
...ges/superset-ui-core/src/query/extractTimegrain.ts 100.00% <ø> (ø)
...kages/superset-ui-core/src/query/getMetricLabel.ts 100.00% <ø> (ø)
...kages/superset-ui-core/src/query/processFilters.ts 91.66% <ø> (-8.34%) ⬇️
...ages/superset-ui-core/src/query/types/Dashboard.ts 100.00% <ø> (ø)
...superset-ui-core/src/query/types/PostProcessing.ts 100.00% <ø> (ø)
...packages/superset-ui-core/src/query/types/Query.ts 100.00% <ø> (ø)
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4bfa622...4be9f7e. Read the comment docs.

@AAfghahi AAfghahi force-pushed the arash.afghahi/sc-46372/remove-native-druid-nosql-from-the-codebase branch 2 times, most recently from 4ae9553 to c37253c Compare June 9, 2022 19:50
superset/charts/schemas.py Outdated Show resolved Hide resolved
superset/utils/core.py Outdated Show resolved Hide resolved
superset/viz.py Outdated Show resolved Hide resolved
Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

looking good so far.. thanks @AAfghahi!

@AAfghahi AAfghahi force-pushed the arash.afghahi/sc-46372/remove-native-druid-nosql-from-the-codebase branch 5 times, most recently from 894428b to 4ef250e Compare June 9, 2022 21:04
Comment on lines -118 to -131
{
expressionType: 'SIMPLE',
clause: 'HAVING',
subject: 'sweetness',
operator: '>',
comparator: '0',
},
{
expressionType: 'SIMPLE',
clause: 'HAVING',
subject: 'sweetness',
operator: '<=',
comparator: '50',
},
Copy link
Member

Choose a reason for hiding this comment

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

Are these Druid specific?

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 so, because it maps to a field called DRUID_ONLY_OPERATORS however they seem like relatively normal operators to have.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, right, I think expressionType=SIMPLE is Druid-only.

Comment on lines 141 to 143
return !(
(props.datasource.type === 'druid' &&
TABLE_ONLY_OPERATORS.indexOf(operator) >= 0) ||
(props.datasource.type === 'table' &&
DRUID_ONLY_OPERATORS.indexOf(operator) >= 0) ||
(props.adhocFilter.clause === CLAUSES.HAVING &&
HAVING_OPERATORS.indexOf(operator) === -1)
props.adhocFilter.clause === CLAUSES.HAVING &&
HAVING_OPERATORS.indexOf(operator) === -1
Copy link
Member

Choose a reason for hiding this comment

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

Might be cleaner to write as:

return (
    props.adhocFilter.clause !== CLAUSES.HAVING ||
    HAVING_OPERATORS.indexOf(operator) !== -1
);

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 like that thank you!

Copy link
Member

Choose a reason for hiding this comment

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

You can always replace !(a && b) with !a || !b, and in this case I think it makes it easier to follow the logic.

Comment on lines -1754 to -1786
rejected.append(
{
"reason": ExtraFiltersReasonType.NOT_DRUID_DATASOURCE,
"column": ExtraFiltersTimeColumnType.GRANULARITY,
}
)
Copy link
Member

Choose a reason for hiding this comment

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

We should keep this, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

just the else?

Copy link
Member

Choose a reason for hiding this comment

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

Right, the else.

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe not, ExtraFiltersReasonType.NOT_DRUID_DATASOURCE suggests that this whole part of the code is Druid 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.

Thinking about it more, I feel as though these two are pretty druid specific.

Comment on lines 1740 to 1741
# This seems like it is to do with the druid time series, which I think we
# are still keeping mentions of.
Copy link
Member

Choose a reason for hiding this comment

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

Can you clarify this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! This was a misunderstanding from earlier today. I thought that we were keeping druid_time_origin and we are not.

@AAfghahi AAfghahi requested a review from a team as a code owner June 9, 2022 22:10
@AAfghahi AAfghahi force-pushed the arash.afghahi/sc-46372/remove-native-druid-nosql-from-the-codebase branch 6 times, most recently from 7e20efc to 5970ca3 Compare June 10, 2022 16:45
@@ -23,7 +23,7 @@ import { TimeGranularity } from '../time-format';

export default function extractTimegrain(
formData: QueryFormData,
): TimeGranularity | undefined {
): TimeGranularity | undefined | string {
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 am not excited about changing this to include strings, even though it seems to be pretty 50/50 in the codebase. Is it worth to go through and refactor the string portions @eschutho

@AAfghahi AAfghahi force-pushed the arash.afghahi/sc-46372/remove-native-druid-nosql-from-the-codebase branch 4 times, most recently from 21b18d0 to 4957d61 Compare June 10, 2022 19:57
@AAfghahi
Copy link
Member Author

AAfghahi commented Jul 6, 2022

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2022

@AAfghahi Ephemeral environment spinning up at http://35.89.28.211:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@AAfghahi AAfghahi force-pushed the arash.afghahi/sc-46372/remove-native-druid-nosql-from-the-codebase branch from 9cf6d6a to 9241875 Compare July 6, 2022 17:09
Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

code looks good. Thanks @AAfghahi! Let's see if @jinghua-qa is available to QA before merging.

@zhaoyongjie zhaoyongjie self-requested a review July 7, 2022 09:00
@zhaoyongjie
Copy link
Member

@AAfghahi the superset-ui/core should make 100% code coverage. the #58 in processFilters.ts needs some test coverage. Oneline checks code coverage locally

$ npx jest --coverage --collectCoverageFrom='["packages/**/src/**/*.{js,ts}", "!packages/superset-ui-demo/**/*"]' packages

image

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

Thanks for the hard work. This PR makes a lot of work easier.

Comment on lines 51 to 54
expect(isSavedMetric(adhocMetricSQL)).toEqual(false);
expect(isSavedMetric(null)).toEqual(false);
expect(isSavedMetric(undefined)).toEqual(false);
expect(isSavedMetric(adhocMetricSQL as QueryFormMetric)).toEqual(false);
expect(isSavedMetric(null as unknown as QueryFormMetric)).toEqual(false);
expect(isSavedMetric(undefined as unknown as QueryFormMetric)).toEqual(false);
Copy link
Member

Choose a reason for hiding this comment

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

the type of argument(metric) is any, so no needs as QueryFormMetric

export function isSavedMetric(metric: any): metric is SavedMetric {
  return typeof metric === 'string';
}

@@ -19,10 +19,8 @@
export * from './Datasource';
export * from './Column';
export * from './Filter';
export * from './Metric';
Copy link
Member

Choose a reason for hiding this comment

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

should keep this line.

@AAfghahi AAfghahi force-pushed the arash.afghahi/sc-46372/remove-native-druid-nosql-from-the-codebase branch from 566505d to 460cbdf Compare July 7, 2022 14:51
@AAfghahi AAfghahi force-pushed the arash.afghahi/sc-46372/remove-native-druid-nosql-from-the-codebase branch from c9fd6b3 to 4be9f7e Compare July 7, 2022 14:56
@AAfghahi
Copy link
Member Author

AAfghahi commented Jul 7, 2022

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2022

@AAfghahi Ephemeral environment spinning up at http://35.89.191.195:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@andrey-zayats
Copy link

QA tested and verified. LGTM

@hughhhh hughhhh merged commit 0ce0c6e into master Jul 8, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

Ephemeral environment shutdown and build artifacts deleted.

akshatsri pushed a commit to charan1314/superset that referenced this pull request Jul 19, 2022
* first pass at removing native Druid nosql

* removing having_druid

* addressing comments, linting

* fixed all tests

* addressing comments

* redirected to ui-core TimeGranularity type

* query form metric linting

* fixed broken chart type

* implementing feedback
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the arash.afghahi/sc-46372/remove-native-druid-nosql-from-the-codebase branch March 26, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/XL 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants