Java Code Examples for org.apache.calcite.util.BitString#createFromBytes()
The following examples show how to use
org.apache.calcite.util.BitString#createFromBytes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SqlLiteral.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a literal like X'ABAB' from an array of bytes. * * @param bytes Contents of binary literal * @param pos Parser position * @return Binary string literal */ public static SqlBinaryStringLiteral createBinaryString( byte[] bytes, SqlParserPos pos) { BitString bits; try { bits = BitString.createFromBytes(bytes); } catch (NumberFormatException e) { throw SqlUtil.newContextException(pos, RESOURCE.binaryLiteralInvalid()); } return new SqlBinaryStringLiteral(bits, pos); }
Example 2
Source File: SqlLiteral.java From calcite with Apache License 2.0 | 5 votes |
/** * Creates a literal like X'ABAB' from an array of bytes. * * @param bytes Contents of binary literal * @param pos Parser position * @return Binary string literal */ public static SqlBinaryStringLiteral createBinaryString( byte[] bytes, SqlParserPos pos) { BitString bits; try { bits = BitString.createFromBytes(bytes); } catch (NumberFormatException e) { throw SqlUtil.newContextException(pos, RESOURCE.binaryLiteralInvalid()); } return new SqlBinaryStringLiteral(bits, pos); }