Skip to content

Commit

Permalink
Add argument-less builder methods for boolean values
Browse files Browse the repository at this point in the history
The TableArgumentSpecification builder is part of SPI for declaring
Table Functions. It assumes default values for boolean table argument
properties. It is meant to provide the easiest and most intuitive way
of declaring TableFunctions.
  • Loading branch information
kasiafi committed May 23, 2022
1 parent 86db89c commit d292ded
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ public Builder name(String name)
return this;
}

public Builder rowSemantics(boolean rowSemantics)
public Builder rowSemantics()
{
this.rowSemantics = rowSemantics;
this.rowSemantics = true;
return this;
}

public Builder pruneWhenEmpty(boolean pruneWhenEmpty)
public Builder pruneWhenEmpty()
{
this.pruneWhenEmpty = pruneWhenEmpty;
this.pruneWhenEmpty = true;
return this;
}

public Builder passThroughColumns(boolean passThroughColumns)
public Builder passThroughColumns()
{
this.passThroughColumns = passThroughColumns;
this.passThroughColumns = true;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public class TestSpiBackwardCompatibility
"Field: public java.util.List<io.trino.spi.predicate.Range> io.trino.spi.predicate.BenchmarkSortedRangeSet$Data.ranges"))
.put("377", ImmutableSet.of(
"Constructor: public io.trino.spi.memory.MemoryPoolInfo(long,long,long,java.util.Map<io.trino.spi.QueryId, java.lang.Long>,java.util.Map<io.trino.spi.QueryId, java.util.List<io.trino.spi.memory.MemoryAllocation>>,java.util.Map<io.trino.spi.QueryId, java.lang.Long>)"))
.put("382", ImmutableSet.of(
"Method: public io.trino.spi.ptf.TableArgumentSpecification$Builder io.trino.spi.ptf.TableArgumentSpecification$Builder.rowSemantics(boolean)",
"Method: public io.trino.spi.ptf.TableArgumentSpecification$Builder io.trino.spi.ptf.TableArgumentSpecification$Builder.pruneWhenEmpty(boolean)",
"Method: public io.trino.spi.ptf.TableArgumentSpecification$Builder io.trino.spi.ptf.TableArgumentSpecification$Builder.passThroughColumns(boolean)"))
.buildOrThrow();

@Test
Expand Down

0 comments on commit d292ded

Please sign in to comment.