Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
addressing comment
  • Loading branch information
zhaoyongjie committed Sep 2, 2022
1 parent b7ad0e3 commit ec873f2
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const legacyTimeseriesTime: ControlPanelSectionConfig = {
],
};

export const echartsTimeseriesTime: ControlPanelSectionConfig = {
export const genericTime: ControlPanelSectionConfig = {
...baseTimeSection,
controlSetRows: [
['granularity_sqla'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export function normalizeTimeColumn(
if (isAdhocColumn(queryObject.columns[axisIdx])) {
mutatedColumns[axisIdx] = {
timeGrain: queryObject?.extras?.time_grain_sqla,
columnType: 'AXIS',
columnType: 'BASE_AXIS',
...(queryObject.columns[axisIdx] as AdhocColumn),
};
} else {
mutatedColumns[axisIdx] = {
timeGrain: queryObject?.extras?.time_grain_sqla,
columnType: 'AXIS',
columnType: 'BASE_AXIS',
sqlExpression: formData.x_axis,
label: formData.x_axis,
expressionType: 'SQL',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface AdhocColumn {
optionName?: string;
sqlExpression: string;
expressionType: 'SQL';
columnType?: 'AXIS' | 'SERIES';
columnType?: 'BASE_AXIS' | 'SERIES';
timeGrain?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('enabled GENERIC_CHART_AXES', () => {
columns: [
{
timeGrain: 'P1Y',
columnType: 'AXIS',
columnType: 'BASE_AXIS',
sqlExpression: 'time_column_in_x_axis',
label: 'time_column_in_x_axis',
expressionType: 'SQL',
Expand Down Expand Up @@ -202,7 +202,7 @@ describe('enabled GENERIC_CHART_AXES', () => {
columns: [
{
timeGrain: 'P1Y',
columnType: 'AXIS',
columnType: 'BASE_AXIS',
expressionType: 'SQL',
label: 'Order Data + 1 year',
sqlExpression: `"Order Date" + interval '1 year'`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ function createAdvancedAnalyticsSection(

const config: ControlPanelConfig = {
controlPanelSections: [
sections.echartsTimeseriesTime,
sections.genericTime,
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
? {
label: t('Shared query fields'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.echartsTimeseriesTime,
sections.genericTime,
sections.echartsTimeSeriesQuery,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] {

const config: ControlPanelConfig = {
controlPanelSections: [
sections.echartsTimeseriesTime,
sections.genericTime,
sections.echartsTimeSeriesQuery,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.echartsTimeseriesTime,
sections.genericTime,
sections.echartsTimeSeriesQuery,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.echartsTimeseriesTime,
sections.genericTime,
sections.echartsTimeSeriesQuery,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.echartsTimeseriesTime,
sections.genericTime,
sections.echartsTimeSeriesQuery,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.echartsTimeseriesTime,
sections.genericTime,
sections.echartsTimeSeriesQuery,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,
Expand Down
2 changes: 1 addition & 1 deletion superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ def adhoc_column_to_sqla(

if (
is_dttm
and col.get("columnType") == "AXIS"
and col.get("columnType") == "BASE_AXIS"
and (time_grain := col.get("timeGrain"))
):
sqla_column = self.db_engine_spec.get_timestamp_expr(
Expand Down
2 changes: 1 addition & 1 deletion superset/superset_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AdhocColumn(TypedDict, total=False):
hasCustomLabel: Optional[bool]
label: Optional[str]
sqlExpression: Optional[str]
columnType: Optional[Literal["AXIS", "SERIES"]]
columnType: Optional[Literal["BASE_AXIS", "SERIES"]]
timeGrain: Optional[str]


Expand Down
2 changes: 1 addition & 1 deletion superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ def get_axis_column(columns: Optional[List[Column]]) -> Optional[AdhocColumn]:
axis_cols = [
col
for col in columns
if is_adhoc_column(col) and col.get("columnType") == "AXIS"
if is_adhoc_column(col) and col.get("columnType") == "BASE_AXIS"
]
return axis_cols[0] if axis_cols else None

Expand Down
10 changes: 5 additions & 5 deletions tests/integration_tests/query_context_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ def test_time_column_with_time_grain(app_context, physical_dataset):
adhoc_column: AdhocColumn = {
"label": "I_AM_A_TRUNC_COLUMN",
"sqlExpression": "col6",
"columnType": "AXIS",
"columnType": "BASE_AXIS",
"timeGrain": "P1Y",
}
qc = QueryContextFactory().create(
Expand Down Expand Up @@ -787,7 +787,7 @@ def test_non_time_column_with_time_grain(app_context, physical_dataset):
{
"label": "COL2 ALIAS",
"sqlExpression": "col2",
"columnType": "AXIS",
"columnType": "BASE_AXIS",
"timeGrain": "P1Y",
},
],
Expand Down Expand Up @@ -819,7 +819,7 @@ def test_special_chars_in_column_name(app_context, physical_dataset):
{
"label": "I_AM_A_TRUNC_COLUMN",
"sqlExpression": "time column with spaces",
"columnType": "AXIS",
"columnType": "BASE_AXIS",
"timeGrain": "P1Y",
},
],
Expand Down Expand Up @@ -849,7 +849,7 @@ def test_date_adhoc_column(app_context, physical_dataset):
column_on_axis: AdhocColumn = {
"label": "ADHOC COLUMN",
"sqlExpression": "col6 + interval '20 year'",
"columnType": "AXIS",
"columnType": "BASE_AXIS",
"timeGrain": "P1Y",
}
qc = QueryContextFactory().create(
Expand Down Expand Up @@ -880,7 +880,7 @@ def test_non_date_adhoc_column(app_context, physical_dataset):
column_on_axis: AdhocColumn = {
"label": "ADHOC COLUMN",
"sqlExpression": "col1 * 10",
"columnType": "AXIS",
"columnType": "BASE_AXIS",
"timeGrain": "P1Y",
}
qc = QueryContextFactory().create(
Expand Down

0 comments on commit ec873f2

Please sign in to comment.