Package org.apache.calcite.util
Class ConversionUtil
java.lang.Object
org.apache.calcite.util.ConversionUtil
Utility functions for converting from one type to another.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringA constant string which can be used wherever a SQL literal containing Unicode escape characters is needed in a test.static final StringA constant string which can be used wherever a Java string containing Unicode characters is needed in a test. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable BooleanConverts a string into a BOOLEAN.static byte[]toByteArrayFromString(String value, int radix) Converts a string into a byte array.static StringtoStringFromApprox(double d, boolean isFloat) Converts an approximate value into a string, following the SQL 2003 standard.static StringtoStringFromByteArray(byte[] value, int radix) Converts a byte array into a bit string or a hex string.
-
Field Details
-
NATIVE_UTF16_CHARSET_NAME
-
TEST_UNICODE_STRING
A constant string which can be used wherever a Java string containing Unicode characters is needed in a test. It spells 'anthropos' in Greek.- See Also:
-
TEST_UNICODE_SQL_ESCAPED_LITERAL
A constant string which can be used wherever a SQL literal containing Unicode escape characters is needed in a test. It spells 'anthropos' in Greek. The escape character is the SQL default (backslash); note that the backslash-doubling here is for Java only, so by the time the SQL parser gets it, there is only one backslash.- See Also:
-
-
Method Details
-
toStringFromByteArray
Converts a byte array into a bit string or a hex string.For example,
toStringFromByteArray(new byte[] {0xAB, 0xCD}, 16)returnsABCD. -
toByteArrayFromString
Converts a string into a byte array. The inverse oftoStringFromByteArray(byte[], int). -
toStringFromApprox
Converts an approximate value into a string, following the SQL 2003 standard. -
toBoolean
Converts a string into a BOOLEAN.
-