You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "virajjasani (via GitHub)" <gi...@apache.org> on 2023/09/25 05:53:22 UTC
[GitHub] [phoenix] virajjasani opened a new pull request, #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
virajjasani opened a new pull request, #1689:
URL: https://github.com/apache/phoenix/pull/1689
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-7046 Query results return different values when PKs of view have DESC order [phoenix]
Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani merged PR #1689:
URL: https://github.com/apache/phoenix/pull/1689
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-7046 Query results return different values when PKs of view have DESC order [phoenix]
Posted by "jpisaac (via GitHub)" <gi...@apache.org>.
jpisaac commented on PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#issuecomment-1749394977
@virajjasani Here is another case where it fails -
- When index is present on the view.
java.sql.SQLException: ERROR 201 (22000): Illegal data.
at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:651)
at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:229)
at org.apache.phoenix.schema.types.PDataType.newIllegalDataException(PDataType.java:299)
at org.apache.phoenix.schema.types.PUnsignedInt$UnsignedIntCodec.decodeInt(PUnsignedInt.java:165)
at org.apache.phoenix.schema.types.PTimestamp.toObject(PTimestamp.java:146)
at org.apache.phoenix.schema.types.PTimestamp.toObject(PTimestamp.java:37)
at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:999)
at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1003)
at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1039)
at org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:1031)
at org.apache.phoenix.compile.IndexStatementRewriter.visit(IndexStatementRewriter.java:104)
at org.apache.phoenix.compile.IndexStatementRewriter.visit(IndexStatementRewriter.java:41)
at org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
at org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
at org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
at org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
at org.apache.phoenix.parse.AndParseNode.accept(AndParseNode.java:47)
at org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
at org.apache.phoenix.parse.AndParseNode.accept(AndParseNode.java:47)
at org.apache.phoenix.parse.ParseNodeRewriter.rewrite(ParseNodeRewriter.java:92)
at org.apache.phoenix.compile.IndexStatementRewriter.translate(IndexStatementRewriter.java:88)
at org.apache.phoenix.compile.IndexStatementRewriter.translate(IndexStatementRewriter.java:75)
at org.apache.phoenix.util.IndexUtil.rewriteViewStatement(IndexUtil.java:560)
at org.apache.phoenix.util.ViewUtil.addIndexesFromParent(ViewUtil.java:577)
at org.apache.phoenix.util.ViewUtil.addDerivedColumnsAndIndexesFromParent(ViewUtil.java:655)
at org.apache.phoenix.schema.MetaDataClient.addColumnsAndIndexesFromAncestors(MetaDataClient.java:799)
at org.apache.phoenix.schema.MetaDataClient.addTableToCache(MetaDataClient.java:5092)
at org.apache.phoenix.schema.MetaDataClient.addTableToCache(MetaDataClient.java:5088)
at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:3219)
at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:889)
at org.apache.phoenix.compile.CreateTableCompiler$CreateTableMutationPlan.execute(CreateTableCompiler.java:614)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:559)
at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:525)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:524)
at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:512)
at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:2216)
at org.apache.phoenix.prefix.RowKeyPrefixTest.createTenantViewForPrefixes(RowKeyPrefixTest.java:229)
at org.apache.phoenix.prefix.RowKeyPrefixTest.testRowKeyPrefixes(RowKeyPrefixTest.java:564)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] ranganathg commented on a diff in pull request #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
Posted by "ranganathg (via GitHub)" <gi...@apache.org>.
ranganathg commented on code in PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#discussion_r1336090879
##########
phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java:
##########
@@ -412,7 +412,9 @@ public Expression visit(ColumnParseNode node) throws SQLException {
// If the column is matched in a WHERE clause against a constant not equal to it's constant, then the entire
// query would become degenerate.
if (!resolveViewConstants && IndexUtil.getViewConstantValue(column, ptr)) {
- return LiteralExpression.newConstant(column.getDataType().toObject(ptr), column.getDataType());
+ return LiteralExpression.newConstant(
Review Comment:
Isn't the sortOrder in the third parameter sufficient?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] jpisaac commented on a diff in pull request #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
Posted by "jpisaac (via GitHub)" <gi...@apache.org>.
jpisaac commented on code in PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#discussion_r1341623450
##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/DescOrderKeysIT.java:
##########
@@ -439,5 +439,121 @@ public void testDecimalDescOrderMultiplePKs() throws Exception {
}
}
+ @Test
Review Comment:
Looking good, do you want to add a test for order by clause on the key?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] virajjasani commented on a diff in pull request #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani commented on code in PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#discussion_r1338001372
##########
phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java:
##########
@@ -412,7 +412,9 @@ public Expression visit(ColumnParseNode node) throws SQLException {
// If the column is matched in a WHERE clause against a constant not equal to it's constant, then the entire
// query would become degenerate.
if (!resolveViewConstants && IndexUtil.getViewConstantValue(column, ptr)) {
- return LiteralExpression.newConstant(column.getDataType().toObject(ptr), column.getDataType());
+ return LiteralExpression.newConstant(
Review Comment:
Exactly, it seems we might not need 2nd argument, 1st one should be sufficient to avoid double invert. Let me confirm that first.
Thanks @ranganathg @jpisaac !!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] virajjasani commented on a diff in pull request #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani commented on code in PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#discussion_r1338059852
##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/DescOrderKeysIT.java:
##########
@@ -439,5 +439,121 @@ public void testDecimalDescOrderMultiplePKs() throws Exception {
}
}
+ @Test
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] virajjasani commented on a diff in pull request #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani commented on code in PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#discussion_r1341846419
##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/DescOrderKeysIT.java:
##########
@@ -439,5 +439,121 @@ public void testDecimalDescOrderMultiplePKs() throws Exception {
}
}
+ @Test
Review Comment:
done in the latest revision
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] jpisaac commented on a diff in pull request #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
Posted by "jpisaac (via GitHub)" <gi...@apache.org>.
jpisaac commented on code in PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#discussion_r1336549518
##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/DescOrderKeysIT.java:
##########
@@ -439,5 +439,121 @@ public void testDecimalDescOrderMultiplePKs() throws Exception {
}
}
+ @Test
Review Comment:
Good idea to test with various data types.
Also tests for order by clause on that field.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-7046 Query results return different values when PKs of view have DESC order [phoenix]
Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani commented on PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#issuecomment-1751236809
Thanks @jpisaac, this is taken care of in the latest revision.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] virajjasani commented on a diff in pull request #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
Posted by "virajjasani (via GitHub)" <gi...@apache.org>.
virajjasani commented on code in PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#discussion_r1341847053
##########
phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java:
##########
@@ -412,7 +412,9 @@ public Expression visit(ColumnParseNode node) throws SQLException {
// If the column is matched in a WHERE clause against a constant not equal to it's constant, then the entire
// query would become degenerate.
if (!resolveViewConstants && IndexUtil.getViewConstantValue(column, ptr)) {
- return LiteralExpression.newConstant(column.getDataType().toObject(ptr), column.getDataType());
+ return LiteralExpression.newConstant(
Review Comment:
we need 3rd argument to correctly reflect byte[] value
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [phoenix] jpisaac commented on a diff in pull request #1689: PHOENIX-7046 Query results return different values when PKs of view have DESC order
Posted by "jpisaac (via GitHub)" <gi...@apache.org>.
jpisaac commented on code in PR #1689:
URL: https://github.com/apache/phoenix/pull/1689#discussion_r1336580669
##########
phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java:
##########
@@ -412,7 +412,9 @@ public Expression visit(ColumnParseNode node) throws SQLException {
// If the column is matched in a WHERE clause against a constant not equal to it's constant, then the entire
// query would become degenerate.
if (!resolveViewConstants && IndexUtil.getViewConstantValue(column, ptr)) {
- return LiteralExpression.newConstant(column.getDataType().toObject(ptr), column.getDataType());
+ return LiteralExpression.newConstant(
Review Comment:
The toObject is used to store the value object and the third parameter is used to invert the object value to its byte representation in the LiteralExpression class. Both value and bytevalue are used in LiteralExpression class for different reasons.
Maybe need to do some due diligence - that it is not getting inverted twice?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org