Skip to content

Commit

Permalink
remove unused properties field
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal committed Nov 25, 2024
1 parent 625b5b4 commit a620a6d
Show file tree
Hide file tree
Showing 19 changed files with 118 additions and 275 deletions.
9 changes: 3 additions & 6 deletions wren-base/src/main/java/io/wren/base/WrenMDL.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ private Manifest renderManifest(Manifest original)
processed,
model.getPrimaryKey(),
model.isCached(),
model.getRefreshTime(),
model.getProperties());
model.getRefreshTime());
}).collect(toList());

List<Metric> renderedMetrics = original.getMetrics().stream().map(metric ->
Expand All @@ -109,8 +108,7 @@ private Manifest renderManifest(Manifest original)
metric.getMeasure().stream().map(column -> renderExpression(column, macroTags, original)).collect(toList()),
metric.getTimeGrain(),
metric.isCached(),
metric.getRefreshTime(),
metric.getProperties())
metric.getRefreshTime())
).collect(toList());

return Manifest.builder(original)
Expand All @@ -132,8 +130,7 @@ private io.wren.base.dto.Column renderExpression(io.wren.base.dto.Column origina
original.getRelationship().orElse(null),
original.isCalculated(),
original.isNotNull(),
expression,
original.getProperties());
expression);
}

public String getCatalog()
Expand Down
27 changes: 7 additions & 20 deletions wren-base/src/main/java/io/wren/base/dto/Column.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;

import java.util.Map;
import java.util.Objects;
import java.util.Optional;

Expand All @@ -34,26 +32,25 @@ public class Column
private final String relationship;
private final String expression;
private final boolean isCalculated;
private final Map<String, String> properties;

public static Column column(String name, String type, String relationship, boolean notNull)
{
return new Column(name, type, relationship, false, notNull, null, null);
return new Column(name, type, relationship, false, notNull, null);
}

public static Column column(String name, String type, String relationship, boolean notNull, String expression)
{
return new Column(name, type, relationship, false, notNull, expression, null);
return new Column(name, type, relationship, false, notNull, expression);
}

public static Column relationshipColumn(String name, String type, String relationship)
{
return new Column(name, type, relationship, false, false, null, null);
return new Column(name, type, relationship, false, false, null);
}

public static Column calculatedColumn(String name, String type, String expression)
{
return new Column(name, type, null, true, false, expression, null);
return new Column(name, type, null, true, false, expression);
}

@JsonCreator
Expand All @@ -63,16 +60,14 @@ public Column(
@JsonProperty("relationship") String relationship,
@JsonProperty("isCalculated") boolean isCalculated,
@JsonProperty("notNull") boolean notNull,
@JsonProperty("expression") String expression,
@JsonProperty("properties") Map<String, String> properties)
@JsonProperty("expression") String expression)
{
this.name = requireNonNullEmpty(name, "name is null or empty");
this.type = requireNonNullEmpty(type, "type is null or empty");
this.relationship = relationship;
this.isCalculated = isCalculated;
this.notNull = notNull;
this.expression = expression == null || expression.isEmpty() ? null : expression;
this.properties = properties == null ? ImmutableMap.of() : properties;
}

@JsonProperty
Expand Down Expand Up @@ -111,12 +106,6 @@ public boolean isCalculated()
return isCalculated;
}

@JsonProperty
public Map<String, String> getProperties()
{
return properties;
}

public String getSqlExpression()
{
return getExpression().orElse(quote(name));
Expand All @@ -137,14 +126,13 @@ public boolean equals(Object obj)
Objects.equals(name, that.name) &&
Objects.equals(type, that.type) &&
Objects.equals(relationship, that.relationship) &&
Objects.equals(expression, that.expression) &&
Objects.equals(properties, that.properties);
Objects.equals(expression, that.expression);
}

@Override
public int hashCode()
{
return Objects.hash(name, type, isCalculated, notNull, relationship, expression, properties);
return Objects.hash(name, type, isCalculated, notNull, relationship, expression);
}

@Override
Expand All @@ -157,7 +145,6 @@ public String toString()
.add("isCalculated", isCalculated)
.add("relationship", relationship)
.add("expression", expression)
.add("properties", properties)
.toString();
}

Expand Down
21 changes: 4 additions & 17 deletions wren-base/src/main/java/io/wren/base/dto/CumulativeMetric.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;
import io.airlift.units.Duration;

import java.util.Map;
import java.util.Objects;

import static com.google.common.base.MoreObjects.toStringHelper;
Expand All @@ -35,7 +33,7 @@ public static CumulativeMetric cumulativeMetric(
Measure measure,
Window window)
{
return new CumulativeMetric(name, baseObject, measure, window, false, null, ImmutableMap.of());
return new CumulativeMetric(name, baseObject, measure, window, false, null);
}

private final String name;
Expand All @@ -44,7 +42,6 @@ public static CumulativeMetric cumulativeMetric(
private final Window window;
private final boolean cached;
private final Duration refreshTime;
private final Map<String, String> properties;

@JsonCreator
public CumulativeMetric(
Expand All @@ -53,16 +50,14 @@ public CumulativeMetric(
@JsonProperty("measure") Measure measure,
@JsonProperty("window") Window window,
@JsonProperty("cached") boolean cached,
@JsonProperty("refreshTime") Duration refreshTime,
@JsonProperty("properties") Map<String, String> properties)
@JsonProperty("refreshTime") Duration refreshTime)
{
this.name = requireNonNullEmpty(name, "name is null or empty");
this.baseObject = requireNonNullEmpty(baseObject, "baseObject is null or empty");
this.measure = requireNonNull(measure, "measure is null");
this.window = requireNonNull(window, "window is null");
this.cached = cached;
this.refreshTime = refreshTime;
this.properties = properties == null ? ImmutableMap.of() : properties;
}

@JsonProperty
Expand Down Expand Up @@ -101,16 +96,10 @@ public Duration getRefreshTime()
return refreshTime;
}

@JsonProperty
public Map<String, String> getProperties()
{
return properties;
}

@Override
public int hashCode()
{
return Objects.hash(name, baseObject, measure, window, cached, refreshTime, properties);
return Objects.hash(name, baseObject, measure, window, cached, refreshTime);
}

@Override
Expand All @@ -130,8 +119,7 @@ public boolean equals(Object o)
Objects.equals(baseObject, that.baseObject) &&
Objects.equals(measure, that.measure) &&
Objects.equals(window, that.window) &&
Objects.equals(refreshTime, that.refreshTime) &&
Objects.equals(properties, that.properties);
Objects.equals(refreshTime, that.refreshTime);
}

@Override
Expand All @@ -144,7 +132,6 @@ public String toString()
.add("window", window)
.add("cached", cached)
.add("refreshTime", refreshTime)
.add("properties", properties)
.toString();
}
}
21 changes: 4 additions & 17 deletions wren-base/src/main/java/io/wren/base/dto/DateSpine.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;

import java.util.Map;
import java.util.Objects;

import static com.google.common.base.MoreObjects.toStringHelper;
Expand All @@ -27,24 +25,21 @@

public class DateSpine
{
public static final DateSpine DEFAULT = new DateSpine(TimeUnit.DAY, "1970-01-01", "2077-12-31", null);
public static final DateSpine DEFAULT = new DateSpine(TimeUnit.DAY, "1970-01-01", "2077-12-31");

private final TimeUnit unit;
private final String start;
private final String end;
private final Map<String, String> properties;

@JsonCreator
public DateSpine(
@JsonProperty("unit") TimeUnit unit,
@JsonProperty("start") String start,
@JsonProperty("end") String end,
@JsonProperty("properties") Map<String, String> properties)
@JsonProperty("end") String end)
{
this.unit = requireNonNull(unit, "unit is null");
this.start = requireNonNullEmpty(start, "start is null or empty");
this.end = requireNonNullEmpty(end, "end is null or empty");
this.properties = properties == null ? ImmutableMap.of() : properties;
}

@JsonProperty
Expand All @@ -65,20 +60,13 @@ public String getEnd()
return end;
}

@JsonProperty
public Map<String, String> getProperties()
{
return properties;
}

@Override
public String toString()
{
return toStringHelper(this)
.add("unit", unit)
.add("start", start)
.add("end", end)
.add("properties", properties)
.toString();
}

Expand All @@ -94,13 +82,12 @@ public boolean equals(Object o)
DateSpine dateSpine = (DateSpine) o;
return unit == dateSpine.unit &&
Objects.equals(start, dateSpine.start) &&
Objects.equals(end, dateSpine.end) &&
Objects.equals(properties, dateSpine.properties);
Objects.equals(end, dateSpine.end);
}

@Override
public int hashCode()
{
return Objects.hash(unit, start, end, properties);
return Objects.hash(unit, start, end);
}
}
22 changes: 4 additions & 18 deletions wren-base/src/main/java/io/wren/base/dto/EnumDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

Expand All @@ -31,22 +29,19 @@ public class EnumDefinition
{
public static EnumDefinition enumDefinition(String name, List<EnumValue> values)
{
return new EnumDefinition(name, values, ImmutableMap.of());
return new EnumDefinition(name, values);
}

private final String name;
private final List<EnumValue> values;
private final Map<String, String> properties;

@JsonCreator
public EnumDefinition(
@JsonProperty("name") String name,
@JsonProperty("values") List<EnumValue> values,
@JsonProperty("properties") Map<String, String> properties)
@JsonProperty("values") List<EnumValue> values)
{
this.name = requireNonNullEmpty(name, "name is null or empty");
this.values = requireNonNull(values);
this.properties = properties == null ? ImmutableMap.of() : properties;
}

@JsonProperty
Expand All @@ -61,12 +56,6 @@ public String getName()
return name;
}

@JsonProperty
public Map<String, String> getProperties()
{
return properties;
}

public Optional<EnumValue> valueOf(String enumValueName)
{
return values.stream()
Expand All @@ -85,17 +74,15 @@ public boolean equals(Object obj)
}
EnumDefinition that = (EnumDefinition) obj;
return Objects.equals(name, that.name) &&
Objects.equals(values, that.values) &&
Objects.equals(properties, that.properties);
Objects.equals(values, that.values);
}

@Override
public int hashCode()
{
return Objects.hash(
name,
values,
properties);
values);
}

@Override
Expand All @@ -104,7 +91,6 @@ public String toString()
return toStringHelper(this)
.add("name", name)
.add("values", values)
.add("properties", properties)
.toString();
}
}
Loading

0 comments on commit a620a6d

Please sign in to comment.