Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHOENIX-7046 Query results return different values when PKs of view have DESC order #1689

Merged
merged 4 commits into from
Oct 11, 2023

Conversation

virajjasani
Copy link
Contributor

No description provided.

@@ -439,5 +439,121 @@ public void testDecimalDescOrderMultiplePKs() throws Exception {
}
}

@Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to test with various data types.
Also tests for order by clause on that field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, do you want to add a test for order by clause on the key?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in the latest revision

@jpisaac
Copy link
Contributor

jpisaac commented Oct 5, 2023

@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)

@virajjasani
Copy link
Contributor Author

Thanks @jpisaac, this is taken care of in the latest revision.

Copy link
Contributor

@jpisaac jpisaac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1 Thanks @virajjasani

@virajjasani virajjasani merged commit 14c1717 into apache:master Oct 11, 2023
0 of 6 checks passed
virajjasani added a commit that referenced this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants