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

Fix druid-jdbc issues #42653

Merged
merged 149 commits into from
May 21, 2024
Merged

Fix druid-jdbc issues #42653

merged 149 commits into from
May 21, 2024

Conversation

metamben
Copy link
Contributor

Fixes #42237.

kamilmielnik and others added 30 commits February 6, 2024 13:35
* shortcut to introduce report_card.type. WIP

* major test fixes

* test fixes

* docs and test fixes

* revision for type

* Add type property to Card

* Add type property to CardCompletionItem

* Revert "Add type property to CardCompletionItem"

This reverts commit 3c2db2a.

* Use "type" attribute to create a model in tests

* test fixes and some of Chris's suggestions

* test fixes and add revision migration

* we shouldn't dissoc dataset on migration

* warn if type not found when trying to ensure type and datset consistency

* default value for type when create card

* no need to comment out in tests

* Use "type" attribute to create a model in tests

* Refactor cy.createNativeQuestion & cy.createQuestion to use "type" instead "dataset" option

* Rename type to queryType

* Rename entityType to type

* Improve JSDoc

* Consolidate conditions

* Fix missing "type" attribute

* Revert whitespace change

* Fix typing

* om well, what's :or?

* okay makes the :dataset works

* Introduce Question.prototype.setType

* Use Question.prototype.setType instead of Question.prototype.setDataset

* Deprecate Question.prototype.setType

* Inline Question.prototype.type

* Introduce new Question.prototype.type

* Type _setDataset

* Use Question.prototype.type instead of Question.prototype.isDataset

* Remove Question.prototype.isDataset

* Use nullish coalescing operator

* Use nullish coalescing operator

* Make "type" a writable property

* Fix leftover isDataset usage

* Use "type" instead of "dataset" in unit tests

* Use "type" instead of "dataset" when generating URLs

* Use "type" instead of "dataset" in unit tests

* Deprecate Card["dataset"]

* Revert "Use "type" instead of "dataset" in unit tests"

This reverts commit 4e04410.

* Revert "Use "type" instead of "dataset" when generating URLs"

This reverts commit e3bb570.

* Revert "Use "type" instead of "dataset" in unit tests"

This reverts commit ec23a51.

* Revert "Fix leftover isDataset usage"

This reverts commit 6e85b8c.

* Revert "Remove Question.prototype.isDataset"

This reverts commit eb152dd.

* Revert "Use Question.prototype.type instead of Question.prototype.isDataset"

This reverts commit 229ef6c.

* Deprecate Question.prototype.isDataset

* Make Question.prototype._setDataset private

* fix change turn to model does not change type

* Chris's suggestisons

* remove debug code

* Update 001_update_migrations.yaml

* s/datset/dataset

* Fix building ad-hoc questions based on models

* unparlalle test

* migration indents

* revision migration optimize for postgres and mysql

* Cal's suggestions

* grammar

* move type and dataset check to model

* use ensure-type-and-dataset-are-consistent on create-card

* Add "metric" CardType

* Mock create & update question endpoints

* Mock get & list question endpoints

* Fix casing

* Disable metrics mocks in tests to make CI green

* Disable mocks when cypress is active and in prod build

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
* Add new `metric` item to the menu

* Add dummy route `/metric/query`

* Open new metric in a notebook mode

* Initialize new metric URL programatically using the existing helper
* Migrate Question.prototype.isDataset in hasQuestionCacheSection

* Migrate Question.prototype.isDataset in metabase-enterprise/moderation

* Migrate Question.prototype.isDataset in ModelDetailPage

* Migrate Question.prototype.isDataset in navigateToNewCardFromDashboard

* Migrate Question.prototype.isDataset in handleQBInit

* Migrate Question.prototype.isDataset in Visualization

* Migrate Question.prototype.isDataset in QueryModals

* Migrate Question.prototype.isDataset in QuestionPane

* Migrate Question.prototype.isDataset in ObjectDetailView

* Migrate Question.prototype.isDataset in ArchiveQuestionModal

* Migrate Question.prototype.isDataset in Question.prototype.composeDataset

* Migrate Question.prototype.isDataset in getNativeQueryTable

* Migrate Question.prototype.isDataset in ViewFooter

* Convert SavedQuestionIntroModal to TS

* Migrate Question.prototype.isDataset in SavedQuestionIntroModal

* Migrate Question.prototype.isDataset in QuestionMoveToast

* Migrate Question.prototype.isDataset in QuestionInfoSidebar

* Fix QuestionMoveToast usage

* Fix unit tests

* Fix unit tests

* Make e2e test less flaky

* Make code work exactly like before

* Revert breaking change
* Remove question type toggling
- it should no longer be required
- see @https://metaboat.slack.com/archives/C505ZNNH4/p1707400291390129

* Remove outdated comment

* Update unit tests
* Add new `metric` item to the menu

* Add dummy route `/metric/query`

* Open new metric in a notebook mode

* Initialize new metric URL programatically using the existing helper

* Use type attribute in Question.prototype._serializeForUrl

* Extract getMultiStepTitle and add support for metrics

* Add support for metrics in getSingleStepTitle

* Combine getSingleStepTitle & getMultiStepTitle into getLabels

* Move nameInputPlaceholder computation into getLabels

* Use card.type in Urls.question

* Update getIsSavedQuestionChanged to account for metrics

* Remove dead code branch

* Always pass cardType to Urls.newQuestion to prevent Question.prototype.type from returning undefined

* Default type to "question" in getLabels for extra-safety

* Reorder conditions

* Use nullish coalescing operator instead of a ternary expression

* Remove no-longer-needed fallback

* Set reasonable defaults in Question.create

* Use model's UI for metrics

* Make Urls.newQuestion safer

* Do not show app bar in metrics pages

* Disable metadata tab for metrics

* Hide tabs for metrics

* Rename dataset to question

* Rename dataset to question

* Account for metric-based ad-hoc questions in updateQuestion

* Account for metrics in View

* Migrate Question.prototype.isDataset in hasQuestionCacheSection

* Migrate Question.prototype.isDataset in metabase-enterprise/moderation

* Migrate Question.prototype.isDataset in ModelDetailPage

* Migrate Question.prototype.isDataset in navigateToNewCardFromDashboard

* Migrate Question.prototype.isDataset in handleQBInit

* Migrate Question.prototype.isDataset in Visualization

* Migrate Question.prototype.isDataset in QueryModals

* Migrate Question.prototype.isDataset in QuestionPane

* Migrate Question.prototype.isDataset in ObjectDetailView

* Migrate Question.prototype.isDataset in ArchiveQuestionModal

* Migrate Question.prototype.isDataset in Question.prototype.composeDataset

* Migrate Question.prototype.isDataset in getNativeQueryTable

* Migrate Question.prototype.isDataset in ViewFooter

* Convert SavedQuestionIntroModal to TS

* Migrate Question.prototype.isDataset in SavedQuestionIntroModal

* Migrate Question.prototype.isDataset in QuestionMoveToast

* Migrate Question.prototype.isDataset in QuestionInfoSidebar

* Fix QuestionMoveToast usage

* Fix unit tests

* Fix unit tests

* Make e2e test less flaky

* Make code work exactly like before

* Revert breaking change

* Migrate Question.prototype.isDataset in QueryModals

* Add routing to state typing

* Add getRouting selector

* Infer entity type from URL when converting question back

* Remove creationType for metrics

* Make getCardTypeFromLocation more strict

* Replace Question.prototype.isDataset usage with Question.prototype.type

* Add mocks for routing state

* Use Location in getCardTypeFromLocation

* Ensure initialState contains "routing" only when using routerReducer
- this avoids getting warning from redux saying that initial state contains an extraneous key

* Extract createMockLocation

* Remove getCardTypeFromLocation hack, use state instead

* Revert routing changes

* Reduce diff

* Update updateQuestion unit tests

* Update QuestionDataSource unit tests

* Update QueryBuilder.unsaved-changes-warning.unit.spec.tsx

* Update ActionCreatorModal unit tests

* Update SaveQuestionModal unit tests

* Update comment

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

* Remove question type toggling
- it should no longer be required
- see @https://metaboat.slack.com/archives/C505ZNNH4/p1707400291390129

* Remove outdated comment

* Update unit tests

* Update reference/utils unit tests

* Revert unnecessary changes

* Fix unit tests

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
…38554)

* Add new route for `/metric/:id`

* Alter the CollectionBadge to handle metrics

* Rename the component to `HeaderCollectionBadge`

* Do not offer turning a metric into a model

* Add new route for `/metric/:id/notebook`

* Do not offer to show and convert to SQL for metrics

* Guard against `question.type()` potentially being undefined

* Adjust propTypes

* Construct new, ad-hoc query upon opening a metric

* Fix the url when switching to a notebook mode

* Fix metric url hash showing up when you run a query

* Use more explicit condition for the ViewHeader breadcrumbs render check
* Removed unused route

* Remove invalid test

* Remove invalid routes from isNavigationAllowed, update tests

* Remove invalid route

* Handle /model/:id/notebook route

* Migrate Question.prototype.isDataset to Question.prototype.type

* Consolidate code

* Add missing attribute

* Type cards and questions for extra safety

* Fix running edited models

* Improve diff

* Remove __support__/location

* Update getShouldShowUnsavedChangesWarning

* Update isNavigationAllowed with metrics

* Add tests for metrics

* Update test with metrics locations

* Fix isNavigationAllowed
* Add new route for `/metric/:id/query`

* Expose "edit query" option in the menu

The "edit metadata" option stays hidden for now.

* Prevent fetching model indexes for metrics

* Account for the metrics when computing the dirty state

* Fix card type

* Account for potentially undefined `originalQuestion`

* Fix and expand the `DatasetEditor` unit tests

* Fix `QuestionActions` unit tests

* Fix the logic in the `getIsDirty` selector call stack

* Introduce `useModelIndexesListQuery` hook

* Use new `useModelIndexesListQuery` hook in `DatasetEditor`

* Fix type check failure

This commit remove the superfluous `query` prop from the `DatasetEditor`
component in the related unit test.

* Handle `modelIndexes` prop potentially being undefined

This commit fixes failing E2E tests due to the broken `fieldHasIndex` util.
* Default to "question" in Question.prototype.type

* Replace "dataset" with "type"

* Remove Card['dataset'] attribute

* Replace "dataset" with "type"

* Replace "dataset" with "type"

* Remove redundant fallback values

* Remove Question.prototype._setDataset

* Replace "dataset" with "type"

* Replace "dataset" with "type"

* Replace "dataset" with "type"

* Remove redundant "dataset"

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Account for metrics

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Fix name after merge conflict

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Question.prototype.isDataset with Question.prototype.type

* Remove Question.prototype.isDataset

* Replace Question.prototype.isDataset with Question.prototype.type

* Replace Card['dataset'] with Card['type']

* Fix unit tests

* Fix test setup

* Make bookmark icons work again

* Fix updating questions

* Revert "Fix assertions"

This reverts commit d4b052e583e431c866ed6db300c7d415a159f3eb.

* Fix assertion
* Update the hook return type

* Add unit test

* Use model id from a const

* Add empty row between tests
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
Copy link

replay-io bot commented May 20, 2024

Status In Progress ↗︎ 55 / 56
Commit 1a6d54d
Results
⚠️ 1 Flaky
2567 Passed

@metamben metamben changed the base branch from metrics-v2 to master May 20, 2024 17:47
@metamben metamben changed the base branch from master to metrics-v2 May 20, 2024 17:48
@metamben metamben changed the base branch from metrics-v2 to master May 20, 2024 18:04
Copy link

Codenotify: Notifying subscribers in CODENOTIFY files for diff f9f50c0...98dd72b.

Notify File(s)
@ranquild frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.styled.tsx
frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx
frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.unit.spec.tsx

@metamben metamben enabled auto-merge (squash) May 20, 2024 18:11
@metamben metamben changed the title Migrate druid metrics-inside-aggregation-clauses-test to druid-jdbc Fix druid-jdbc issues May 20, 2024
@metamben metamben added the no-backport Do not backport this PR to any branch label May 20, 2024
@metamben metamben merged commit 9771eaa into master May 21, 2024
106 checks passed
@metamben metamben deleted the migrate-druid-metric-aggregation-test branch May 21, 2024 18:58
Copy link

@metamben Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

oisincoveney pushed a commit that referenced this pull request May 22, 2024
…42653)

* Migrate druid metrics-inside-aggregation-clauses-test to druid-jdbc
* Fix test-runner: druid should not exclude druid-jdbc
* Implement set-parameter and unprepare-value for LocalDateTime for druid-jdbc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/QueryProcessor :hammer_and_wrench:
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BE] [QP] Metrics aren't working for Druid (old driver)
8 participants