mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-27 19:20:42 -06:00
remove pattern matching in switch syntax and remove --enable-preview completely. It is too onerous for users at runtime.
This commit is contained in:
parent
5aaae15592
commit
1437029eb3
@ -54,42 +54,42 @@ public class CQLD4PreparedStmtDiagnostics {
|
||||
|
||||
public static BoundStatement bindStatement(BoundStatement bound, CqlIdentifier colname, Object colval, DataType coltype) {
|
||||
|
||||
return switch (coltype) {
|
||||
case PrimitiveType pt -> switch (pt.getProtocolCode()) {
|
||||
if (coltype instanceof PrimitiveType pt) {
|
||||
return switch (pt.getProtocolCode()) {
|
||||
case CUSTOM -> throw new OpConfigError("Error with Custom DataType");
|
||||
case ASCII, VARCHAR -> bound.setString(colname, (String) colval);
|
||||
case BIGINT, COUNTER ->bound.setLong(colname, (long) colval);
|
||||
case BIGINT, COUNTER -> bound.setLong(colname, (long) colval);
|
||||
case BLOB -> bound.setByteBuffer(colname, (ByteBuffer) colval);
|
||||
case BOOLEAN -> bound.setBoolean(colname, (boolean) colval);
|
||||
case DECIMAL ->bound.setBigDecimal(colname, (BigDecimal) colval);
|
||||
case DOUBLE ->bound.setDouble(colname, (double) colval);
|
||||
case FLOAT ->bound.setFloat(colname, (float) colval);
|
||||
case DECIMAL -> bound.setBigDecimal(colname, (BigDecimal) colval);
|
||||
case DOUBLE -> bound.setDouble(colname, (double) colval);
|
||||
case FLOAT -> bound.setFloat(colname, (float) colval);
|
||||
case INT, SMALLINT, TINYINT -> bound.setInt(colname, (int) colval);
|
||||
case TIMESTAMP -> bound.setInstant(colname, (Instant) colval);
|
||||
case TIMEUUID, UUID ->bound.setUuid(colname, (UUID) colval);
|
||||
case VARINT ->bound.setBigInteger(colname, (BigInteger) colval);
|
||||
case INET ->bound.setInetAddress(colname, (InetAddress) colval);
|
||||
case DATE ->bound.setLocalDate(colname, (LocalDate) colval);
|
||||
case TIMEUUID, UUID -> bound.setUuid(colname, (UUID) colval);
|
||||
case VARINT -> bound.setBigInteger(colname, (BigInteger) colval);
|
||||
case INET -> bound.setInetAddress(colname, (InetAddress) colval);
|
||||
case DATE -> bound.setLocalDate(colname, (LocalDate) colval);
|
||||
case TIME -> bound.setLocalTime(colname, (LocalTime) colval);
|
||||
case DURATION ->bound.setCqlDuration(colname, (CqlDuration) colval);
|
||||
case LIST -> bound.setList(colname,(List)colval,((List)colval).get(0).getClass());
|
||||
case DURATION -> bound.setCqlDuration(colname, (CqlDuration) colval);
|
||||
case LIST -> bound.setList(colname, (List) colval, ((List) colval).get(0).getClass());
|
||||
case MAP -> {
|
||||
Map map = (Map) colval;
|
||||
Set<Map.Entry> entries = map.entrySet();
|
||||
Optional<Map.Entry> first = entries.stream().findFirst();
|
||||
if (first.isPresent()) {
|
||||
yield bound.setMap(colname,map,first.get().getKey().getClass(),first.get().getValue().getClass());
|
||||
yield bound.setMap(colname, map, first.get().getKey().getClass(), first.get().getValue().getClass());
|
||||
} else {
|
||||
yield bound.setMap(colname,map,Object.class,Object.class);
|
||||
yield bound.setMap(colname, map, Object.class, Object.class);
|
||||
}
|
||||
}
|
||||
case SET -> {
|
||||
Set set = (Set)colval;
|
||||
Set set = (Set) colval;
|
||||
Optional first = set.stream().findFirst();
|
||||
if (first.isPresent()) {
|
||||
yield bound.setSet(colname,set,first.get().getClass());
|
||||
yield bound.setSet(colname, set, first.get().getClass());
|
||||
} else {
|
||||
yield bound.setSet(colname,Set.of(),Object.class);
|
||||
yield bound.setSet(colname, Set.of(), Object.class);
|
||||
}
|
||||
}
|
||||
case UDT -> {
|
||||
@ -98,13 +98,12 @@ public class CQLD4PreparedStmtDiagnostics {
|
||||
}
|
||||
case TUPLE -> {
|
||||
TupleValue tuple = (TupleValue) colval;
|
||||
yield bound.setTupleValue(colname,tuple);
|
||||
yield bound.setTupleValue(colname, tuple);
|
||||
}
|
||||
default-> throw new RuntimeException("Unknown CQL type for diagnostic (type:'" + coltype +"',code:'" + coltype.getProtocolCode()+"'");
|
||||
default -> throw new RuntimeException("Unknown CQL type for diagnostic (type:'" + coltype + "',code:'" + coltype.getProtocolCode() + "'");
|
||||
};
|
||||
|
||||
default -> throw new IllegalStateException("Unexpected value: " + coltype);
|
||||
};
|
||||
}
|
||||
throw new IllegalStateException("Unexpected value: " + coltype);
|
||||
|
||||
}
|
||||
|
||||
|
@ -462,10 +462,9 @@
|
||||
<source>17</source>
|
||||
<release>17</release>
|
||||
<compilerArgs>
|
||||
--enable-preview
|
||||
<!-- <compilerArg>-Xdoclint:all</compilerArg>-->
|
||||
<!-- <compilerArg>-Xlint:all</compilerArg>-->
|
||||
</compilerArgs>
|
||||
<!--<compilerArgument>-Xdoclint:all</compilerArgument>-->
|
||||
<!-- <compilerArgument>-Xlint:all</compilerArgument>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@ -474,9 +473,6 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M6</version>
|
||||
<configuration>
|
||||
<argLine>--enable-preview</argLine>
|
||||
|
||||
<!-- <argLine>--enable-preview</argLine>-->
|
||||
<excludes>
|
||||
<exclude>**/*Integrated*Test*.java</exclude>
|
||||
<exclude>**/*IntegrationTest.java</exclude>
|
||||
@ -505,8 +501,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<argLine>--enable-preview</argLine>
|
||||
<!-- <argLine>--enable-preview</argLine>-->
|
||||
<forkCount>1</forkCount>
|
||||
<reuseForks>false</reuseForks>
|
||||
<includes>
|
||||
@ -537,9 +531,8 @@
|
||||
<!-- <additionalparam>-Xdoclint:none</additionalparam>-->
|
||||
<additionalOptions>
|
||||
<additionalOption>-Xdoclint:none</additionalOption>
|
||||
<additionalOption>--enable-preview</additionalOption>
|
||||
</additionalOptions>
|
||||
<!-- <additionalJOption>-Xdoclint:none --enable-preview</additionalJOption>-->
|
||||
<!-- <additionalJOption>-Xdoclint:none</additionalJOption>-->
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
<executions>
|
||||
|
Loading…
Reference in New Issue
Block a user