Package net.snowflake.client.core.arrow
Class BitToBooleanConverter
- java.lang.Object
-
- net.snowflake.client.core.arrow.BitToBooleanConverter
-
- All Implemented Interfaces:
ArrowVectorConverter
public class BitToBooleanConverter extends Object
Convert Arrow BitVector to Boolean
-
-
Field Summary
Fields Modifier and Type Field Description protected int
columnIndex
protected DataConversionContext
context
static String
FIELD_NAME_EPOCH
Field names of the struct vectors used by timestampstatic String
FIELD_NAME_FRACTION
static String
FIELD_NAME_TIME_ZONE_INDEX
protected String
logicalTypeStr
snowflake logical type of the target arrow vectorprotected TimeZone
sessionTimeZone
protected boolean
treatNTZasUTC
protected boolean
useSessionTimezone
-
Constructor Summary
Constructors Constructor Description BitToBooleanConverter(org.apache.arrow.vector.ValueVector fieldVector, int columnIndex, DataConversionContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isNull(int index)
Determine whether source value in arrow vector is null value or notvoid
setSessionTimeZone(TimeZone tz)
void
setTreatNTZAsUTC(boolean isUTC)
void
setUseSessionTimezone(boolean useSessionTimezone)
Set to true when time value should be displayed in wallclock time (no timezone offset)BigDecimal
toBigDecimal(int rowIndex)
Convert value in arrow vector to BigDecimalboolean
toBoolean(int index)
Convert value in arrow vector to boolean databyte
toByte(int rowIndex)
Convert value in arrow vector to byte databyte[]
toBytes(int index)
Convert value in arrow vector to byte arrayDate
toDate(int index, TimeZone jvmTz, boolean useDateFormat)
Convert value in arrow vector to Datedouble
toDouble(int rowIndex)
Convert value in arrow vector to double datafloat
toFloat(int rowIndex)
Convert value in arrow vector to float dataint
toInt(int rowIndex)
Convert value in arrow vector to int datalong
toLong(int rowIndex)
Convert value in arrow vector to long dataObject
toObject(int index)
Convert value in arrow vector to Objectshort
toShort(int rowIndex)
Convert value in arrow vector to short dataString
toString(int index)
Convert value in arrow vector to stringTime
toTime(int index)
Convert value in arrow vector to TimeTimestamp
toTimestamp(int index, TimeZone tz)
Convert value in arrow vector to Timestamp
-
-
-
Field Detail
-
logicalTypeStr
protected String logicalTypeStr
snowflake logical type of the target arrow vector
-
context
protected DataConversionContext context
-
columnIndex
protected int columnIndex
-
treatNTZasUTC
protected boolean treatNTZasUTC
-
useSessionTimezone
protected boolean useSessionTimezone
-
sessionTimeZone
protected TimeZone sessionTimeZone
-
FIELD_NAME_EPOCH
public static final String FIELD_NAME_EPOCH
Field names of the struct vectors used by timestamp- See Also:
- Constant Field Values
-
FIELD_NAME_TIME_ZONE_INDEX
public static final String FIELD_NAME_TIME_ZONE_INDEX
- See Also:
- Constant Field Values
-
FIELD_NAME_FRACTION
public static final String FIELD_NAME_FRACTION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BitToBooleanConverter
public BitToBooleanConverter(org.apache.arrow.vector.ValueVector fieldVector, int columnIndex, DataConversionContext context)
-
-
Method Detail
-
toBoolean
public boolean toBoolean(int index)
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to boolean data- Specified by:
toBoolean
in interfaceArrowVectorConverter
- Parameters:
index
- index of the value to be converted in the vector- Returns:
- boolean data converted from arrow vector
-
toBytes
public byte[] toBytes(int index)
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to byte array- Specified by:
toBytes
in interfaceArrowVectorConverter
- Parameters:
index
- index of the value to be converted in the vector- Returns:
- byte array converted from arrow vector
-
toObject
public Object toObject(int index)
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to Object- Specified by:
toObject
in interfaceArrowVectorConverter
- Parameters:
index
- index of the value to be converted in the vector- Returns:
- Object converted from arrow vector
-
toString
public String toString(int index)
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to string- Specified by:
toString
in interfaceArrowVectorConverter
- Parameters:
index
- index of the value to be converted in the vector- Returns:
- string converted from arrow vector
-
toShort
public short toShort(int rowIndex) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to short data- Specified by:
toShort
in interfaceArrowVectorConverter
- Parameters:
rowIndex
- index of the value to be converted in the vector- Returns:
- short data converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toInt
public int toInt(int rowIndex) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to int data- Specified by:
toInt
in interfaceArrowVectorConverter
- Parameters:
rowIndex
- index of the value to be converted in the vector- Returns:
- int data converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toLong
public long toLong(int rowIndex) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to long data- Specified by:
toLong
in interfaceArrowVectorConverter
- Parameters:
rowIndex
- index of the value to be converted in the vector- Returns:
- long data converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toFloat
public float toFloat(int rowIndex) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to float data- Specified by:
toFloat
in interfaceArrowVectorConverter
- Parameters:
rowIndex
- index of the value to be converted in the vector- Returns:
- float data converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toDouble
public double toDouble(int rowIndex) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to double data- Specified by:
toDouble
in interfaceArrowVectorConverter
- Parameters:
rowIndex
- index of the value to be converted in the vector- Returns:
- double data converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toBigDecimal
public BigDecimal toBigDecimal(int rowIndex) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to BigDecimal- Specified by:
toBigDecimal
in interfaceArrowVectorConverter
- Parameters:
rowIndex
- index of the value to be converted in the vector- Returns:
- BigDecimal converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toByte
public byte toByte(int rowIndex) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to byte data- Specified by:
toByte
in interfaceArrowVectorConverter
- Parameters:
rowIndex
- index of the value to be converted in the vector- Returns:
- byte data converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toDate
public Date toDate(int index, TimeZone jvmTz, boolean useDateFormat) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to Date- Specified by:
toDate
in interfaceArrowVectorConverter
- Parameters:
index
- index of the value to be converted in the vectorjvmTz
- JVM timezoneuseDateFormat
- boolean value to check whether to change timezone or not- Returns:
- Date converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toTime
public Time toTime(int index) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to Time- Specified by:
toTime
in interfaceArrowVectorConverter
- Parameters:
index
- index of the value to be converted in the vector- Returns:
- Time converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
toTimestamp
public Timestamp toTimestamp(int index, TimeZone tz) throws SFException
Description copied from interface:ArrowVectorConverter
Convert value in arrow vector to Timestamp- Specified by:
toTimestamp
in interfaceArrowVectorConverter
- Parameters:
index
- index of the value to be converted in the vectortz
- time zone- Returns:
- Timestamp converted from arrow vector
- Throws:
SFException
- invalid data conversion
-
setTreatNTZAsUTC
public void setTreatNTZAsUTC(boolean isUTC)
- Specified by:
setTreatNTZAsUTC
in interfaceArrowVectorConverter
- Parameters:
isUTC
- true or false value of whether NTZ timestamp should be set to UTC
-
setUseSessionTimezone
public void setUseSessionTimezone(boolean useSessionTimezone)
Description copied from interface:ArrowVectorConverter
Set to true when time value should be displayed in wallclock time (no timezone offset)- Specified by:
setUseSessionTimezone
in interfaceArrowVectorConverter
-
setSessionTimeZone
public void setSessionTimeZone(TimeZone tz)
- Specified by:
setSessionTimeZone
in interfaceArrowVectorConverter
-
isNull
public boolean isNull(int index)
Description copied from interface:ArrowVectorConverter
Determine whether source value in arrow vector is null value or not- Specified by:
isNull
in interfaceArrowVectorConverter
- Parameters:
index
- index of value to be checked- Returns:
- true if null value otherwise false
-
-