Skip to content

Commit

Permalink
Move WinningBids into the queries package
Browse files Browse the repository at this point in the history
  • Loading branch information
iemejia committed Aug 23, 2017
1 parent a6dbdfa commit a39cb80
Show file tree
Hide file tree
Showing 31 changed files with 25 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import org.apache.beam.integration.nexmark.model.Event;
import org.apache.beam.integration.nexmark.model.KnownSize;
import org.apache.beam.integration.nexmark.model.Person;
import org.apache.beam.integration.nexmark.queries.NexmarkQuery;
import org.apache.beam.integration.nexmark.queries.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.queries.Query0;
import org.apache.beam.integration.nexmark.queries.Query0Model;
import org.apache.beam.integration.nexmark.queries.Query1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
import java.io.OutputStream;
import java.io.Serializable;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.WinningBids;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.coders.CoderException;
import org.apache.beam.sdk.coders.CustomCoder;

/**
* Result of {@link WinningBids} transform.
* Result of {@link org.apache.beam.integration.nexmark.queries.WinningBids} transform.
*/
public class AuctionBid implements KnownSize, Serializable {
public static final Coder<AuctionBid> CODER = new CustomCoder<AuctionBid>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
* limitations under the License.
*/

package org.apache.beam.integration.nexmark;
package org.apache.beam.integration.nexmark.queries;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;

import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
import org.apache.beam.sdk.values.TimestampedValue;
import org.joda.time.Duration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.beam.integration.nexmark;
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.Monitor;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.Bid;
import org.apache.beam.integration.nexmark.model.Event;
Expand All @@ -41,8 +44,8 @@
*/
public abstract class NexmarkQuery
extends PTransform<PCollection<Event>, PCollection<TimestampedValue<KnownSize>>> {
protected static final TupleTag<Auction> AUCTION_TAG = new TupleTag<>("auctions");
protected static final TupleTag<Bid> BID_TAG = new TupleTag<>("bids");
public static final TupleTag<Auction> AUCTION_TAG = new TupleTag<>("auctions");
public static final TupleTag<Bid> BID_TAG = new TupleTag<>("bids");
protected static final TupleTag<Person> PERSON_TAG = new TupleTag<>("person");

/** Predicate to detect a new person event. */
Expand Down Expand Up @@ -169,7 +172,7 @@ public void processElement(ProcessContext c) {
/**
* Transform to filter for just the new auction events.
*/
protected static final PTransform<PCollection<Event>, PCollection<Auction>> JUST_NEW_AUCTIONS =
public static final PTransform<PCollection<Event>, PCollection<Auction>> JUST_NEW_AUCTIONS =
new PTransform<PCollection<Event>, PCollection<Auction>>("justNewAuctions") {
@Override
public PCollection<Auction> expand(PCollection<Event> input) {
Expand All @@ -181,7 +184,7 @@ public PCollection<Auction> expand(PCollection<Event> input) {
/**
* Transform to filter for just the new person events.
*/
protected static final PTransform<PCollection<Event>, PCollection<Person>> JUST_NEW_PERSONS =
public static final PTransform<PCollection<Event>, PCollection<Person>> JUST_NEW_PERSONS =
new PTransform<PCollection<Event>, PCollection<Person>>("justNewPersons") {
@Override
public PCollection<Person> expand(PCollection<Event> input) {
Expand All @@ -193,7 +196,7 @@ public PCollection<Person> expand(PCollection<Event> input) {
/**
* Transform to filter for just the bid events.
*/
protected static final PTransform<PCollection<Event>, PCollection<Bid>> JUST_BIDS =
public static final PTransform<PCollection<Event>, PCollection<Bid>> JUST_BIDS =
new PTransform<PCollection<Event>, PCollection<Bid>>("justBids") {
@Override
public PCollection<Bid> expand(PCollection<Event> input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.beam.integration.nexmark;
package org.apache.beam.integration.nexmark.queries;

import java.io.Serializable;
import java.util.ArrayList;
Expand All @@ -25,6 +25,7 @@
import java.util.List;
import java.util.Set;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.model.KnownSize;
import org.apache.beam.sdk.transforms.SerializableFunction;
import org.apache.beam.sdk.values.TimestampedValue;
Expand All @@ -40,7 +41,7 @@
* applied against the actual query results to check their consistency with the model.
*/
public abstract class NexmarkQueryModel implements Serializable {
protected final NexmarkConfiguration configuration;
public final NexmarkConfiguration configuration;

public NexmarkQueryModel(NexmarkConfiguration configuration) {
this.configuration = configuration;
Expand Down Expand Up @@ -86,7 +87,7 @@ protected static <T> Set<String> toValue(Iterator<TimestampedValue<T>> itr) {
}

/** Return simulator for query. */
protected abstract AbstractSimulator<?, ?> simulator();
public abstract AbstractSimulator<?, ?> simulator();

/** Return sub-sequence of results which are significant for model. */
protected Iterable<TimestampedValue<KnownSize>> relevantResults(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.IOException;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Event;
import org.apache.beam.integration.nexmark.model.KnownSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import java.util.Collection;
import java.util.Iterator;

import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Event;
import org.apache.beam.sdk.values.TimestampedValue;
Expand Down Expand Up @@ -56,7 +54,7 @@ public Query0Model(NexmarkConfiguration configuration) {
}

@Override
protected AbstractSimulator<?, ?> simulator() {
public AbstractSimulator<?, ?> simulator() {
return new Simulator(configuration);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Bid;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.concurrent.ThreadLocalRandom;
import javax.annotation.Nullable;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Done;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Bid;
import org.apache.beam.integration.nexmark.model.BidsPerSession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Bid;
import org.apache.beam.integration.nexmark.model.BidsPerSession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import java.util.Collection;
import java.util.Iterator;

import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Bid;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.AuctionPrice;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import java.util.Collection;
import java.util.Iterator;

import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.AuctionPrice;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import java.util.Iterator;
import java.util.Map;

import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

import org.apache.beam.integration.nexmark.Monitor;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.WinningBids;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.AuctionBid;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.WinningBidsSimulator;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.AuctionBid;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Arrays;
import java.util.List;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.AuctionCount;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.AuctionCount;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import java.util.Collections;
import java.util.List;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.WinningBids;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.AuctionBid;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.WinningBidsSimulator;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.AuctionBid;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Bid;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
import java.util.Iterator;
import java.util.List;

import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Bid;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.WinningBids;
import org.apache.beam.integration.nexmark.model.AuctionBid;
import org.apache.beam.integration.nexmark.model.Event;
import org.apache.beam.integration.nexmark.model.KnownSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
import java.util.Collection;
import java.util.Iterator;

import org.apache.beam.integration.nexmark.AbstractSimulator;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.WinningBidsSimulator;
import org.apache.beam.sdk.values.TimestampedValue;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.beam.integration.nexmark;
package org.apache.beam.integration.nexmark.queries;

import static com.google.common.base.Preconditions.checkState;

Expand All @@ -30,6 +30,8 @@
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.AuctionBid;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.beam.integration.nexmark;
package org.apache.beam.integration.nexmark.queries;

import java.util.ArrayList;
import java.util.Iterator;
Expand All @@ -26,6 +26,8 @@
import java.util.TreeSet;
import javax.annotation.Nullable;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.Auction;
import org.apache.beam.integration.nexmark.model.AuctionBid;
import org.apache.beam.integration.nexmark.model.Bid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package org.apache.beam.integration.nexmark.queries;

import org.apache.beam.integration.nexmark.NexmarkConfiguration;
import org.apache.beam.integration.nexmark.NexmarkQuery;
import org.apache.beam.integration.nexmark.NexmarkQueryModel;
import org.apache.beam.integration.nexmark.NexmarkUtils;
import org.apache.beam.integration.nexmark.model.KnownSize;
import org.apache.beam.sdk.PipelineResult;
Expand Down

0 comments on commit a39cb80

Please sign in to comment.