Skip to main content
Package com.gpudb

Class Type.Column

java.lang.Object
com.gpudb.Type.Column
All Implemented Interfaces:
Enclosing class:

public static final class Type.Column extends Object implements Serializable
Immutable collection of metadata about a column that is part of a GPUdb type.
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Gets the name of the column.
      Returns:
      the name of the column
    • getType

      public Class<?> getType()
      Gets the Java data type of the column.
      Returns:
      the Java data type of the column
    • getAvroType

      public String getAvroType()
    • getColumnBaseType

      public Type.Column.ColumnBaseType getColumnBaseType()
      Gets the enumeration of the *base* type of the column. This is far more efficient than using getType() and then comparing it to various Java classes, e.g. Integer.class. With this enumeration, switch statements can be used to do different things for different column types. This enumeration is preferred when the same thing needs to be done for all sub-types of a given base type. For example, string has a lot of sub-types; rather than having to group multiple case statements (and ensuring that no applicable enumeration is missed) for Type.Column.ColumnType, this enumeration can be used to cover all string cases.
      Returns:
      the enumeration representing the *base* type of the column
    • getColumnType

      public Type.Column.ColumnType getColumnType()
      Gets the enumeration of the type of the column. This is far more efficient than using hasProperty(String) to check for given column properties. With this enumeration, switch statements can be used to do different things for different column types.
      Returns:
      the enumeration representing the type of the column
    • isDecimal

      public boolean isDecimal()
    • getDecimalPrecision

      public int getDecimalPrecision()
    • getDecimalScale

      public int getDecimalScale()
    • hasDefault

      public boolean hasDefault()
      Determine if the column has a default expression
      Returns:
      True if the column has a default expression
    • getDefault

      public String getDefault()
      Returns the column’s default expression
      Returns:
      The default expression of the column, or null if none exists
    • isNullable

      public boolean isNullable()
      Gets whether the column is nullable.
      Returns:
      whether the column is nullable
    • isArray

      public boolean isArray()
      Determine if the column is an Array type
      Returns:
      True if the column is an Array
    • getArrayType

      public Type.Column.ColumnType getArrayType() throws GPUdbException
      Get the sub-type of the array
      Returns:
      The ColumnBaseType of the array sub-type. Returns null if column is not an Array
      Throws:
    • getProperties

      public List<String> getProperties()
      Gets the list of properties that apply to the column.
      Returns:
      the list of properties that apply to the column
      See Also:
    • isVector

      public boolean isVector()
      Determine if the column is a Vector type
      Returns:
      True if the column is a Vector type
    • getVectorDimensions

      public int getVectorDimensions()
      Get vector datatype dimensions, -1 if not a vector
      Returns:
      Size of the vector, -1 if not a vector
    • hasProperty

      public boolean hasProperty(String property)
      Checks if the given property applies to the column.
      Returns:
      boolean indicating whether the given property exists in the column’s properties.
      See Also:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object