Skip to content

Commit 49e4a17

Browse files
committed
Delete unused methods
Detected using http://www.ucdetector.org/.
1 parent 4c84691 commit 49e4a17

21 files changed

Lines changed: 0 additions & 166 deletions

src/sqlancer/Main.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,6 @@ public void writeCurrentNoLineBreak(String queryString) {
186186
write(queryString, "");
187187
}
188188

189-
public void logRowNotFound(StateToReproduce state) {
190-
printState(getLogFileWriter(), state);
191-
try {
192-
getLogFileWriter().flush();
193-
} catch (IOException e) {
194-
throw new AssertionError(e);
195-
}
196-
}
197-
198189
public void logException(Throwable reduce, StateToReproduce state) {
199190
String stackTrace = getStackTrace(reduce);
200191
FileWriter logFileWriter2 = getLogFileWriter();
@@ -275,12 +266,6 @@ public void incrementCreateDatabase() {
275266

276267
}
277268

278-
public static void printArray(Object... arr) {
279-
for (Object o : arr) {
280-
System.out.println(o);
281-
}
282-
}
283-
284269
public static void main(String[] args) {
285270
System.exit(executeMain(args));
286271
}

src/sqlancer/Randomly.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,6 @@ public static long getNonCachedInteger() {
437437
return getThreadRandom().get().nextLong();
438438
}
439439

440-
public static long getPositiveNonCachedInteger() {
441-
return getNextLong(1, Long.MAX_VALUE);
442-
}
443-
444440
public static long getPositiveOrZeroNonCachedInteger() {
445441
return getNextLong(0, Long.MAX_VALUE);
446442
}

src/sqlancer/StateToReproduce.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,8 @@ public class StateToReproduce {
1818

1919
protected long seedValue;
2020

21-
public String values;
22-
2321
String exception;
2422

25-
public String queryTargetedTablesString;
26-
27-
public String queryTargetedColumnsString;
28-
2923
public OracleRunReproductionState localState;
3024

3125
public StateToReproduce(String databaseName) {
@@ -114,10 +108,6 @@ public void executedWithoutError() {
114108
this.success = true;
115109
}
116110

117-
public void log(Query q) {
118-
statements.add(q);
119-
}
120-
121111
public void log(String s) {
122112
statements.add(new QueryAdapter(s));
123113
}

src/sqlancer/citus/gen/CitusCommon.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
import sqlancer.citus.CitusBugs;
44
import sqlancer.common.query.ExpectedErrors;
5-
import sqlancer.postgres.PostgresGlobalState;
6-
import sqlancer.postgres.PostgresSchema.PostgresTable;
7-
import sqlancer.postgres.gen.PostgresCommon;
85

96
public final class CitusCommon {
107

@@ -73,10 +70,4 @@ public static void addCitusErrors(ExpectedErrors errors) {
7370
}
7471
}
7572

76-
public static void addTableConstraint(StringBuilder sb, PostgresTable table, PostgresGlobalState globalState,
77-
ExpectedErrors errors) {
78-
PostgresCommon.addTableConstraint(sb, table, globalState, errors);
79-
CitusCommon.addCitusErrors(errors);
80-
}
81-
8273
}

src/sqlancer/cockroachdb/ast/CockroachDBAggregate.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ public static List<CockroachDBAggregateFunction> getAggregates(CockroachDBDataTy
7878
this.supportedReturnTypes = supportedReturnTypes.clone();
7979
}
8080

81-
public static CockroachDBAggregateFunction getRandom() {
82-
return Randomly.fromOptions(values());
83-
}
84-
8581
public static CockroachDBAggregateFunction getRandomMetamorphicOracle() {
8682
// not: VARIANCE, STDDEV, SQRDIFF
8783
return Randomly.fromOptions(SUM, SUM_INT, MIN, MAX, XOR_AGG, BIT_AND, BIT_OR, BOOL_AND, BOOL_OR, COUNT, AVG,

src/sqlancer/cockroachdb/ast/CockroachDBUnaryArithmeticOperation.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package sqlancer.cockroachdb.ast;
22

3-
import sqlancer.Randomly;
43
import sqlancer.cockroachdb.ast.CockroachDBUnaryArithmeticOperation.CockroachDBUnaryAritmeticOperator;
54
import sqlancer.common.ast.BinaryOperatorNode.Operator;
65
import sqlancer.common.ast.UnaryOperatorNode;
@@ -17,10 +16,6 @@ public enum CockroachDBUnaryAritmeticOperator implements Operator {
1716
this.textRepr = textRepr;
1817
}
1918

20-
public static CockroachDBUnaryAritmeticOperator getRandom() {
21-
return Randomly.fromOptions(values());
22-
}
23-
2419
@Override
2520
public String getTextRepresentation() {
2621
return textRepr;

src/sqlancer/cockroachdb/ast/CockroachDBUnaryPostfixOperation.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package sqlancer.cockroachdb.ast;
22

3-
import sqlancer.Randomly;
43
import sqlancer.cockroachdb.ast.CockroachDBUnaryPostfixOperation.CockroachDBUnaryPostfixOperator;
54
import sqlancer.common.ast.BinaryOperatorNode.Operator;
65
import sqlancer.common.ast.UnaryOperatorNode;
@@ -21,10 +20,6 @@ public enum CockroachDBUnaryPostfixOperator implements Operator {
2120
this.s = s;
2221
}
2322

24-
public static CockroachDBUnaryPostfixOperator getRandom() {
25-
return Randomly.fromOptions(values());
26-
}
27-
2823
@Override
2924
public String getTextRepresentation() {
3025
return s;

src/sqlancer/common/schema/AbstractTable.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.Collections;
44
import java.util.List;
5-
import java.util.function.Function;
65
import java.util.stream.Collectors;
76

87
import sqlancer.GlobalState;
@@ -60,10 +59,6 @@ public String getColumnsAsString() {
6059
return columns.stream().map(c -> c.getName()).collect(Collectors.joining(", "));
6160
}
6261

63-
public String getColumnsAsString(Function<C, String> function) {
64-
return columns.stream().map(function).collect(Collectors.joining(", "));
65-
}
66-
6762
public C getRandomColumn() {
6863
return Randomly.fromList(columns);
6964
}

src/sqlancer/common/schema/AbstractTables.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ public List<C> getColumns() {
3030
return columns;
3131
}
3232

33-
public String columnNamesAsString() {
34-
return getColumns().stream().map(t -> t.getTable().getName() + "." + t.getName())
35-
.collect(Collectors.joining(", "));
36-
}
37-
3833
public String columnNamesAsString(Function<C, String> function) {
3934
return getColumns().stream().map(function).collect(Collectors.joining(", "));
4035
}

src/sqlancer/duckdb/DuckDBSchema.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ public static class DuckDBCompositeDataType {
3434

3535
private final int size;
3636

37-
public DuckDBCompositeDataType(DuckDBDataType dataType) {
38-
this.dataType = dataType;
39-
this.size = -1;
40-
}
41-
4237
public DuckDBCompositeDataType(DuckDBDataType dataType, int size) {
4338
this.dataType = dataType;
4439
this.size = size;
@@ -78,10 +73,6 @@ public static DuckDBCompositeDataType getRandom() {
7873
return new DuckDBCompositeDataType(type, size);
7974
}
8075

81-
public static DuckDBCompositeDataType getInt(int size) {
82-
return new DuckDBCompositeDataType(DuckDBDataType.INT, size);
83-
}
84-
8576
@Override
8677
public String toString() {
8778
switch (getPrimitiveDataType()) {
@@ -214,10 +205,6 @@ public DuckDBTable(String tableName, List<DuckDBColumn> columns, boolean isView)
214205
super(tableName, columns, Collections.emptyList(), isView);
215206
}
216207

217-
public boolean hasPrimaryKey() {
218-
return getColumns().stream().anyMatch(c -> c.isPrimaryKey());
219-
}
220-
221208
}
222209

223210
public static DuckDBSchema fromConnection(Connection con, String databaseName) throws SQLException {

0 commit comments

Comments
 (0)