mistercrunch closed pull request #5778: [explore flow] handling duplicated
column aliases
URL: https://github.com/apache/incubator-superset/pull/5778
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
b/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
index b641238975..3692099729 100644
--- a/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
+++ b/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
@@ -59,7 +59,7 @@ class ExploreResultsButton extends React.PureComponent {
title: t('Explore'),
body: msg,
actions: [
- Dialog.DefaultAction('Ok', () => {}, 'btn-danger'),
+ Dialog.DefaultAction('Ok', () => {}, 'btn-primary'),
],
bsSize: 'large',
bsStyle: 'warning',
@@ -82,8 +82,11 @@ class ExploreResultsButton extends React.PureComponent {
return moment.duration(this.props.query.endDttm -
this.props.query.startDttm).asSeconds();
}
getInvalidColumns() {
- const re = /^[A-Za-z_]\w*$/;
- return this.props.query.results.columns.map(col => col.name).filter(col =>
!re.test(col));
+ 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)
+ .filter(col => !re1.test(col) || re2.test(col));
}
datasourceName() {
const { query } = this.props;
@@ -156,7 +159,9 @@ class ExploreResultsButton extends React.PureComponent {
<code>SELECT count(*)
<strong>AS my_alias</strong>
</code>){' '}
- {t('limited to alphanumeric characters and underscores')}
+ {t('limited to alphanumeric characters and underscores. Column aliases
ending with ' +
+ 'double underscores followed by a numeric value are not allowed for
reasons ' +
+ 'discussed in Github issue #5739.')}
</div>);
}
render() {
diff --git a/superset/assets/src/visualizations/sunburst.js
b/superset/assets/src/visualizations/sunburst.js
index 8e8bf45a85..28fe605eba 100644
--- a/superset/assets/src/visualizations/sunburst.js
+++ b/superset/assets/src/visualizations/sunburst.js
@@ -187,7 +187,6 @@ function Sunburst(element, props) {
// If metrics match, assume we are coloring by category
const metricsMatch = Math.abs(d.m1 - d.m2) < 0.00001;
- console.log('metrics', metrics);
gMiddleText.selectAll('*').remove();
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]