You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/07/16 07:35:11 UTC

[incubator-superset] branch master updated: fix: make __time an ok column name in SQL Lab (#10336)

This is an automated email from the ASF dual-hosted git repository.

villebro 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 611dd7a  fix: make __time an ok column name in SQL Lab (#10336)
611dd7a is described below

commit 611dd7a8f63bc4105fd0b5c10c6a8efd6eae6fca
Author: Ville Brofeldt <33...@users.noreply.github.com>
AuthorDate: Thu Jul 16 10:34:50 2020 +0300

    fix: make __time an ok column name in SQL Lab (#10336)
---
 superset-frontend/spec/javascripts/sqllab/fixtures.ts            | 5 +++++
 superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx | 9 +++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/spec/javascripts/sqllab/fixtures.ts b/superset-frontend/spec/javascripts/sqllab/fixtures.ts
index 0cdcb09..d1cedf1 100644
--- a/superset-frontend/spec/javascripts/sqllab/fixtures.ts
+++ b/superset-frontend/spec/javascripts/sqllab/fixtures.ts
@@ -323,6 +323,11 @@ export const queryWithBadColumns = {
       },
       {
         is_date: true,
+        name: '__TIME',
+        type: 'TIMESTAMP',
+      },
+      {
+        is_date: true,
         name: '__TIMESTAMP',
         type: 'TIMESTAMP',
       },
diff --git a/superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx b/superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx
index 9fba238..8ecec6f 100644
--- a/superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx
+++ b/superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx
@@ -104,7 +104,7 @@ class ExploreResultsButton extends React.PureComponent {
   getInvalidColumns() {
     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
-    const re3 = /^__/; // is not a reserved column name e.g. __timestamp
+    const re3 = /^__timestamp/i; // is not a reserved temporal column alias
 
     return this.props.query.results.selected_columns
       .map(col => col.name)
@@ -199,9 +199,10 @@ class ExploreResultsButton extends React.PureComponent {
           <strong>AS my_alias</strong>
         </code>
         ){' '}
-        {t(`limited to alphanumeric characters and underscores. Column aliases starting
-          with double underscores or ending with double underscores followed by a
-          numeric value are not allowed for reasons discussed in Github issue #5739.
+        {t(`limited to alphanumeric characters and underscores. The alias "__timestamp"
+          used as for the temporal expression and column aliases ending with
+          double underscores followed by a numeric value are not allowed for reasons
+          discussed in Github issue #5739.
           `)}
       </div>
     );