mirror of https://github.com/apache/cassandra
Remove remaining driver dependencies from server code
patch by Andy Tolbert; reviewed by Stefan Miklosovic for CASSANDRA-20327
This commit is contained in:
parent
3a5d828638
commit
19007f374c
|
|
@ -33,7 +33,6 @@ import java.util.stream.StreamSupport;
|
|||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import com.datastax.driver.core.CodecUtils;
|
||||
import org.apache.cassandra.cql3.functions.types.LocalDate;
|
||||
import org.apache.cassandra.cql3.statements.SelectStatement;
|
||||
import org.apache.cassandra.db.Clustering;
|
||||
|
|
@ -442,7 +441,13 @@ public abstract class UntypedResultSet implements Iterable<UntypedResultSet.Row>
|
|||
return TimestampType.instance.compose(data.get(column));
|
||||
}
|
||||
|
||||
public LocalDate getDate(String column) { return LocalDate.fromDaysSinceEpoch(CodecUtils.fromUnsignedToSignedInt(data.get(column).getInt()));}
|
||||
public LocalDate getDate(String column)
|
||||
{
|
||||
// date type is stored as an unsigned byte; convert it back by adding MIN_VALUE.
|
||||
int unsigned = data.get(column).getInt();
|
||||
int signed = unsigned + Integer.MIN_VALUE;
|
||||
return LocalDate.fromDaysSinceEpoch(signed);
|
||||
}
|
||||
|
||||
public long getLong(String column)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -134,12 +134,6 @@ public abstract class UDFunction extends UserFunction implements ScalarFunction
|
|||
// Only need to disallow a pattern, if it would otherwise be allowed via allowedPatterns
|
||||
private static final String[] disallowedPatterns =
|
||||
{
|
||||
"com/datastax/driver/core/Cluster.class",
|
||||
"com/datastax/driver/core/Metrics.class",
|
||||
"com/datastax/driver/core/NettyOptions.class",
|
||||
"com/datastax/driver/core/Session.class",
|
||||
"com/datastax/driver/core/Statement.class",
|
||||
"com/datastax/driver/core/TimestampGenerator.class", // indirectly covers ServerSideTimestampGenerator + ThreadLocalMonotonicTimestampGenerator
|
||||
"java/lang/Compiler.class",
|
||||
"java/lang/InheritableThreadLocal.class",
|
||||
"java/lang/Package.class",
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ import org.apache.cassandra.utils.logging.LoggingSupportFactory;
|
|||
* Custom {@link SecurityManager} and {@link Policy} implementation that only performs access checks
|
||||
* if explicitly enabled.
|
||||
* <p>
|
||||
* This implementation gives no measurable performance penalty
|
||||
* (see <a href="http://cstar.datastax.com/tests/id/1d461628-12ba-11e5-918f-42010af0688f">see cstar test</a>).
|
||||
* This is better than the penalty of 1 to 3 percent using a standard {@code SecurityManager} with an <i>allow all</i> policy.
|
||||
* </p>
|
||||
*/
|
||||
|
|
@ -216,6 +214,7 @@ public final class ThreadAwareSecurityManager extends SecurityManager
|
|||
|
||||
// required by JavaDriver 2.2.0-rc3 and 3.0.0-a2 or newer
|
||||
// code in com.datastax.driver.core.CodecUtils uses Guava stuff, which in turns requires this permission
|
||||
// TODO: Evaluate removing this once the driver is removed as a dependency (see CASSANDRA-20326).
|
||||
if (CHECK_MEMBER_ACCESS_PERMISSION.equals(perm))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,16 +41,6 @@ public class PreparedStatementHelper
|
|||
return statement.getPreparedId().boundValuesMetadata.id;
|
||||
}
|
||||
|
||||
public static void assertStable(PreparedStatement first, PreparedStatement subsequent)
|
||||
{
|
||||
if (!id(first).equals(id(subsequent)))
|
||||
{
|
||||
throw new AssertionError(String.format("Subsequent id (%s) is different from the first one (%s)",
|
||||
id(first),
|
||||
id(subsequent)));
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertHashWithoutKeyspace(PreparedStatement statement, String queryString, String ks)
|
||||
{
|
||||
MD5Digest returned = id(statement);
|
||||
Loading…
Reference in New Issue