Skip to content

Commit

Permalink
View Presto row and array objects clearly in the data grid (#7625)
Browse files Browse the repository at this point in the history
* feat: rough check in for Presto rows and arrays

* fix: presto arrays

* fix: return selected and expanded columns

* fix: add helper methods and unit tests

* fix: only allow exploration of selected columns

* fix: address Beto's comments and add more unit tests
  • Loading branch information
khtruong authored and betodealmeida committed May 31, 2019
1 parent d408e30 commit d296734
Show file tree
Hide file tree
Showing 6 changed files with 709 additions and 42 deletions.
16 changes: 15 additions & 1 deletion superset/assets/spec/javascripts/sqllab/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,20 @@ export const queries = [
type: 'STRING',
},
],
selected_columns: [
{
is_date: true,
is_dim: false,
name: 'ds',
type: 'STRING',
},
{
is_date: false,
is_dim: true,
name: 'gender',
type: 'STRING',
},
],
data: [{ col1: 0, col2: 1 }, { col1: 2, col2: 3 }],
},
},
Expand Down Expand Up @@ -264,7 +278,7 @@ export const queryWithBadColumns = {
...queries[0],
results: {
data: queries[0].results.data,
columns: [
selected_columns: [
{
is_date: true,
is_dim: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class ExploreResultsButton extends React.PureComponent {
}
getColumns() {
const props = this.props;
if (props.query && props.query.results && props.query.results.columns) {
return props.query.results.columns;
if (props.query && props.query.results && props.query.results.selected_columns) {
return props.query.results.selected_columns;
}
return [];
}
Expand All @@ -97,7 +97,7 @@ class ExploreResultsButton extends React.PureComponent {
const re1 = /^[A-Za-z_]\w*$/; // starts with char or _, then only alphanum
const re2 = /__\d+$/; // does not finish with __ and then a number which screams dup col name

return this.props.query.results.columns.map(col => col.name)
return this.props.query.results.selected_columns.map(col => col.name)
.filter(col => !re1.test(col) || re2.test(col));
}
datasourceName() {
Expand Down
1 change: 1 addition & 0 deletions superset/assets/src/SqlLab/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ div.Workspace {

.schemaPane {
flex: 0 0 300px;
max-width: 300px;
transition: all .3s ease-in-out;
}

Expand Down
Loading

0 comments on commit d296734

Please sign in to comment.