-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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(native-filters): Fetch only the required dataset fields #23303
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
* under the License. | ||
*/ | ||
import React, { useCallback, useState, useMemo, useEffect } from 'react'; | ||
import rison from 'rison'; | ||
import { Column, ensureIsArray, t, useChangeEffect } from '@superset-ui/core'; | ||
import { Select, FormInstance } from 'src/components'; | ||
import { useToasts } from 'src/components/MessageToasts/withToasts'; | ||
|
@@ -85,7 +86,13 @@ export function ColumnSelect({ | |
} | ||
if (datasetId != null) { | ||
cachedSupersetGet({ | ||
endpoint: `/api/v1/dataset/${datasetId}`, | ||
endpoint: `/api/v1/dataset/${datasetId}?q=${rison.encode({ | ||
columns: [ | ||
'columns.column_name', | ||
'columns.is_dttm', | ||
'columns.type_generic', | ||
Comment on lines
+92
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100 % sure on this (more like 90 %), but I feel like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @villebro thanks for the review. If your hypothesis is correct then it seems like a follow up PR would be to deprecate the |
||
], | ||
})}`, | ||
}).then( | ||
({ json: { result } }) => { | ||
const lookupValue = Array.isArray(value) ? value : [value]; | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -45,6 +45,7 @@ import React, { | |||||||||
useMemo, | ||||||||||
useState, | ||||||||||
} from 'react'; | ||||||||||
import rison from 'rison'; | ||||||||||
import { PluginFilterSelectCustomizeProps } from 'src/filters/components/Select/types'; | ||||||||||
import { useSelector } from 'react-redux'; | ||||||||||
import { getChartDataRequest } from 'src/components/Chart/chartAction'; | ||||||||||
|
@@ -654,7 +655,28 @@ const FiltersConfigForm = ( | |||||||||
useEffect(() => { | ||||||||||
if (datasetId) { | ||||||||||
cachedSupersetGet({ | ||||||||||
endpoint: `/api/v1/dataset/${datasetId}`, | ||||||||||
endpoint: `/api/v1/dataset/${datasetId}?q=${rison.encode({ | ||||||||||
columns: [ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found other attributes that need to be queried when analyzing the following files: Line 138 in da3791a
Line 121 in da3791a
superset/superset-frontend/packages/superset-ui-chart-controls/src/utils/getTemporalColumns.ts Line 43 in da3791a
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michael-s-molina it seem like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @john-bodley You're right. Given that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, I think this is needed in the Explore control panel only, hence shouldn't affect dashboards/native filters. |
||||||||||
'columns.column_name', | ||||||||||
'columns.expression', | ||||||||||
'columns.filterable', | ||||||||||
'columns.is_dttm', | ||||||||||
'columns.type', | ||||||||||
'columns.verbose_name', | ||||||||||
'database.id', | ||||||||||
'database_name', | ||||||||||
john-bodley marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
'datasource_type', | ||||||||||
'filter_select_enabled', | ||||||||||
'id', | ||||||||||
'is_sqllab_view', | ||||||||||
'main_dttm_col', | ||||||||||
'metrics.metric_name', | ||||||||||
'metrics.verbose_name', | ||||||||||
'schema', | ||||||||||
'sql', | ||||||||||
'table_name', | ||||||||||
], | ||||||||||
})}`, | ||||||||||
}) | ||||||||||
.then((response: JsonResponse) => { | ||||||||||
setMetrics(response.json?.result?.metrics); | ||||||||||
|
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
columns
state is later used to getcurrentColumn
which is then passed to thefilterValues
function. If you checkfilterValues
references, you will see thatis_dttm
andtype_generic
attributes are also used.