Skip to content

Commit 44a1aff

Browse files
authored
Storage updates (#87)
1 parent ca0c99a commit 44a1aff

22 files changed

+1621
-318
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.yahoo.bullet</groupId>
66
<artifactId>bullet-core</artifactId>
7-
<version>1.1.1-SNAPSHOT</version>
7+
<version>1.2.0-SNAPSHOT</version>
88
<packaging>jar</packaging>
99
<name>bullet-core</name>
1010

@@ -48,8 +48,8 @@
4848
</dependency>
4949
<dependency>
5050
<groupId>org.mockito</groupId>
51-
<artifactId>mockito-all</artifactId>
52-
<version>1.10.19</version>
51+
<artifactId>mockito-core</artifactId>
52+
<version>3.5.7</version>
5353
<scope>test</scope>
5454
</dependency>
5555
<dependency>

src/main/java/com/yahoo/bullet/common/BulletConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public Schema getSchema() {
372372
* should use a {@link Validator} to define the appropriate definitions, casters and defaults to use. You
373373
* should call this method before you use the config if you set additional settings to ensure that all configurations
374374
* are valid.
375-
*
375+
* <p>
376376
* This class defines a validator for all the fields it knows about. If you subclass it and define your own fields,
377377
* you should {@link #getValidator()} and add entries and relationships that you need to validate. Make sure
378378
* to call this method from your override if you wish validate your new definitions.
@@ -428,7 +428,7 @@ private static Object mapifyMetadata(Object metadata) {
428428

429429
@SuppressWarnings("unchecked")
430430
private static boolean alreadySetMetadata(Object metadata) {
431-
if (metadata == null || !(metadata instanceof Map)) {
431+
if (!(metadata instanceof Map)) {
432432
return false;
433433
}
434434
try {

src/main/java/com/yahoo/bullet/common/SerializerDeserializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static <U extends Serializable> byte[] toBytes(U object) {
5252
oos.writeObject(object);
5353
return bos.toByteArray();
5454
} catch (IOException | RuntimeException e) {
55-
log.error("Could not serialize given object", object);
55+
log.error("Could not serialize given object {}", object);
5656
log.error("Exception was: ", e);
5757
}
5858
return null;

src/main/java/com/yahoo/bullet/common/Utilities.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,23 @@ public static <K, V> Map<K, V> requireNonNull(Map<K, V> map) {
130130
return map;
131131
}
132132

133+
/**
134+
* Adds the given mapping to the given {@link Map} if the value is not null.
135+
*
136+
* @param map The map to check.
137+
* @param key The key to add.
138+
* @param value The value to add if not null.
139+
* @param <K> The type of the map key.
140+
* @param <V> The type of the map value.
141+
* @return The map.
142+
*/
143+
public static <K, V> Map<K, V> putNotNull(Map<K, V> map, K key, V value) {
144+
if (value != null) {
145+
map.put(key, value);
146+
}
147+
return map;
148+
}
149+
133150
/**
134151
* Rounds a double up to the specified number of places.
135152
*

src/main/java/com/yahoo/bullet/pubsub/PubSub.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ public abstract class PubSub {
2222
/**
2323
* The context determines how the {@link Publisher} and {@link Subscriber} returned by PubSub behave. For example,
2424
* If the Context is {@link Context#QUERY_SUBMISSION}:
25-
* 1. Publishers write to request queue.
26-
* 2. Subscribers read from the response queue.
25+
* <ol>
26+
* <li>Publishers write to request queue</li>
27+
* <li>Subscribers read from the response queue</li>
28+
* </ol>
2729
* If the Context is {@link Context#QUERY_PROCESSING}:
28-
* 1. Publishers write to response queue.
29-
* 2. Subscribers read from the request queue.
30+
* <ol>
31+
* <li>Publishers write to response queue</li>
32+
* <li>Subscribers read from the request queue</li>
33+
* </ol>
3034
*/
3135
public enum Context {
3236
QUERY_SUBMISSION,

src/main/java/com/yahoo/bullet/querying/QueryCategorizer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
/**
1616
* This categorizes running queries into whether they are done, closed, have exceeded the rate limits or have new data.
17-
* Running queries
18-
* are provided as a {@link Map} of String query IDs to non-null, valid, initialized {@link Querier} objects.
19-
*
17+
* Running queries are provided as a {@link Map} of String query IDs to non-null, valid, initialized {@link Querier}
18+
* objects.
19+
* <p>
2020
* Use {@link #categorize(Map)} and {@link #categorize(BulletRecord, Map)}for categorizing queries. The latter
2121
* categorizes after making the Querier instances {@link Querier#consume(BulletRecord)}.
2222
*/

0 commit comments

Comments
 (0)