This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 75bc501 [explore flow] handling duplicated column aliases (#5778)
75bc501 is described below
commit 75bc50114617a5a133a1324f9d2a4dd9dca2e233
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Tue Sep 18 23:17:38 2018 -0700
[explore flow] handling duplicated column aliases (#5778)
* [explore flow] handling duplicated column aliases
closes #5739
* lint
---
.../assets/src/SqlLab/components/ExploreResultsButton.jsx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
b/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
index dfaab5a..40cf1ec 100644
--- a/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
+++ b/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
@@ -58,7 +58,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',
@@ -81,8 +81,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;
@@ -155,7 +158,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() {