ritesh-kapoor commented on a change in pull request #1865: [CALCITE-3648] MySQL UNCOMPRESS function support URL: https://github.com/apache/calcite/pull/1865#discussion_r401327869
########## File path: core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java ########## @@ -5192,6 +5192,25 @@ private void checkNullOperand(SqlTester tester, String op) { "07000000789c4bad48cc2dc84905000bc002ed", "VARBINARY NOT NULL"); } + @Test public void testUncompress() { + SqlTester sqlTester = tester(SqlLibrary.MYSQL); + sqlTester.checkNull("UNCOMPRESS(NULL)"); + sqlTester.checkString("UNCOMPRESS(x'')", "", "VARCHAR"); + + sqlTester.checkNull("UNCOMPRESS(x'1233')"); + + sqlTester.checkString("UNCOMPRESS(COMPRESS('test'))", + "test", "VARCHAR"); + + sqlTester.checkString("UNCOMPRESS(x'10000000789c4b4c44050033980611')", + "aaaaaaaaaaaaaaaa", "VARCHAR"); + + sqlTester.checkString("UNCOMPRESS(x'06000000789c2b4ecc2dc849050008de0283' )", + "sample", "VARCHAR"); + sqlTester.checkString("UNCOMPRESS(x'07000000789c4bad48cc2dc84905000bc002ed')", + "example", "VARCHAR"); + } Review comment: `rror while executing SQL "select UNCOMPRESS(p0) from (values ('test')) as t(p0)": Error while compiling generated Java code: public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root) { final org.apache.calcite.linq4j.Enumerable _inputEnumerable = org.apache.calcite.linq4j.Linq4j.asEnumerable(new String[] { "test"}); return new org.apache.calcite.linq4j.AbstractEnumerable(){ public org.apache.calcite.linq4j.Enumerator enumerator() { return new org.apache.calcite.linq4j.Enumerator(){ public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable.enumerator(); public void reset() { inputEnumerator.reset(); } public boolean moveNext() { return inputEnumerator.moveNext(); } public void close() { inputEnumerator.close(); } public Object current() { return org.apache.calcite.runtime.CompressionFunctions.uncompress((org.apache.calcite.avatica.util.ByteString) (inputEnumerator.current() == null ? (String) null : inputEnumerator.current().toString())); } }; } }; } public Class getElementType() { return java.lang.String.class; } ];` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services