Merged
Conversation
c78127f to
9576f50
Compare
9576f50 to
7d2286a
Compare
7d2286a to
88a3f4a
Compare
52abc41 to
3b88983
Compare
3b88983 to
b73e9f6
Compare
b73e9f6 to
4ee092a
Compare
electrum
approved these changes
Jun 24, 2023
Member
There was a problem hiding this comment.
We need to catch E | RuntimeException here and even out the blocks using the code below
Member
Author
There was a problem hiding this comment.
Turns out you can't catch a type variable, but for this case we are catching and rethrowing so we can just use Exception
core/trino-main/src/main/java/io/trino/operator/scalar/RowToRowCast.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/sql/gen/RowConstructorCodeGenerator.java
Outdated
Show resolved
Hide resolved
core/trino-spi/src/main/java/io/trino/spi/block/MapBlockBuilder.java
Outdated
Show resolved
Hide resolved
Member
There was a problem hiding this comment.
This method already exists in CompilerOperations
Member
Author
There was a problem hiding this comment.
That class is not available in the SPI
...ino-main/src/main/java/io/trino/operator/aggregation/listagg/ListaggAggregationFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/block/AbstractTestBlock.java
Outdated
Show resolved
Hide resolved
The Slice methods on ArrayType date back to the first implementation of array and have been replaced by methods operating on Block
Support using NOT DISTINCT FROM to build the map hash table. This rejects less key than the current strict mode, which uses EQUALS.
The beginEntry paradigm is confusing and inefficient. It requires array, map, and row block builders to use a synthetic wrapper block during the build, and this wrapper is inefficient due to call site pollution, but also make it difficult to extend blocks with new behavior, as the wrappers would have to pass through the extended behaviors.
Replace VariableWidthBlockBuilder beginEntry, write*, closeEntry with buildEntry Replace Block writeBytesTo with Block getSlice with SliceOutput argument
4ee092a to
e9294dc
Compare
martint
reviewed
Jun 24, 2023
core/trino-spi/src/main/java/io/trino/spi/block/MapBlockBuilder.java
Outdated
Show resolved
Hide resolved
Member
|
fyi @osscm .. this one made it into 421 |
Member
|
The developer guide still references |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR simplifies
BlockBuilderby removing all write methods from theinterface. Each
BlockBuilderimplementation still has awritemethod, andTypeimplementations simply downcast the expected implementation type.This change is only possible with the removal of the wrapper
BlockBuildertypes SingleArrayBlockWriter, SingleMapBlockWriter, and SingleRowBlockWriter.
These classes have been replaced with a single lambda
writeEntrymethodon
ArrayBlockBuilder,MapBlockBuilder, andRowBlockBuilder, that callsback with the nested field builders. Since there is now a single
writeEntrymethod, there is no need for the
beginBlockEntryandcloseEntrymethods.To simplify the transition to the new
writeEntrymethod, this PR includesa new helper class for building array, map, and row values in functions. The
ArrayValueBuilder,MapValueBuilder, andRowValueBuilderinterfaces havea simple build value method to build a single value of related kind, and each
of these has a related buffered class that can be used to share allocation
buffers across multiple value build calls. This replaces the pattern of
using a
PageBuilderas a buffer in function implementations.Additionally,
MapBlockBuilderhas been extended with astrictNotDistinctFromthat builds the map hash table using
NOT DISTINCT FROMsemantics. This isremoves the need to use
TypedSetto determine duplicates, and is much moreefficient. This behavior is also supported in
BufferedMapValueBuilderwiththe
createBufferedDistinctStrictstatic factory method.Added
Int128BlockBuilder.writeInt128Fixed12BlockBuilder.writeFixed12Block.getSlicewithSliceOutputargument (to replaceBlock.writeBytesTo)ArrayValueBuilder.buildArrayValueandBufferedArrayValueBuilderMapValueBuilder.buildMapValueandBufferedMapValueBuilderRowValueBuilder.buildRowValueandBufferedRowValueBuilderNOT DISTINCT FROMsupport inMapBlockBuilderandBufferedMapValueBuilderArrayBlockBuilder.writeEntryMapBlockBuilder.writeEntryRowBlockBuilder.writeEntryLambdaMetafactoryGeneratorto simplify bytecode generation of lambda method callsRemoved
BlockBuilder.writeBytesBlockBuilder.writeShortBlockBuilder.writeIntBlockBuilder.writeLongBlockBuilder.beginBlockEntryBlockBuilder.closeEntrySingleArrayBlockWriterSingleMapBlockWriterSingleRowBlockWriterRelease notes
(X) Release notes are required, with the following suggested text: