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
Modifier and TypeFieldDescriptionstatic final String
static final String
A constant string which can be used wherever a SQL literal containing Unicode escape characters is needed in a test.static final String
A constant string which can be used wherever a Java string containing Unicode characters is needed in a test. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Boolean
Converts a string into a BOOLEAN.static byte[]
toByteArrayFromString
(String value, int radix) Converts a string into a byte array.static String
toStringFromApprox
(double d, boolean isFloat) Converts an approximate value into a string, following the SQL 2003 standard.static String
toStringFromByteArray
(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.
-