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) {
|
public static BoundStatement bindStatement(BoundStatement bound, CqlIdentifier colname, Object colval, DataType coltype) {
|
||||||
|
|
||||||
return switch (coltype) {
|
if (coltype instanceof PrimitiveType pt) {
|
||||||
case PrimitiveType pt -> switch (pt.getProtocolCode()) {
|
return switch (pt.getProtocolCode()) {
|
||||||
case CUSTOM -> throw new OpConfigError("Error with Custom DataType");
|
case CUSTOM -> throw new OpConfigError("Error with Custom DataType");
|
||||||
case ASCII, VARCHAR -> bound.setString(colname, (String) colval);
|
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 BLOB -> bound.setByteBuffer(colname, (ByteBuffer) colval);
|
||||||
case BOOLEAN -> bound.setBoolean(colname, (boolean) colval);
|
case BOOLEAN -> bound.setBoolean(colname, (boolean) colval);
|
||||||
case DECIMAL ->bound.setBigDecimal(colname, (BigDecimal) colval);
|
case DECIMAL -> bound.setBigDecimal(colname, (BigDecimal) colval);
|
||||||
case DOUBLE ->bound.setDouble(colname, (double) colval);
|
case DOUBLE -> bound.setDouble(colname, (double) colval);
|
||||||
case FLOAT ->bound.setFloat(colname, (float) colval);
|
case FLOAT -> bound.setFloat(colname, (float) colval);
|
||||||
case INT, SMALLINT, TINYINT -> bound.setInt(colname, (int) colval);
|
case INT, SMALLINT, TINYINT -> bound.setInt(colname, (int) colval);
|
||||||
case TIMESTAMP -> bound.setInstant(colname, (Instant) colval);
|
case TIMESTAMP -> bound.setInstant(colname, (Instant) colval);
|
||||||
case TIMEUUID, UUID ->bound.setUuid(colname, (UUID) colval);
|
case TIMEUUID, UUID -> bound.setUuid(colname, (UUID) colval);
|
||||||
case VARINT ->bound.setBigInteger(colname, (BigInteger) colval);
|
case VARINT -> bound.setBigInteger(colname, (BigInteger) colval);
|
||||||
case INET ->bound.setInetAddress(colname, (InetAddress) colval);
|
case INET -> bound.setInetAddress(colname, (InetAddress) colval);
|
||||||
case DATE ->bound.setLocalDate(colname, (LocalDate) colval);
|
case DATE -> bound.setLocalDate(colname, (LocalDate) colval);
|
||||||
case TIME -> bound.setLocalTime(colname, (LocalTime) colval);
|
case TIME -> bound.setLocalTime(colname, (LocalTime) colval);
|
||||||
case DURATION ->bound.setCqlDuration(colname, (CqlDuration) colval);
|
case DURATION -> bound.setCqlDuration(colname, (CqlDuration) colval);
|
||||||
case LIST -> bound.setList(colname,(List)colval,((List)colval).get(0).getClass());
|
case LIST -> bound.setList(colname, (List) colval, ((List) colval).get(0).getClass());
|
||||||
case MAP -> {
|
case MAP -> {
|
||||||
Map map = (Map) colval;
|
Map map = (Map) colval;
|
||||||
Set<Map.Entry> entries = map.entrySet();
|
Set<Map.Entry> entries = map.entrySet();
|
||||||
Optional<Map.Entry> first = entries.stream().findFirst();
|
Optional<Map.Entry> first = entries.stream().findFirst();
|
||||||
if (first.isPresent()) {
|
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 {
|
} else {
|
||||||
yield bound.setMap(colname,map,Object.class,Object.class);
|
yield bound.setMap(colname, map, Object.class, Object.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case SET -> {
|
case SET -> {
|
||||||
Set set = (Set)colval;
|
Set set = (Set) colval;
|
||||||
Optional first = set.stream().findFirst();
|
Optional first = set.stream().findFirst();
|
||||||
if (first.isPresent()) {
|
if (first.isPresent()) {
|
||||||
yield bound.setSet(colname,set,first.get().getClass());
|
yield bound.setSet(colname, set, first.get().getClass());
|
||||||
} else {
|
} else {
|
||||||
yield bound.setSet(colname,Set.of(),Object.class);
|
yield bound.setSet(colname, Set.of(), Object.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case UDT -> {
|
case UDT -> {
|
||||||
@ -98,13 +98,12 @@ public class CQLD4PreparedStmtDiagnostics {
|
|||||||
}
|
}
|
||||||
case TUPLE -> {
|
case TUPLE -> {
|
||||||
TupleValue tuple = (TupleValue) colval;
|
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>
|
<source>17</source>
|
||||||
<release>17</release>
|
<release>17</release>
|
||||||
<compilerArgs>
|
<compilerArgs>
|
||||||
--enable-preview
|
<!-- <compilerArg>-Xdoclint:all</compilerArg>-->
|
||||||
|
<!-- <compilerArg>-Xlint:all</compilerArg>-->
|
||||||
</compilerArgs>
|
</compilerArgs>
|
||||||
<!--<compilerArgument>-Xdoclint:all</compilerArgument>-->
|
|
||||||
<!-- <compilerArgument>-Xlint:all</compilerArgument>-->
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
@ -474,9 +473,6 @@
|
|||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.0.0-M6</version>
|
<version>3.0.0-M6</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>--enable-preview</argLine>
|
|
||||||
|
|
||||||
<!-- <argLine>--enable-preview</argLine>-->
|
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>**/*Integrated*Test*.java</exclude>
|
<exclude>**/*Integrated*Test*.java</exclude>
|
||||||
<exclude>**/*IntegrationTest.java</exclude>
|
<exclude>**/*IntegrationTest.java</exclude>
|
||||||
@ -505,8 +501,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>--enable-preview</argLine>
|
|
||||||
<!-- <argLine>--enable-preview</argLine>-->
|
|
||||||
<forkCount>1</forkCount>
|
<forkCount>1</forkCount>
|
||||||
<reuseForks>false</reuseForks>
|
<reuseForks>false</reuseForks>
|
||||||
<includes>
|
<includes>
|
||||||
@ -537,9 +531,8 @@
|
|||||||
<!-- <additionalparam>-Xdoclint:none</additionalparam>-->
|
<!-- <additionalparam>-Xdoclint:none</additionalparam>-->
|
||||||
<additionalOptions>
|
<additionalOptions>
|
||||||
<additionalOption>-Xdoclint:none</additionalOption>
|
<additionalOption>-Xdoclint:none</additionalOption>
|
||||||
<additionalOption>--enable-preview</additionalOption>
|
|
||||||
</additionalOptions>
|
</additionalOptions>
|
||||||
<!-- <additionalJOption>-Xdoclint:none --enable-preview</additionalJOption>-->
|
<!-- <additionalJOption>-Xdoclint:none</additionalJOption>-->
|
||||||
<doclint>none</doclint>
|
<doclint>none</doclint>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
Loading…
Reference in New Issue
Block a user