Added asNumber to OrderByColumnSpec#940
Conversation
There was a problem hiding this comment.
Please have an explicit type parameter here if at all possible, rather than Object
|
It will be great, if you can add unit test for this feature. |
|
Can one of the admins verify this patch? |
1 similar comment
|
Can one of the admins verify this patch? |
|
@drcrallen @nishantmonu51 I added test case and did some code clean up. And sorry for taking so long. |
|
Thanks @flowbehappy few more comments: If a dimension is called "id" I would expect it to be a high cardinality dimension rather than just " |
|
@drcrallen Totally agree. I will generate another more real test data. |
8b0ec82 to
d05032b
Compare
|
@cheddar @himanshug @xvrl any thoughts here? My biggest high level concern is that it only Longs are supported, but it is a useful feature. |
There was a problem hiding this comment.
It does not seem too hard to make this feature complete by adding support for doubles as well.
We can use a regex here instead to detect if its a double value or long value or something else. Accordingly use Double.parseDouble(..) or Long.parseLong(..) .
And in the compare above add another case to handle Doubles.
Also, you can refactor this code a little bit by having a private method like
private Comparable getDimensionValue() {
}
and calling return getDimensionValue(dimList.get(0));
|
I believe this use case is addressed by #3270 through "dimensionOrder": "numeric". |
This commit make dimension can be sorted numerically(only "long" here) besides lexicographically. e.g