You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "rwelgosh (via GitHub)" <gi...@apache.org> on 2024/10/18 15:20:54 UTC
[PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
rwelgosh opened a new pull request, #3621:
URL: https://github.com/apache/cassandra/pull/3621
Adds a duration check to hidden types, such as composite and dynamic composite types, so that 2i indexes cannot be created with nested durations.
Within composite and dynamic composite types' files, the referencesDuration method was overridden to check if any subtypes reference duration. A property test was also added in AbstractTypeTest to make sure that nested types with duration type within return the correct value for reference duration.
patch by rwelgosh; CASSANDRA-19890
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1806961235
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,31 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
+ assertThat(type.referencesDuration()).isTrue();
+ });
+ }
+
+ @Test
+ public void nestedWithoutDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withoutPrimitive(DurationType.instance).build()).checkAssert(type -> {
+ assertThat(type.referencesDuration()).isFalse();
+ });
+ }
+
+ @Test
+ public void nonDurationPrimitives()
Review Comment:
this is the same test as `nestedWithoutDuration`, can you delete?
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1806960263
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,31 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
Review Comment:
```suggestion
qt().forAll(AbstractTypeGenerators.builder().withPrimitives(DurationType.instance).build()).checkAssert(type -> {
```
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "pmcfadin (via GitHub)" <gi...@apache.org>.
pmcfadin closed pull request #3621: CASSANDRA-19890: type system contains check for duration does not work for hidden types
URL: https://github.com/apache/cassandra/pull/3621
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1806960263
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,31 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
Review Comment:
```suggestion
qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
```
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1806790461
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,15 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().withShrinkCycles(0).forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
Review Comment:
```suggestion
qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
```
we disable shrinks by default so you don't need to in the test
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "yifan-c (via GitHub)" <gi...@apache.org>.
yifan-c commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1809153930
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,25 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
+ assertThat(type.referencesDuration()).isTrue();
+
+ assertThat(ReversedType.getInstance(type).referencesDuration()).isTrue();
+ });
Review Comment:
(cosmetic) nit: similarly for other new test cases added in this patch, break the long lines into multiple-line statement.
```suggestion
qt()
.forAll(AbstractTypeGenerators.builder()
.withoutTypeKinds(COUNTER)
.withPrimitives(DurationType.instance)
.build())
.checkAssert(type -> {
assertThat(type.referencesDuration()).isTrue();
assertThat(ReversedType.getInstance(type).referencesDuration()).isTrue();
});
```
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1809525291
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,32 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder()
+ .withoutTypeKinds(COUNTER)
+ .withPrimitives(DurationType.instance)
+ .build())
+ .checkAssert(type -> {
+ assertThat(type.referencesDuration()).isTrue();
+ assertThat(ReversedType.getInstance(type).referencesDuration()).isTrue();
+ });
+ }
+
+ @Test
+ public void nestedWithoutDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder()
+ .withoutTypeKinds(PRIMITIVE, COUNTER)
+ .withoutPrimitive(DurationType.instance)
+ .build())
+ .checkAssert(type -> {
+ assertThat(type.referencesDuration()).isFalse();
Review Comment:
can you add `ReversedType`
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1806791084
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,15 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().withShrinkCycles(0).forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
+ assertThat(type.referencesDuration());
Review Comment:
I think you want `.isFalse()` at the end, this doesn't actually assert or check things
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "pmcfadin (via GitHub)" <gi...@apache.org>.
pmcfadin commented on PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#issuecomment-4227137323
Closing as [CASSANDRA-19890](https://issues.apache.org/jira/browse/CASSANDRA-19890) has been resolved as Fixed — if this PR contains changes not captured in the merged fix, please reopen.
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1806960700
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,31 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
+ assertThat(type.referencesDuration()).isTrue();
+ });
+ }
+
+ @Test
+ public void nestedWithoutDuration()
+ {
+ qt().forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withoutPrimitive(DurationType.instance).build()).checkAssert(type -> {
Review Comment:
```suggestion
qt().forAll(AbstractTypeGenerators.builder().withoutPrimitive(DurationType.instance).build()).checkAssert(type -> {
```
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1806958604
##########
src/java/org/apache/cassandra/db/marshal/AbstractType.java:
##########
@@ -641,7 +641,14 @@ public AbstractType<?> expandUserTypes()
public boolean referencesDuration()
{
- return false;
+ for (AbstractType<?> type : subTypes())
+ {
+ if (type.referencesDuration())
+ {
+ return true;
+ }
+ }
+ return false;
Review Comment:
formatting you have extra spaces
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19890: type system contains check for duration does not work for hidden types [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3621:
URL: https://github.com/apache/cassandra/pull/3621#discussion_r1806795856
##########
test/unit/org/apache/cassandra/db/marshal/AbstractTypeTest.java:
##########
@@ -460,6 +460,15 @@ public void nested()
});
}
+ @Test
+ @SuppressWarnings("rawtypes")
+ public void nestedDuration()
+ {
+ qt().withShrinkCycles(0).forAll(AbstractTypeGenerators.builder().withoutTypeKinds(PRIMITIVE, COUNTER).withPrimitives(DurationType.instance).build()).checkAssert(type -> {
Review Comment:
this generator doesn't produce `ReversedType`, only the table generator does that...
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org