You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by td...@apache.org on 2019/06/07 19:00:39 UTC

[phoenix] branch 4.x-HBase-1.4 updated: PHOENIX-5122: PHOENIX-4322 breaks client backward compatibility (addendum)

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

tdsilva pushed a commit to branch 4.x-HBase-1.4
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
     new 1d12f26  PHOENIX-5122: PHOENIX-4322 breaks client backward compatibility (addendum)
1d12f26 is described below

commit 1d12f269cb36c5090c4689597e313d03567cc6bc
Author: Jacob Isaac <ji...@salesforce.com>
AuthorDate: Thu Jun 6 13:05:13 2019 -0700

    PHOENIX-5122: PHOENIX-4322 breaks client backward compatibility (addendum)
---
 .../apache/phoenix/expression/RowValueConstructorExpression.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java
index c06bdc8..f92d1e2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/RowValueConstructorExpression.java
@@ -34,6 +34,7 @@ import java.util.List;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.phoenix.expression.visitor.ExpressionVisitor;
 import org.apache.phoenix.query.QueryConstants;
+import org.apache.phoenix.schema.SortOrder;
 import org.apache.phoenix.schema.tuple.Tuple;
 import org.apache.phoenix.schema.types.PDataType;
 import org.apache.phoenix.schema.types.PVarbinary;
@@ -236,12 +237,15 @@ public class RowValueConstructorExpression extends BaseCompoundExpression {
                     int outputSize = output.size();
                     byte[] outputBytes = output.getBuffer();
                     // Don't remove trailing separator byte unless it's the one for ASC
-                    // as otherwise we need it to ensure sort order is correct
+                    // as otherwise we need it to ensure sort order is correct.
+                    // Additionally for b/w compat with clients older than 4.14.1 -
+                    // If SortOorder.ASC then always strip trailing separator byte (as before)
+                    // else only strip for >= 4.14 client (when STRIP_TRAILING_SEPARATOR_BYTE bit is set)
                     for (int k = expressionCount -1 ; 
                             k >=0 &&  getChildren().get(k).getDataType() != null 
                                   && !getChildren().get(k).getDataType().isFixedWidth()
                                   && outputBytes[outputSize-1] == SchemaUtil.getSeparatorByte(true, false, getChildren().get(k))
-                                  && isStripTrailingSepByte() ; k--) {
+                                  &&  (getChildren().get(k).getSortOrder() == SortOrder.ASC ? true : isStripTrailingSepByte()) ; k--) {
                         outputSize--;
                     }
                     ptr.set(outputBytes, 0, outputSize);