mirror of https://github.com/apache/cassandra
Fix NPE when writetime() or ttl() are nested inside a fn call
Patch by Tyler Hobbs; reviewed by Benjamin Lerer for CASSANDRA-8451
This commit is contained in:
parent
ac9cfbd9ae
commit
3f3d0edbad
|
|
@ -1,4 +1,6 @@
|
|||
2.0.12:
|
||||
* Fix NPE when writetime() or ttl() calls are wrapped by
|
||||
another function call (CASSANDRA-8451)
|
||||
* Fix NPE after dropping a keyspace (CASSANDRA-8332)
|
||||
* Fix error message on read repair timeouts (CASSANDRA-7947)
|
||||
* Default DTCS base_time_seconds changed to 60 (CASSANDRA-8417)
|
||||
|
|
|
|||
|
|
@ -186,11 +186,8 @@ public abstract class Selection
|
|||
{
|
||||
Selector selector = makeSelector(cfDef, rawSelector, names, metadata);
|
||||
selectors.add(selector);
|
||||
if (selector instanceof WritetimeOrTTLSelector)
|
||||
{
|
||||
collectTimestamps |= ((WritetimeOrTTLSelector)selector).isWritetime;
|
||||
collectTTLs |= !((WritetimeOrTTLSelector)selector).isWritetime;
|
||||
}
|
||||
collectTimestamps |= selector.usesTimestamps();
|
||||
collectTTLs |= selector.usesTTLs();
|
||||
}
|
||||
return new SelectionWithProcessing(names, metadata, selectors, collectTimestamps, collectTTLs);
|
||||
}
|
||||
|
|
@ -374,6 +371,12 @@ public abstract class Selection
|
|||
private interface Selector extends AssignementTestable
|
||||
{
|
||||
public ByteBuffer compute(ResultSetBuilder rs) throws InvalidRequestException;
|
||||
|
||||
/** Returns true if the selector acts on a column's timestamp, false otherwise. */
|
||||
public boolean usesTimestamps();
|
||||
|
||||
/** Returns true if the selector acts on a column's TTL, false otherwise. */
|
||||
public boolean usesTTLs();
|
||||
}
|
||||
|
||||
private static class SimpleSelector implements Selector
|
||||
|
|
@ -399,6 +402,16 @@ public abstract class Selection
|
|||
return receiver.type.isValueCompatibleWith(type);
|
||||
}
|
||||
|
||||
public boolean usesTimestamps()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean usesTTLs()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
@ -431,6 +444,22 @@ public abstract class Selection
|
|||
return receiver.type.isValueCompatibleWith(fun.returnType());
|
||||
}
|
||||
|
||||
public boolean usesTimestamps()
|
||||
{
|
||||
for (Selector s : argSelectors)
|
||||
if (s.usesTimestamps())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean usesTTLs()
|
||||
{
|
||||
for (Selector s : argSelectors)
|
||||
if (s.usesTTLs())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
@ -476,6 +505,17 @@ public abstract class Selection
|
|||
return receiver.type.isValueCompatibleWith(isWritetime ? LongType.instance : Int32Type.instance);
|
||||
}
|
||||
|
||||
|
||||
public boolean usesTimestamps()
|
||||
{
|
||||
return isWritetime;
|
||||
}
|
||||
|
||||
public boolean usesTTLs()
|
||||
{
|
||||
return !isWritetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue