[
https://issues.apache.org/jira/browse/PHOENIX-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14494543#comment-14494543
]
James Taylor commented on PHOENIX-1861:
---------------------------------------
This patch isn't quite right. Instead of using the default sort order, you need
to use the sort order associated with the column (see my inline comment below).
It's possible that this will affect some existing unit tests
{code}
Index: phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
(date 1428969945000)
+++ phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java
(revision )
@@ -1210,7 +1210,7 @@
Integer length = getColumn().getMaxLength();
if (length != null) {
// Go through type to pad as the fill character
depends on the type.
- type.pad(ptr, length);
+ type.pad(ptr, length, SortOrder.getDefault()); //
SHOULD BE getColumn().getSortOrder()
}
}
byte[] key = ByteUtil.copyKeyBytesIfNecessary(ptr);
Index: phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
(date 1428969945000)
+++ phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
(revision )
@@ -703,7 +703,7 @@
Integer maxLength = column.getMaxLength();
if (!isNull && type.isFixedWidth() && maxLength != null) {
if (ptr.getLength() <= maxLength) {
- type.pad(ptr, maxLength);
+ type.pad(ptr, maxLength, SortOrder.getDefault()); //
SHOULD BE column.getSortOrder()
} else if (ptr.getLength() > maxLength) {
throw new
DataExceedsCapacityException(name.getString() + "." +
column.getName().getString() + " may not exceed " + maxLength + " bytes (" +
type.toObject(byteValue) + ")");
}
{code}
> Padding character should be inverted if sort order is descending
> ----------------------------------------------------------------
>
> Key: PHOENIX-1861
> URL: https://issues.apache.org/jira/browse/PHOENIX-1861
> Project: Phoenix
> Issue Type: Bug
> Reporter: James Taylor
> Assignee: Dumindu Buddhika
> Attachments:
> PHOENIX-1861_Padding_character_should_be_inverted_if_sort_order_is_descending.patch
>
>
> The padding character should be inverted if the sort order is descending.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)