Class StructProjection

  • All Implemented Interfaces:
    StructLike

    public class StructProjection
    extends java.lang.Object
    implements StructLike
    • Method Detail

      • create

        public static StructProjection create​(Schema schema,
                                              java.util.Set<java.lang.Integer> ids)
        Creates a projecting wrapper for StructLike rows.

        This projection does not work with repeated types like lists and maps.

        Parameters:
        schema - schema of rows wrapped by this projection
        ids - field ids from the row schema to project
        Returns:
        a wrapper to project rows
      • create

        public static StructProjection create​(Schema dataSchema,
                                              Schema projectedSchema)
        Creates a projecting wrapper for StructLike rows.

        This projection does not work with repeated types like lists and maps.

        Parameters:
        dataSchema - schema of rows wrapped by this projection
        projectedSchema - result schema of the projected rows
        Returns:
        a wrapper to project rows
      • create

        public static StructProjection create​(Types.StructType structType,
                                              Types.StructType projectedStructType)
        Creates a projecting wrapper for StructLike rows.

        This projection does not work with repeated types like lists and maps.

        Parameters:
        structType - type of rows wrapped by this projection
        projectedStructType - result type of the projected rows
        Returns:
        a wrapper to project rows
      • createAllowMissing

        public static StructProjection createAllowMissing​(Types.StructType structType,
                                                          Types.StructType projectedStructType)
        Creates a projecting wrapper for StructLike rows.

        This projection allows missing fields and does not work with repeated types like lists and maps.

        Parameters:
        structType - type of rows wrapped by this projection
        projectedStructType - result type of the projected rows
        Returns:
        a wrapper to project rows
      • size

        public int size()
        Specified by:
        size in interface StructLike
      • get

        public <T> T get​(int pos,
                         java.lang.Class<T> javaClass)
        Specified by:
        get in interface StructLike
      • set

        public <T> void set​(int pos,
                            T value)
        Specified by:
        set in interface StructLike