-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make partition aggregation examples more readable
- Loading branch information
Showing
3 changed files
with
231 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
hazelcast-sql/src/test/java/com/hazelcast/jet/sql/impl/connector/map/model/Order.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright 2023 Hazelcast Inc. | ||
* | ||
* Licensed under the Hazelcast Community License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://hazelcast.com/hazelcast-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.hazelcast.jet.sql.impl.connector.map.model; | ||
|
||
import java.io.Serializable; | ||
import java.math.BigDecimal; | ||
import java.time.LocalDateTime; | ||
import java.util.Objects; | ||
|
||
public class Order implements Serializable { | ||
private BigDecimal amount; | ||
private LocalDateTime orderDate; | ||
private LocalDateTime deliveryDate; | ||
|
||
public enum Priority { | ||
NORMAL, URGENT | ||
}; | ||
|
||
private Priority priority; | ||
|
||
public BigDecimal getAmount() { | ||
return amount; | ||
} | ||
|
||
public void setAmount(BigDecimal amount) { | ||
this.amount = amount; | ||
} | ||
|
||
public LocalDateTime getOrderDate() { | ||
return orderDate; | ||
} | ||
|
||
public void setOrderDate(LocalDateTime orderDate) { | ||
this.orderDate = orderDate; | ||
} | ||
|
||
public LocalDateTime getDeliveryDate() { | ||
return deliveryDate; | ||
} | ||
|
||
public void setDeliveryDate(LocalDateTime deliveryDate) { | ||
this.deliveryDate = deliveryDate; | ||
} | ||
|
||
public Priority getPriority() { | ||
return priority; | ||
} | ||
|
||
public void setPriority(Priority priority) { | ||
this.priority = priority; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Order{" + | ||
"amount=" + amount + | ||
", orderDate=" + orderDate + | ||
", deliveryDate=" + deliveryDate + | ||
", priority=" + priority + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Order order = (Order) o; | ||
return Objects.equals(amount, order.amount) && Objects.equals(orderDate, order.orderDate) && Objects.equals(deliveryDate, order.deliveryDate) && priority == order.priority; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(amount, orderDate, deliveryDate, priority); | ||
} | ||
|
||
} |
86 changes: 86 additions & 0 deletions
86
hazelcast-sql/src/test/java/com/hazelcast/jet/sql/impl/connector/map/model/OrderKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright 2023 Hazelcast Inc. | ||
* | ||
* Licensed under the Hazelcast Community License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://hazelcast.com/hazelcast-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.hazelcast.jet.sql.impl.connector.map.model; | ||
|
||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
public class OrderKey implements Serializable { | ||
// FK, business partitioning key | ||
private String customerId; | ||
// PK, should be unique | ||
private long orderId; | ||
// attribute added for tests as a non-unique, non-partitioned attribute, not much practical use | ||
private String country; | ||
|
||
public OrderKey() { | ||
} | ||
|
||
public OrderKey(String customerId, long orderId, String country) { | ||
this.customerId = customerId; | ||
this.orderId = orderId; | ||
this.country = country; | ||
} | ||
|
||
public String getCustomerId() { | ||
return customerId; | ||
} | ||
|
||
public void setCustomerId(String customerId) { | ||
this.customerId = customerId; | ||
} | ||
|
||
public long getOrderId() { | ||
return orderId; | ||
} | ||
|
||
public void setOrderId(long orderId) { | ||
this.orderId = orderId; | ||
} | ||
|
||
public String getCountry() { | ||
return country; | ||
} | ||
|
||
public void setCountry(String country) { | ||
this.country = country; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
OrderKey orderKey = (OrderKey) o; | ||
return orderId == orderKey.orderId; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(orderId); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "OrderKey{" + | ||
"customerId='" + customerId + '\'' + | ||
", orderId=" + orderId + | ||
", country='" + country + '\'' + | ||
'}'; | ||
} | ||
|
||
|
||
} |