diff --git a/superset/assets/src/explore/components/ExploreViewContainer.jsx b/superset/assets/src/explore/components/ExploreViewContainer.jsx index 56b5e4319a40f..7990c9be1f971 100644 --- a/superset/assets/src/explore/components/ExploreViewContainer.jsx +++ b/superset/assets/src/explore/components/ExploreViewContainer.jsx @@ -131,8 +131,6 @@ class ExploreViewContainer extends React.Component { /* eslint no-unused-vars: 0 */ componentDidUpdate(prevProps, prevState) { - this.triggerQueryIfNeeded(); - const changedControlKeys = this.findChangedControlKeys(prevProps.controls, this.props.controls); if (this.hasDisplayControlChanged(changedControlKeys, this.props.controls)) { this.addHistory({}); @@ -213,17 +211,6 @@ class ExploreViewContainer extends React.Component { ); } - triggerQueryIfNeeded() { - if (this.props.chart.triggerQuery && !this.hasErrors()) { - this.props.actions.postChartFormData( - this.props.form_data, - false, - this.props.timeout, - this.props.chart.id, - ); - } - } - addHistory({ isReplace = false, title }) { const { payload } = getExploreUrlAndPayload({ formData: this.props.form_data }); const longUrl = getExploreLongUrl(this.props.form_data, null, false); diff --git a/superset/db_engine_specs/presto.py b/superset/db_engine_specs/presto.py index a2b02cdcf409d..ff03d540f234b 100644 --- a/superset/db_engine_specs/presto.py +++ b/superset/db_engine_specs/presto.py @@ -24,7 +24,7 @@ from typing import List, Set, Tuple from urllib import parse -from sqlalchemy import Column, literal_column, types +from sqlalchemy import Column, literal_column from sqlalchemy.engine.base import Engine from sqlalchemy.engine.reflection import Inspector from sqlalchemy.engine.result import RowProxy @@ -231,7 +231,9 @@ def get_columns( for column in columns: try: # parse column if it is a row or array - if "array" in column.Type or "row" in column.Type: + if is_feature_enabled("PRESTO_EXPAND_DATA") and ( + "array" in column.Type or "row" in column.Type + ): structural_column_index = len(result) cls._parse_structural_column(column.Column, column.Type, result) result[structural_column_index]["nullable"] = getattr( @@ -247,7 +249,7 @@ def get_columns( column.Type, column.Column ) ) - column_type = types.NullType + column_type = "OTHER" column_info = cls._create_column_info(column.Column, column_type) column_info["nullable"] = getattr(column, "Null", True) column_info["default"] = None @@ -352,7 +354,7 @@ def select_star( to an array's contents. """ presto_cols = cols - if show_cols: + if is_feature_enabled("PRESTO_EXPAND_DATA") and show_cols: dot_regex = r"\.(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)" presto_cols = [ col for col in presto_cols if not re.search(dot_regex, col["name"]) diff --git a/tests/db_engine_specs_test.py b/tests/db_engine_specs_test.py index acd7180f1ca4f..1b0d87c6f1689 100644 --- a/tests/db_engine_specs_test.py +++ b/tests/db_engine_specs_test.py @@ -360,16 +360,25 @@ def test_presto_get_column(self): expected_results = [("column_name", "BOOLEAN")] self.verify_presto_column(presto_column, expected_results) + @mock.patch.dict( + "superset._feature_flags", {"PRESTO_EXPAND_DATA": True}, clear=True + ) def test_presto_get_simple_row_column(self): presto_column = ("column_name", "row(nested_obj double)", "") expected_results = [("column_name", "ROW"), ("column_name.nested_obj", "FLOAT")] self.verify_presto_column(presto_column, expected_results) + @mock.patch.dict( + "superset._feature_flags", {"PRESTO_EXPAND_DATA": True}, clear=True + ) def test_presto_get_simple_row_column_with_name_containing_whitespace(self): presto_column = ("column name", "row(nested_obj double)", "") expected_results = [("column name", "ROW"), ("column name.nested_obj", "FLOAT")] self.verify_presto_column(presto_column, expected_results) + @mock.patch.dict( + "superset._feature_flags", {"PRESTO_EXPAND_DATA": True}, clear=True + ) def test_presto_get_simple_row_column_with_tricky_nested_field_name(self): presto_column = ("column_name", 'row("Field Name(Tricky, Name)" double)', "") expected_results = [ @@ -378,11 +387,17 @@ def test_presto_get_simple_row_column_with_tricky_nested_field_name(self): ] self.verify_presto_column(presto_column, expected_results) + @mock.patch.dict( + "superset._feature_flags", {"PRESTO_EXPAND_DATA": True}, clear=True + ) def test_presto_get_simple_array_column(self): presto_column = ("column_name", "array(double)", "") expected_results = [("column_name", "ARRAY")] self.verify_presto_column(presto_column, expected_results) + @mock.patch.dict( + "superset._feature_flags", {"PRESTO_EXPAND_DATA": True}, clear=True + ) def test_presto_get_row_within_array_within_row_column(self): presto_column = ( "column_name", @@ -397,6 +412,9 @@ def test_presto_get_row_within_array_within_row_column(self): ] self.verify_presto_column(presto_column, expected_results) + @mock.patch.dict( + "superset._feature_flags", {"PRESTO_EXPAND_DATA": True}, clear=True + ) def test_presto_get_array_within_row_within_array_column(self): presto_column = ( "column_name",