Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public interface FieldValueGetter<ObjectT, ValueT> extends Serializable {
@Nullable
ValueT get(ObjectT object);

/** Returns the raw value of the getter before any further transformations. */
default @Nullable Object getRaw(ObjectT object) {
return get(object);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public abstract class Row implements Serializable {
/** Return the size of data fields. */
public abstract int getFieldCount();

/** Return the list of data values. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify the meaning of "raw" here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the comment @TheNeuralBit. For context, here's @reuvenlax's explanation of getValues.
From that it sounds like this shouldn't be publicly consumed and should also be annotated with @Internal.

getValues() is maybe poorly named - might be better called getRawValues. What you're looking for is probably the getBaseValues() method.
getValues is mostly used in code that knows exactly what it's doing for optimization purposes. It goes along with the attachValues method, which is similarly tricky to use. It's there to enable 0-copy code, but not necessarily intended for general consumption.

/** Return the list of raw unmodified data values to enable 0-copy code. */
@Internal
public abstract List<Object> getValues();

/** Return a list of data values. Any LogicalType values are returned as base values. * */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.TreeMap;
import org.apache.beam.sdk.annotations.Experimental;
import org.apache.beam.sdk.annotations.Experimental.Kind;
import org.apache.beam.sdk.annotations.Internal;
import org.apache.beam.sdk.schemas.Factory;
import org.apache.beam.sdk.schemas.FieldValueGetter;
import org.apache.beam.sdk.schemas.Schema;
Expand Down Expand Up @@ -88,6 +89,8 @@ public int getFieldCount() {
return getters.size();
}

/** Return the list of raw unmodified data values to enable 0-copy code. */
@Internal
@Override
public List<Object> getValues() {
List<Object> rawValues = new ArrayList<>(getters.size());
Expand Down