This is an automated email from the ASF dual-hosted git repository.
zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new c359a95 [ZEPPELIN-4777] Fix - Number types are not sorted correctly
c359a95 is described below
commit c359a95658ea575923a1999454ef6f9e83654b0d
Author: Yurim Jin <[email protected]>
AuthorDate: Tue Aug 18 23:04:01 2020 +0900
[ZEPPELIN-4777] Fix - Number types are not sorted correctly
### What is this PR for?
**Before**
set sort type 'Number' but still sorted with string

After
Sorted with correct type

### What type of PR is it?
Bug Fix
### Todos
* [ ] - Task
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-5002
### How should this be tested?
* First time? Setup Travis CI as described on
https://zeppelin.apache.org/contribution/contributions.html#continuous-integration
* Strongly recommended: add automated unit tests for any new or changed
behavior
* Outline any manual steps to test the PR here.
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update?
* Is there breaking changes for older versions?
* Does this needs documentation?
Author: Yurim Jin <[email protected]>
Closes #3881 from milooy/fix/ZEPPELIN-4777 and squashes the following
commits:
875913c2a [Yurim Jin] Turn string into number when sort with 'Number' option
---
zeppelin-web/src/app/visualization/builtins/visualization-table.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/zeppelin-web/src/app/visualization/builtins/visualization-table.js
b/zeppelin-web/src/app/visualization/builtins/visualization-table.js
index 7baf2d4..a3243ab 100644
--- a/zeppelin-web/src/app/visualization/builtins/visualization-table.js
+++ b/zeppelin-web/src/app/visualization/builtins/visualization-table.js
@@ -140,7 +140,7 @@ export default class TableVisualization extends
Visualization {
sortingAlgorithm: function(a, b, row1, row2, sortType, gridCol) {
const colType = gridCol.colDef.type.toLowerCase();
if (colType === TableColumnType.NUMBER) {
- return self.getSortedValue(a, b);
+ return self.getSortedValue(Number(a), Number(b));
} else if (colType === TableColumnType.STRING) {
return self.getSortedValue(a.toString(), b.toString());
} else if (colType === TableColumnType.DATE) {