Package com.gpudb

Class RecordBase

    • Constructor Summary

      Constructors 
      Constructor Description
      RecordBase()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(Object obj)  
      Object get​(String name)
      Returns the value of the specified field.
      Object getArray​(int index)
      For string columns with array property, return a native Java array of the appropriate type: Boolean[], Integer[], Long[], Float[], Double[], BigInteger[], or String[].
      Object getArray​(String name)
      For string columns with array property, return a native Java array of the appropriate type: Boolean[], Integer[], Long[], Float[], Double[], BigInteger[], or String[].
      ByteBuffer getBytes​(int index)
      Returns the value of the specified field cast to a ByteBuffer.
      ByteBuffer getBytes​(String name)
      Returns the value of the specified field cast to a ByteBuffer.
      Map<String,​Object> getDataMap()
      Returns a Map of field names to values that is bound to the record (updates made to the map are reflected in the record and vice versa).
      Double getDouble​(int index)
      Returns the value of the specified field cast to a Double.
      Double getDouble​(String name)
      Returns the value of the specified field cast to a Double.
      Float getFloat​(int index)
      Returns the value of the specified field cast to a Float.
      Float getFloat​(String name)
      Returns the value of the specified field cast to a Float.
      Integer getInt​(int index)
      Returns the value of the specified field cast to a Integer.
      Integer getInt​(String name)
      Returns the value of the specified field cast to a Integer.
      Map<String,​Object> getJson​(int index)
      For string columns with JSON property, return a Java Map representing the JSON object.
      Map<String,​Object> getJson​(String name)
      For string columns with JSON property, return a Java Map representing the JSON object.
      Long getLong​(int index)
      Returns the value of the specified field cast to a Long.
      Long getLong​(String name)
      Returns the value of the specified field cast to a Long.
      org.apache.avro.Schema getSchema()
      Returns the Avro record schema of the record.
      String getString​(int index)
      Returns the value of the specified field cast to a String.
      String getString​(String name)
      Returns the value of the specified field cast to a String.
      float[] getVector​(int index)
      For byte columns with a vector property, return a native Java array of float.
      float[] getVector​(String name)
      For byte columns with a vector property, return a native Java array of float.
      int hashCode()  
      void put​(String name, Object value)
      Sets the value of the specified field.
      void putArray​(int index, Object value)
      For string columns with array property, parse the value parameter which may be a String, List<?>, int[], Integer[], long[], Long[], float[], Float[], double[], Double[].
      void putArray​(String name, Object value)
      For string columns with array property, parse the value parameter which may be a String, List<?>, int[], Integer[], long[], Long[], float[], Float[], double[], Double[].
      void putBytes​(int index, Object value)
      For Byte columns, parse the value parameter which may be a ByteBuffer or byte[].
      void putBytes​(String name, Object value)
      For Byte columns, parse the value parameter which may be a ByteBuffer or byte[].
      void putDateTime​(int index, Object value)
      For string columns with date, time, or datetime property, parse the string and convert to the appropriate Kinetica format using the system timezone.
      void putDateTime​(int index, Object value, TimeZone timezone)
      For string columns with date, time, or datetime property, parse the string and convert to the appropriate Kinetica format using the given timezone (system timezone if none given).
      void putDateTime​(String name, Object value)
      For string columns with date, time, or datetime property, parse the string and convert to the appropriate Kinetica format using the system timezone.
      void putDateTime​(String name, Object value, TimeZone timezone)
      For string columns with date, time, or datetime property, parse the string and convert to the appropriate Kinetica format using the given timezone (system timezone if none given).
      void putDecimal​(String name, Object value)  
      void putJson​(int index, Object value)
      For String columns with json property, parse the value parameter which may be a String, or Map<String, String>.
      void putJson​(String name, Object value)
      For String columns with json property, parse the value parameter which may be a String, or Map<String, String>.
      void putVector​(int index, Object value)
      For bytes columns with vector property, parse the value parameter which may be a string, float[], Float[] or List<Float>.
      void putVector​(String name, Object value)
      For bytes columns with vector property, parse the value property which may be a string, float[], Float[] or List<Float>.
      String toString()  
    • Constructor Detail

      • RecordBase

        public RecordBase()
    • Method Detail

      • getSchema

        public org.apache.avro.Schema getSchema()
        Description copied from interface: Record
        Returns the Avro record schema of the record.
        Specified by:
        getSchema in interface org.apache.avro.generic.GenericContainer
        Specified by:
        getSchema in interface Record
        Returns:
        the Avro record schema of the record
      • get

        public Object get​(String name)
        Description copied from interface: Record
        Returns the value of the specified field.
        Specified by:
        get in interface Record
        Parameters:
        name - the name of the field
        Returns:
        the value of the field, or null if no field with the specified name exists
      • getArray

        public Object getArray​(String name)
                        throws Exception
        For string columns with array property, return a native Java array of the appropriate type: Boolean[], Integer[], Long[], Float[], Double[], BigInteger[], or String[]. For binary columns with vector property, return float[].
        Parameters:
        name - The name of the column.
        Returns:
        a native Java array of the appropriate type for the given column name
        Throws:
        GPUdbException - If an error occurs during the operation.
        com.fasterxml.jackson.core.JsonProcessingException
        com.fasterxml.jackson.databind.JsonMappingException
        Exception
      • getArray

        public Object getArray​(int index)
                        throws Exception
        For string columns with array property, return a native Java array of the appropriate type: Boolean[], Integer[], Long[], Float[], Double[], BigInteger[], or String[]. For binary columns with vector property, return float[].
        Parameters:
        index - The index of the column.
        Returns:
        a native Java array of the appropriate type for the given column index
        Throws:
        GPUdbException - If an error occurs during the operation.
        com.fasterxml.jackson.core.JsonProcessingException
        com.fasterxml.jackson.databind.JsonMappingException
        Exception
      • getBytes

        public ByteBuffer getBytes​(int index)
        Description copied from interface: Record
        Returns the value of the specified field cast to a ByteBuffer. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getBytes in interface Record
        Parameters:
        index - the index of the field
        Returns:
        the value of the field
      • getBytes

        public ByteBuffer getBytes​(String name)
        Description copied from interface: Record
        Returns the value of the specified field cast to a ByteBuffer. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getBytes in interface Record
        Parameters:
        name - the name of the field
        Returns:
        the value of the field
      • getDouble

        public Double getDouble​(int index)
        Description copied from interface: Record
        Returns the value of the specified field cast to a Double. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getDouble in interface Record
        Parameters:
        index - the index of the field
        Returns:
        the value of the field
      • getDouble

        public Double getDouble​(String name)
        Description copied from interface: Record
        Returns the value of the specified field cast to a Double. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getDouble in interface Record
        Parameters:
        name - the name of the field
        Returns:
        the value of the field
      • getFloat

        public Float getFloat​(int index)
        Description copied from interface: Record
        Returns the value of the specified field cast to a Float. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getFloat in interface Record
        Parameters:
        index - the index of the field
        Returns:
        the value of the field
      • getFloat

        public Float getFloat​(String name)
        Description copied from interface: Record
        Returns the value of the specified field cast to a Float. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getFloat in interface Record
        Parameters:
        name - the name of the field
        Returns:
        the value of the field
      • getInt

        public Integer getInt​(int index)
        Description copied from interface: Record
        Returns the value of the specified field cast to a Integer. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getInt in interface Record
        Parameters:
        index - the index of the field
        Returns:
        the value of the field
      • getInt

        public Integer getInt​(String name)
        Description copied from interface: Record
        Returns the value of the specified field cast to a Integer. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getInt in interface Record
        Parameters:
        name - the name of the field
        Returns:
        the value of the field
      • getJson

        public Map<String,​Object> getJson​(String name)
                                         throws Exception
        For string columns with JSON property, return a Java Map representing the JSON object.
        Parameters:
        name - The name of the column.
        Returns:
        a native Java map of the appropriate type for the given column name
        Throws:
        GPUdbException - If an error occurs during the operation.
        com.fasterxml.jackson.core.JsonProcessingException
        com.fasterxml.jackson.databind.JsonMappingException
        Exception
      • getJson

        public Map<String,​Object> getJson​(int index)
                                         throws Exception
        For string columns with JSON property, return a Java Map representing the JSON object.
        Parameters:
        index - The index of the column.
        Returns:
        a native Java map of the appropriate type for the given column index
        Throws:
        GPUdbException - If an error occurs during the operation.
        com.fasterxml.jackson.core.JsonProcessingException
        com.fasterxml.jackson.databind.JsonMappingException
        Exception
      • getLong

        public Long getLong​(int index)
        Description copied from interface: Record
        Returns the value of the specified field cast to a Long. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getLong in interface Record
        Parameters:
        index - the index of the field
        Returns:
        the value of the field
      • getLong

        public Long getLong​(String name)
        Description copied from interface: Record
        Returns the value of the specified field cast to a Long. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getLong in interface Record
        Parameters:
        name - the name of the field
        Returns:
        the value of the field
      • getString

        public String getString​(int index)
        Description copied from interface: Record
        Returns the value of the specified field cast to a String. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getString in interface Record
        Parameters:
        index - the index of the field
        Returns:
        the value of the field
      • getString

        public String getString​(String name)
        Description copied from interface: Record
        Returns the value of the specified field cast to a String. If the field is not of the correct type an exception will be thrown.
        Specified by:
        getString in interface Record
        Parameters:
        name - the name of the field
        Returns:
        the value of the field
      • getVector

        public float[] getVector​(String name)
                          throws Exception
        For byte columns with a vector property, return a native Java array of float.
        Parameters:
        name - The name of the column.
        Returns:
        an array of floats for the given vector column name
        Throws:
        GPUdbException - If an error occurs during the operation.
        com.fasterxml.jackson.core.JsonProcessingException
        com.fasterxml.jackson.databind.JsonMappingException
        Exception
      • getVector

        public float[] getVector​(int index)
                          throws Exception
        For byte columns with a vector property, return a native Java array of float.
        Parameters:
        index - The index of the column.
        Returns:
        an array of floats for the given vector column index
        Throws:
        GPUdbException - If an error occurs during the operation.
        com.fasterxml.jackson.core.JsonProcessingException
        com.fasterxml.jackson.databind.JsonMappingException
        Exception
      • put

        public void put​(String name,
                        Object value)
        Description copied from interface: Record
        Sets the value of the specified field.
        Specified by:
        put in interface Record
        Parameters:
        name - the name of the field
        value - the new value
      • putArray

        public void putArray​(String name,
                             Object value)
                      throws GPUdbException
        For string columns with array property, parse the value parameter which may be a String, List<?>, int[], Integer[], long[], Long[], float[], Float[], double[], Double[]. If the value is not of a relevant type, throw an error.
        Parameters:
        name - The name of the column.
        value - The value to be parsed (based on the given column's type).
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putArray

        public void putArray​(int index,
                             Object value)
                      throws GPUdbException
        For string columns with array property, parse the value parameter which may be a String, List<?>, int[], Integer[], long[], Long[], float[], Float[], double[], Double[]. If the value is not of a relevant type, throw an error.
        Parameters:
        index - The index of the column.
        value - The value to be parsed (based on the given column's type).
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putBytes

        public void putBytes​(String name,
                             Object value)
                      throws GPUdbException
        For Byte columns, parse the value parameter which may be a ByteBuffer or byte[]. If the value is not of a relevant type, throw an error.
        Parameters:
        name - The name of the column.
        value - The value to be set.
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putBytes

        public void putBytes​(int index,
                             Object value)
                      throws GPUdbException
        For Byte columns, parse the value parameter which may be a ByteBuffer or byte[]. If the value is not of a relevant type, throw an error.
        Parameters:
        index - The index of the column.
        value - The value to be set.
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putDateTime

        public void putDateTime​(String name,
                                Object value)
                         throws GPUdbException
        For string columns with date, time, or datetime property, parse the string and convert to the appropriate Kinetica format using the system timezone. If the column is not of a relevant type, set the value without any parsing (so that any string or other typed values can be set using this method without resorting to first check the column's type before calling it). Caveat is that due to string manipulation, this is considerably slower than put(java.lang.String, java.lang.Object). So, use this method only if you know that a non-Kinetica date/time/datetime format is being used.
        Parameters:
        name - The name of the column.
        value - The value to be parsed (based on the given column's type).
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putDateTime

        public void putDateTime​(String name,
                                Object value,
                                TimeZone timezone)
                         throws GPUdbException
        For string columns with date, time, or datetime property, parse the string and convert to the appropriate Kinetica format using the given timezone (system timezone if none given). If the column is not of a relevant type, set the value without any parsing (so that any string or other typed values can be set using this method without resorting to first check the column's type before calling it). Caveat is that due to string manipulation, this is considerably slower than put(java.lang.String, java.lang.Object). So, use this method only if you know that a non-Kinetica date/time/datetime format is being used.
        Parameters:
        name - The name of the column.
        value - The value to be parsed (based on the given column's type).
        timezone - Optional parameter specifying the timezone to use for parsing the given value. If null, the system timezone is used.
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putDateTime

        public void putDateTime​(int index,
                                Object value)
                         throws GPUdbException
        For string columns with date, time, or datetime property, parse the string and convert to the appropriate Kinetica format using the system timezone. If the column is not of a relevant type, throw an error. Caveat is that due to string manipulation, this is considerably slower than put(java.lang.String, java.lang.Object). So, use this method only if you know that a non-Kinetica date/time/datetime format is being used.
        Parameters:
        index - The index of the column.
        value - The value to be parsed (based on the given column's type).
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putDateTime

        public void putDateTime​(int index,
                                Object value,
                                TimeZone timezone)
                         throws GPUdbException
        For string columns with date, time, or datetime property, parse the string and convert to the appropriate Kinetica format using the given timezone (system timezone if none given). If the column is not of a relevant type, set the value without any parsing (so that any string or other typed values can be set using this method without resorting to first check the column's type before calling it). Caveat is that due to string manipulation, this is considerably slower than put(java.lang.String, java.lang.Object). So, use this method only if you know that a non-Kinetica date/time/datetime format is being used. The following patterns are accepted for date and datetime columns: 1) yyyy[-][/][.]MM[-][/][.]dd[ ]['T'][HH:mm[:ss][.S[S][S][S][S][S]][ ][XXX][Z][z][VV][x]] 2) MM[-][/][.]dd[-][/][.]yyyy[ ]['T'][HH:mm[:ss][.S[S][S][S][S][S]][ ][XXX][Z][z][VV][x]] 3) dd[-][/][.]MM[-][/][.]yyyy[ ]['T'][HH:mm[:ss][.S[S][S][S][S][S]][ ][XXX][Z][z][VV][x]] The following pattern is accepted by time-type columns: HH:mm[:ss][.S[S][S][S][S][S]][ ][XXX][Z][z][VV][x] In other words, the date component can be any of YMD, MDY, or DMY pattern withh '-', '.', or '/' as the separator. And, the time component must have hours and minutes, but can optionally have seconds, fraction of a second (up to six digits) and some form of a timezone identifier.
        Parameters:
        index - The index of the column.
        value - The value to be parsed (based on the given column's type).
        timezone - Optional parameter specifying the timezone to use for parsing the given value. If null, the system timezone is used.
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putJson

        public void putJson​(String name,
                            Object value)
                     throws GPUdbException
        For String columns with json property, parse the value parameter which may be a String, or Map<String, String>. If the column is not of a relevant type, throw an error.
        Parameters:
        name - The name of the column.
        value - The value to be parsed (based on the given column's type).
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putJson

        public void putJson​(int index,
                            Object value)
                     throws GPUdbException
        For String columns with json property, parse the value parameter which may be a String, or Map<String, String>. If the column is not of a relevant type, throw an error.
        Parameters:
        index - The index of the column.
        value - The value to be parsed (based on the given column's type).
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putVector

        public void putVector​(String name,
                              Object value)
                       throws GPUdbException
        For bytes columns with vector property, parse the value property which may be a string, float[], Float[] or List<Float>. If the column is not of a relevant type, throw an error.
        Parameters:
        name - The name of the column.
        value - The value to be parsed (based on the given column's type).
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putVector

        public void putVector​(int index,
                              Object value)
                       throws GPUdbException
        For bytes columns with vector property, parse the value parameter which may be a string, float[], Float[] or List<Float>. If the column is not of a relevant type, throw an error.
        Parameters:
        index - The index of the column.
        value - The value to be parsed (based on the given column's type).
        Throws:
        GPUdbException - if an error occurs during the operation.
      • putDecimal

        public void putDecimal​(String name,
                               Object value)
      • getDataMap

        public Map<String,​Object> getDataMap()
        Description copied from interface: Record
        Returns a Map of field names to values that is bound to the record (updates made to the map are reflected in the record and vice versa).
        Specified by:
        getDataMap in interface Record
        Returns:
        the map
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object