Skip to content

Commit

Permalink
refactoring and rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
elliVM committed Nov 19, 2024
1 parent 829b143 commit 0cff473
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public Dataset<Row> get(Dataset<Row> dataset) {
* @return Dataset unmodified
*/
private Dataset<Row> createBloomFilter(Dataset<Row> dataset) {
new FilterTypes(zeppelinConfig).saveFilterTypesToDatabase(regex);
new FilterTypes(zeppelinConfig).saveToDatabase(regex);
new BloomFilterTable(zeppelinConfig, tableName).create();
dataset.foreachPartition(new BloomFilterForeachPartitionFunction(zeppelinConfig, tableName, regex));
return dataset;
Expand All @@ -156,7 +156,7 @@ private Dataset<Row> createBloomFilter(Dataset<Row> dataset) {
* @return Dataset unmodified
*/
private Dataset<Row> updateBloomFilter(Dataset<Row> dataset) {
new FilterTypes(zeppelinConfig).saveFilterTypesToDatabase(regex);
new FilterTypes(zeppelinConfig).saveToDatabase(regex);
new BloomFilterTable(zeppelinConfig, tableName).create();
dataset.foreachPartition(new BloomFilterForeachPartitionFunction(zeppelinConfig, tableName, regex, true));
return dataset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private String sizesJsonString() {
}

/** Save filter types with a given regex pattern */
public void saveFilterTypesToDatabase(String regex) {
public void saveToDatabase(String regex) {
final Connection connection = new LazyConnection(config).get();
final SortedMap<Long, Double> filterSizeMap = sortedMap();
for (final Map.Entry<Long, Double> entry : filterSizeMap.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

import java.util.Objects;

public class JournalDBNameFromConfig {
public final class JournalDBNameFromConfig {

private final Config config;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@
import com.typesafe.config.ConfigFactory;
import org.apache.spark.util.sketch.BloomFilter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -119,7 +116,7 @@ public void testBitSizeMapMethod() {
public void testWriteFilterTypesToDatabase() {
String regex = "test_regex";
Config config = ConfigFactory.parseProperties(defaultProperties());
Assertions.assertDoesNotThrow(() -> new FilterTypes(config).saveFilterTypesToDatabase(regex));
Assertions.assertDoesNotThrow(() -> new FilterTypes(config).saveToDatabase(regex));

Assertions.assertDoesNotThrow(() -> {
ResultSet result = conn.prepareStatement("SELECT * FROM filtertype").executeQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ void setEnv() {
"[" + "{expected: 10000, fpp: 0.01}," + "{expected: 20000, fpp: 0.03},"
+ "{expected: 30000, fpp: 0.05}" + "]"
);
properties.put("dpl.pth_06.bloom.pattern", pattern);
properties.put("dpl.pth_06.bloom.table.name", tableName);
Config config = ConfigFactory.parseProperties(properties);
lazyConnection = new LazyConnection(config);
Connection conn = lazyConnection.get();
Expand Down

0 comments on commit 0cff473

Please sign in to comment.