You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ju...@apache.org on 2021/01/08 22:13:47 UTC
[superset] branch master updated: test: rename column names for
birth_names dataset (#12082)
This is an automated email from the ASF dual-hosted git repository.
junlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 2210015 test: rename column names for birth_names dataset (#12082)
2210015 is described below
commit 2210015aabd6238409e8c29c7dc9f472581adc94
Author: Jesse Yang <je...@airbnb.com>
AuthorDate: Fri Jan 8 14:13:20 2021 -0800
test: rename column names for birth_names dataset (#12082)
---
.../integration/explore/AdhocMetrics.test.ts | 8 ++--
.../explore/visualizations/pivot_table.test.js | 10 ++---
.../explore/visualizations/table.test.ts | 2 +-
superset-frontend/spec/fixtures/mockDatasource.js | 48 +++++++++++-----------
superset/examples/birth_names.py | 6 +--
tests/databases/commands_tests.py | 6 +--
tests/datasets/commands_tests.py | 8 ++--
tests/datasource_tests.py | 6 +--
tests/fixtures/datasource.py | 6 +--
tests/fixtures/importexport.py | 8 ++--
tests/model_tests.py | 2 +-
11 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/superset-frontend/cypress-base/cypress/integration/explore/AdhocMetrics.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/AdhocMetrics.test.ts
index 082547c..79b153d 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/AdhocMetrics.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/explore/AdhocMetrics.test.ts
@@ -27,7 +27,7 @@ describe('AdhocMetrics', () => {
});
it('Clear metric and set simple adhoc metric', () => {
- const metric = 'sum(sum_girls)';
+ const metric = 'sum(num_girls)';
const metricName = 'Sum Girls';
cy.get('[data-test=metrics]')
.find('[data-test="remove-control-button"]')
@@ -40,7 +40,7 @@ describe('AdhocMetrics', () => {
cy.get('[data-test="AdhocMetricEditTitle#trigger"]').click();
cy.get('[data-test="AdhocMetricEditTitle#input"]').type(metricName);
- cy.get('[name="select-column"]').click().type('sum_girls{enter}');
+ cy.get('[name="select-column"]').click().type('num_girls{enter}');
cy.get('[name="select-aggregate"]').click().type('sum{enter}');
cy.get('[data-test="AdhocMetricEdit#save"]').contains('Save').click();
@@ -94,7 +94,7 @@ describe('AdhocMetrics', () => {
xit('Switch from custom sql tabs to simple', () => {
cy.get('[data-test=metrics]').within(() => {
cy.get('.Select__dropdown-indicator').click();
- cy.get('input[type=text]').type('sum_girls{enter}');
+ cy.get('input[type=text]').type('num_girls{enter}');
});
cy.get('[data-test=metrics]')
.find('[data-test="metric-option"]')
@@ -102,7 +102,7 @@ describe('AdhocMetrics', () => {
cy.get('#metrics-edit-popover').within(() => {
cy.get('#adhoc-metric-edit-tabs-tab-SQL').click();
- cy.get('.ace_identifier').contains('sum_girls');
+ cy.get('.ace_identifier').contains('num_girls');
cy.get('.ace_content').click();
cy.get('.ace_text-input').type('{selectall}{backspace}SUM(num)');
cy.get('#adhoc-metric-edit-tabs-tab-SIMPLE').click();
diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js
index 32e9923..a67cabd 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js
+++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js
@@ -39,17 +39,17 @@ describe('Visualization > Pivot Table', () => {
expressionType: 'SIMPLE',
column: {
id: 338,
- column_name: 'sum_boys',
+ column_name: 'num_boys',
expression: '',
filterable: false,
groupby: false,
is_dttm: false,
type: 'BIGINT',
- optionName: '_col_sum_boys',
+ optionName: '_col_num_boys',
},
aggregate: 'SUM',
hasCustomLabel: false,
- label: 'SUM(sum_boys)',
+ label: 'SUM(num_boys)',
optionName: 'metric_gvpdjt0v2qf_6hkf56o012',
};
@@ -88,7 +88,7 @@ describe('Visualization > Pivot Table', () => {
metrics: ['sum__num', TEST_METRIC],
});
cy.get('.chart-container tr:eq(0) th:eq(1)').contains('sum__num');
- cy.get('.chart-container tr:eq(0) th:eq(2)').contains('SUM(sum_boys)');
+ cy.get('.chart-container tr:eq(0) th:eq(2)').contains('SUM(num_boys)');
cy.get('.chart-container tr:eq(1) th:eq(0)').contains('state');
cy.get('.chart-container tr:eq(2) th:eq(0)').contains('name');
});
@@ -100,7 +100,7 @@ describe('Visualization > Pivot Table', () => {
metrics: ['sum__num', TEST_METRIC],
});
cy.get('.chart-container tr:eq(0) th:eq(2)').contains('sum__num');
- cy.get('.chart-container tr:eq(0) th:eq(3)').contains('SUM(sum_boys)');
+ cy.get('.chart-container tr:eq(0) th:eq(3)').contains('SUM(num_boys)');
cy.get('.chart-container tr:eq(2) th:eq(0)').contains('name');
cy.get('.chart-container tr:eq(2) th:eq(1)').contains('gender');
});
diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts
index a1daa9e..178c953 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts
@@ -31,7 +31,7 @@ describe('Visualization > Table', () => {
const PERCENT_METRIC = {
expressionType: 'SQL',
- sqlExpression: 'CAST(SUM(sum_girls)+AS+FLOAT)/SUM(num)',
+ sqlExpression: 'CAST(SUM(num_girls)+AS+FLOAT)/SUM(num)',
column: null,
aggregate: null,
hasCustomLabel: true,
diff --git a/superset-frontend/spec/fixtures/mockDatasource.js b/superset-frontend/spec/fixtures/mockDatasource.js
index ce57454..99183ed 100644
--- a/superset-frontend/spec/fixtures/mockDatasource.js
+++ b/superset-frontend/spec/fixtures/mockDatasource.js
@@ -24,19 +24,19 @@ export default {
verbose_map: {
count: 'COUNT(*)',
__timestamp: 'Time',
- sum__sum_girls: 'sum__sum_girls',
+ sum__num_girls: 'sum__num_girls',
name: 'name',
- avg__sum_girls: 'avg__sum_girls',
+ avg__num_girls: 'avg__num_girls',
gender: 'gender',
- sum_girls: 'sum_girls',
+ num_girls: 'num_girls',
ds: 'ds',
- sum__sum_boys: 'sum__sum_boys',
+ sum__num_boys: 'sum__num_boys',
state: 'state',
num: 'num',
sum__num: 'sum__num',
- sum_boys: 'sum_boys',
+ num_boys: 'num_boys',
avg__num: 'avg__num',
- avg__sum_boys: 'avg__sum_boys',
+ avg__num_boys: 'avg__num_boys',
},
metrics: [
{
@@ -54,31 +54,31 @@ export default {
description: null,
},
{
- expression: 'SUM(birth_names.sum_boys)',
+ expression: 'SUM(birth_names.num_boys)',
warning_text: null,
- verbose_name: 'sum__sum_boys',
- metric_name: 'sum__sum_boys',
+ verbose_name: 'sum__num_boys',
+ metric_name: 'sum__num_boys',
description: null,
},
{
- expression: 'AVG(birth_names.sum_boys)',
+ expression: 'AVG(birth_names.num_boys)',
warning_text: null,
- verbose_name: 'avg__sum_boys',
- metric_name: 'avg__sum_boys',
+ verbose_name: 'avg__num_boys',
+ metric_name: 'avg__num_boys',
description: null,
},
{
- expression: 'SUM(birth_names.sum_girls)',
+ expression: 'SUM(birth_names.num_girls)',
warning_text: null,
- verbose_name: 'sum__sum_girls',
- metric_name: 'sum__sum_girls',
+ verbose_name: 'sum__num_girls',
+ metric_name: 'sum__num_girls',
description: null,
},
{
- expression: 'AVG(birth_names.sum_girls)',
+ expression: 'AVG(birth_names.num_girls)',
warning_text: null,
- verbose_name: 'avg__sum_girls',
- metric_name: 'avg__sum_girls',
+ verbose_name: 'avg__num_girls',
+ metric_name: 'avg__num_girls',
description: null,
},
{
@@ -149,7 +149,7 @@ export default {
is_dttm: false,
expression: '',
groupby: false,
- column_name: 'sum_boys',
+ column_name: 'num_boys',
},
{
type: 'BIGINT',
@@ -159,7 +159,7 @@ export default {
is_dttm: false,
expression: '',
groupby: false,
- column_name: 'sum_girls',
+ column_name: 'num_girls',
},
],
id,
@@ -189,10 +189,10 @@ export default {
['["num", false]', 'num [desc]'],
['["state", true]', 'state [asc]'],
['["state", false]', 'state [desc]'],
- ['["sum_boys", true]', 'sum_boys [asc]'],
- ['["sum_boys", false]', 'sum_boys [desc]'],
- ['["sum_girls", true]', 'sum_girls [asc]'],
- ['["sum_girls", false]', 'sum_girls [desc]'],
+ ['["num_boys", true]', 'num_boys [asc]'],
+ ['["num_boys", false]', 'num_boys [desc]'],
+ ['["num_girls", true]', 'num_girls [asc]'],
+ ['["num_girls", false]', 'num_girls [desc]'],
],
type: 'table',
edit_url: '/tablemodelview/edit/7',
diff --git a/superset/examples/birth_names.py b/superset/examples/birth_names.py
index d7e6940..ae7367a 100644
--- a/superset/examples/birth_names.py
+++ b/superset/examples/birth_names.py
@@ -63,7 +63,7 @@ def gen_filter(
def load_data(tbl_name: str, database: Database, sample: bool = False) -> None:
- pdf = pd.read_json(get_example_data("birth_names.json.gz"))
+ pdf = pd.read_json(get_example_data("birth_names2.json.gz"))
# TODO(bkyryliuk): move load examples data into the pytest fixture
if database.backend == "presto":
pdf.ds = pd.to_datetime(pdf.ds, unit="ms")
@@ -221,14 +221,14 @@ def create_slices(tbl: BaseDatasource) -> Tuple[List[Slice], List[Slice]]:
metrics=[
{
"expressionType": "SIMPLE",
- "column": {"column_name": "sum_boys", "type": "BIGINT(20)"},
+ "column": {"column_name": "num_boys", "type": "BIGINT(20)"},
"aggregate": "SUM",
"label": "Boys",
"optionName": "metric_11",
},
{
"expressionType": "SIMPLE",
- "column": {"column_name": "sum_girls", "type": "BIGINT(20)"},
+ "column": {"column_name": "num_girls", "type": "BIGINT(20)"},
"aggregate": "SUM",
"label": "Girls",
"optionName": "metric_12",
diff --git a/tests/databases/commands_tests.py b/tests/databases/commands_tests.py
index cddbf0d..70fcd7c 100644
--- a/tests/databases/commands_tests.py
+++ b/tests/databases/commands_tests.py
@@ -106,7 +106,7 @@ class TestExportDatabasesCommand(SupersetTestCase):
"metric_name": "ratio",
"verbose_name": "Ratio Boys/Girls",
"metric_type": None,
- "expression": "sum(sum_boys) / sum(sum_girls)",
+ "expression": "sum(num_boys) / sum(num_girls)",
"description": "This represents the ratio of boys/girls",
"d3format": ".2%",
"extra": None,
@@ -159,7 +159,7 @@ class TestExportDatabasesCommand(SupersetTestCase):
"python_date_format": None,
},
{
- "column_name": "sum_girls",
+ "column_name": "num_girls",
"verbose_name": None,
"is_dttm": False,
"is_active": None,
@@ -195,7 +195,7 @@ class TestExportDatabasesCommand(SupersetTestCase):
"python_date_format": None,
},
{
- "column_name": "sum_boys",
+ "column_name": "num_boys",
"verbose_name": None,
"is_dttm": None,
"is_active": None,
diff --git a/tests/datasets/commands_tests.py b/tests/datasets/commands_tests.py
index cc5798e..78ed44a 100644
--- a/tests/datasets/commands_tests.py
+++ b/tests/datasets/commands_tests.py
@@ -240,8 +240,8 @@ class TestImportDatasetsCommand(SupersetTestCase):
"state",
"gender",
"name",
- "sum_boys",
- "sum_girls",
+ "num_boys",
+ "num_girls",
"num",
]
@@ -276,8 +276,8 @@ class TestImportDatasetsCommand(SupersetTestCase):
"state",
"gender",
"name",
- "sum_boys",
- "sum_girls",
+ "num_boys",
+ "num_girls",
"num",
}
diff --git a/tests/datasource_tests.py b/tests/datasource_tests.py
index 890b4a6..14ad01d 100644
--- a/tests/datasource_tests.py
+++ b/tests/datasource_tests.py
@@ -34,7 +34,7 @@ class TestDatasource(SupersetTestCase):
resp = self.get_json_resp(url)
col_names = {o.get("name") for o in resp}
self.assertEqual(
- col_names, {"sum_boys", "num", "gender", "name", "ds", "state", "sum_girls"}
+ col_names, {"num_boys", "num", "gender", "name", "ds", "state", "num_girls"}
)
def test_external_metadata_for_virtual_table(self):
@@ -179,13 +179,13 @@ class TestDatasource(SupersetTestCase):
self.assertEqual(
col_names,
{
- "sum_boys",
+ "num_boys",
"num",
"gender",
"name",
"ds",
"state",
- "sum_girls",
+ "num_girls",
"num_california",
},
)
diff --git a/tests/fixtures/datasource.py b/tests/fixtures/datasource.py
index c37753d..fad2bfe 100644
--- a/tests/fixtures/datasource.py
+++ b/tests/fixtures/datasource.py
@@ -77,7 +77,7 @@ datasource_post = {
},
{
"id": 509,
- "column_name": "sum_boys",
+ "column_name": "num_boys",
"verbose_name": None,
"description": None,
"expression": None,
@@ -88,7 +88,7 @@ datasource_post = {
},
{
"id": 510,
- "column_name": "sum_girls",
+ "column_name": "num_girls",
"verbose_name": None,
"description": None,
"expression": "",
@@ -144,7 +144,7 @@ datasource_post = {
"metric_name": "ratio",
"verbose_name": "Ratio Boys/Girls",
"description": "This represents the ratio of boys/girls",
- "expression": "sum(sum_boys) / sum(sum_girls)",
+ "expression": "sum(num_boys) / sum(num_girls)",
"warning_text": "no warning",
"d3format": ".2%",
},
diff --git a/tests/fixtures/importexport.py b/tests/fixtures/importexport.py
index b561442..e1752fc 100644
--- a/tests/fixtures/importexport.py
+++ b/tests/fixtures/importexport.py
@@ -30,8 +30,8 @@ dataset_ui_export: List[Dict[str, Any]] = [
{"column_name": "state", "type": "VARCHAR(10)"},
{"column_name": "gender", "type": "VARCHAR(16)"},
{"column_name": "name", "type": "VARCHAR(255)"},
- {"column_name": "sum_boys", "type": "BIGINT"},
- {"column_name": "sum_girls", "type": "BIGINT"},
+ {"column_name": "num_boys", "type": "BIGINT"},
+ {"column_name": "num_girls", "type": "BIGINT"},
{"column_name": "num", "type": "BIGINT"},
],
"filter_select_enabled": True,
@@ -201,7 +201,7 @@ dashboard_export: Dict[str, Any] = {
"__TableColumn__": {
"changed_by_fk": None,
"changed_on": {"__datetime__": "2020-10-07T15:50:00"},
- "column_name": "sum_boys",
+ "column_name": "num_boys",
"created_by_fk": None,
"created_on": {"__datetime__": "2020-10-07T15:50:00"},
"description": None,
@@ -222,7 +222,7 @@ dashboard_export: Dict[str, Any] = {
"__TableColumn__": {
"changed_by_fk": None,
"changed_on": {"__datetime__": "2020-10-07T15:50:00"},
- "column_name": "sum_girls",
+ "column_name": "num_girls",
"created_by_fk": None,
"created_on": {"__datetime__": "2020-10-07T15:50:00"},
"description": None,
diff --git a/tests/model_tests.py b/tests/model_tests.py
index ee76a48..45dfee9 100644
--- a/tests/model_tests.py
+++ b/tests/model_tests.py
@@ -271,7 +271,7 @@ class TestSqlaTableModel(SupersetTestCase):
spec.allows_joins = inner_join
arbitrary_gby = "state || gender || '_test'"
arbitrary_metric = dict(
- label="arbitrary", expressionType="SQL", sqlExpression="SUM(sum_boys)"
+ label="arbitrary", expressionType="SQL", sqlExpression="SUM(num_boys)"
)
query_obj = dict(
groupby=[arbitrary_gby, "name"],