Class NeutralItemType

java.lang.Object
org.rumbledb.types.NeutralItemType
All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable, Serializable, ItemType

public class NeutralItemType extends Object implements ItemType
Neutral element ItemType for aggregation operations. This type serves as the neutral element in Spark aggregation operations and ensures that any real ItemType combined with it returns the real ItemType.
See Also:
  • Constructor Details

    • NeutralItemType

      public NeutralItemType()
  • Method Details

    • write

      public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
      Specified by:
      write in interface com.esotericsoftware.kryo.KryoSerializable
    • read

      public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input)
      Specified by:
      read in interface com.esotericsoftware.kryo.KryoSerializable
    • equals

      public boolean equals(Object other)
      Description copied from interface: ItemType
      Tests for itemType equality.
      Specified by:
      equals in interface ItemType
      Overrides:
      equals in class Object
      Parameters:
      other - another object.
      Returns:
      true it is equal to other, false otherwise.
    • hasName

      public boolean hasName()
      Description copied from interface: ItemType
      Tests for QName.
      Specified by:
      hasName in interface ItemType
      Returns:
      true if [this] item type has a QName
    • getName

      public Name getName()
      Specified by:
      getName in interface ItemType
      Returns:
      the itemtype QName if available
    • isSubtypeOf

      public boolean isSubtypeOf(ItemType superType)
      Specified by:
      isSubtypeOf in interface ItemType
      Parameters:
      superType - another item type
      Returns:
      true if [this] is a subtype of [superType], any type is considered a subtype of itself. If [this] has a name, then this is determined strictly based on the hierarchy. If [this] does not have a name, then this is determined based on facets.
    • findLeastCommonSuperTypeWith

      public ItemType findLeastCommonSuperTypeWith(ItemType other)
      Specified by:
      findLeastCommonSuperTypeWith in interface ItemType
      Parameters:
      other - another item type
      Returns:
      the common supertype between [this] and [other], that would be the LCA in the item type tree of [this] and [other] (does not take into account union types as common ancestor, but only the type tree)
    • getTypeTreeDepth

      public int getTypeTreeDepth()
      Specified by:
      getTypeTreeDepth in interface ItemType
      Returns:
      an int representing the depth of the item type in the type tree ('item' is the root with depth 0)
    • getBaseType

      public ItemType getBaseType()
      Specified by:
      getBaseType in interface ItemType
      Returns:
      the base type for a type, return null for the topmost item type
    • getAllowedFacets

      public Set<ConstrainingFacetTypes> getAllowedFacets()
      Specified by:
      getAllowedFacets in interface ItemType
      Returns:
      a set containing the allowed facets for restricting the type
    • toString

      public String toString()
      Specified by:
      toString in interface ItemType
      Overrides:
      toString in class Object
    • isResolved

      public boolean isResolved()
      Specified by:
      isResolved in interface ItemType
    • isCompatibleWithDataFrames

      public boolean isCompatibleWithDataFrames(RumbleRuntimeConfiguration configuration)
      Description copied from interface: ItemType
      Checks compatibility with DataFrames.
      Specified by:
      isCompatibleWithDataFrames in interface ItemType
      Returns:
      true if compatible with DataFrames and false otherwise.
    • getSparkSQLType

      public String getSparkSQLType()
      Description copied from interface: ItemType
      Returns the SparkSQL type of the item type for use in a query.
      Specified by:
      getSparkSQLType in interface ItemType
      Returns:
      String representing the SparkSQL type of the item type.
    • isTopmostItemType

      public boolean isTopmostItemType()
      Specified by:
      isTopmostItemType in interface ItemType
      Returns:
      true it [this] is the topmost item type.
    • isAtomicItemType

      public boolean isAtomicItemType()
      Specified by:
      isAtomicItemType in interface ItemType
      Returns:
      true it [this] is a subtype of an atomic item type.
    • isObjectItemType

      public boolean isObjectItemType()
      Specified by:
      isObjectItemType in interface ItemType
      Returns:
      true it [this] is an object item type.
    • isArrayItemType

      public boolean isArrayItemType()
      Specified by:
      isArrayItemType in interface ItemType
      Returns:
      true it [this] is an array item type.
    • isJsonItemType

      public boolean isJsonItemType()
      Specified by:
      isJsonItemType in interface ItemType
      Returns:
      test if [this] is a subptype of a json item type
    • isUnionType

      public boolean isUnionType()
      Specified by:
      isUnionType in interface ItemType
    • isFunctionItemType

      public boolean isFunctionItemType()
      Specified by:
      isFunctionItemType in interface ItemType
      Returns:
      true it [this] is a function item type.
    • isNumeric

      public boolean isNumeric()
      Specified by:
      isNumeric in interface ItemType
      Returns:
      [true] if this is a numeric item type, false otherwise
    • isStaticallyCastableAs

      public boolean isStaticallyCastableAs(ItemType other)
      Description copied from interface: ItemType
      Check at static time if [this] could be casted to [other] item type, requires [this] to be an atomic type
      Specified by:
      isStaticallyCastableAs in interface ItemType
      Parameters:
      other - a strict subtype of atomic item type to which we are trying to cast
      Returns:
      true if it is possible at static time to cast [this] to [other], false otherwise
    • canBePromotedTo

      public boolean canBePromotedTo(ItemType itemType)
      Specified by:
      canBePromotedTo in interface ItemType
      Parameters:
      itemType - another item type
      Returns:
      true if [this] can be promoted to [itemType]
    • isUserDefined

      public boolean isUserDefined()
      Specified by:
      isUserDefined in interface ItemType
      Returns:
      [true] if it is a user-defined type, false otherwise
    • resolve

      public void resolve(DynamicContext context, ExceptionMetadata metadata)
      Specified by:
      resolve in interface ItemType
    • resolve

      public void resolve(StaticContext context, ExceptionMetadata metadata)
      Specified by:
      resolve in interface ItemType