Spelling: replace substract with subtract (#37055)

This commit is contained in:
Josh Soref 2019-01-02 08:15:21 -05:00 committed by Luca Cavanna
parent 565a95c382
commit 51cb63f934
6 changed files with 15 additions and 15 deletions

View File

@ -612,7 +612,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
.collect(toList()));
AttributeSet missing = resolvedRefs.substract(o.child().outputSet());
AttributeSet missing = resolvedRefs.subtract(o.child().outputSet());
if (!missing.isEmpty()) {
// Add missing attributes but project them away afterwards
@ -648,7 +648,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
.filter(Expression::resolved)
.collect(toList()));
AttributeSet missing = resolvedRefs.substract(f.child().outputSet());
AttributeSet missing = resolvedRefs.subtract(f.child().outputSet());
if (!missing.isEmpty()) {
// Again, add missing attributes and project them away
@ -695,7 +695,7 @@ public class Analyzer extends RuleExecutor<LogicalPlan> {
if (plan instanceof Project) {
Project p = (Project) plan;
AttributeSet diff = missing.substract(p.child().outputSet());
AttributeSet diff = missing.subtract(p.child().outputSet());
return new Project(p.location(), propagateMissing(p.child(), diff, failed), combine(p.projections(), missing));
}

View File

@ -175,7 +175,7 @@ public class AttributeMap<E> {
delegate.putAll(other.delegate);
}
public AttributeMap<E> substract(AttributeMap<E> other) {
public AttributeMap<E> subtract(AttributeMap<E> other) {
AttributeMap<E> diff = new AttributeMap<>();
for (Entry<AttributeWrapper, E> entry : this.delegate.entrySet()) {
if (!other.delegate.containsKey(entry.getKey())) {

View File

@ -57,8 +57,8 @@ public class AttributeSet implements Set<Attribute> {
delegate.addAll(other.delegate);
}
public AttributeSet substract(AttributeSet other) {
return new AttributeSet(delegate.substract(other.delegate));
public AttributeSet subtract(AttributeSet other) {
return new AttributeSet(delegate.subtract(other.delegate));
}
public AttributeSet intersect(AttributeSet other) {

View File

@ -76,7 +76,7 @@ public class BinaryArithmeticProcessor extends FunctionalBinaryProcessor<Object,
return Arithmetics.sub((ZonedDateTime) l, ((IntervalDayTime) r).interval());
}
if (r instanceof ZonedDateTime && l instanceof Interval<?>) {
throw new SqlIllegalArgumentException("Cannot substract a date from an interval; do you mean the reverse?");
throw new SqlIllegalArgumentException("Cannot subtract a date from an interval; do you mean the reverse?");
}
throw new SqlIllegalArgumentException("Cannot compute [-] between [{}] [{}]", l.getClass().getSimpleName(),

View File

@ -79,19 +79,19 @@ public class AttributeMapTests extends ESTestCase {
assertThat(m.containsValue("on"), is(false));
}
public void testSubstract() {
public void testSubtract() {
AttributeMap<String> m = threeMap();
AttributeMap<String> mo = new AttributeMap<>(m.keySet().iterator().next(), "one");
AttributeMap<String> empty = new AttributeMap<>();
assertThat(m.substract(empty), is(m));
assertThat(m.substract(m), is(empty));
assertThat(mo.substract(m), is(empty));
assertThat(m.subtract(empty), is(m));
assertThat(m.subtract(m), is(empty));
assertThat(mo.subtract(m), is(empty));
AttributeMap<String> substract = m.substract(mo);
AttributeMap<String> subtract = m.subtract(mo);
assertThat(substract.size(), is(2));
assertThat(substract.attributeNames(), contains("two", "three"));
assertThat(subtract.size(), is(2));
assertThat(subtract.attributeNames(), contains("two", "three"));
}
public void testIntersect() {

View File

@ -139,7 +139,7 @@ public class BinaryArithmeticTests extends ESTestCase {
TemporalAmount t = Period.ofYears(100).plusMonths(50);
Literal r = interval(t, INTERVAL_HOUR);
SqlIllegalArgumentException ex = expectThrows(SqlIllegalArgumentException.class, () -> sub(r, l));
assertEquals("Cannot substract a date from an interval; do you mean the reverse?", ex.getMessage());
assertEquals("Cannot subtract a date from an interval; do you mean the reverse?", ex.getMessage());
}
public void testSubNumberFromIntervalIllegal() {