I have checked bigquery, it's ok. but Calcite doesn't support it.
[image: image.png]

I debugged the code and found that
org.apache.calcite.sql.SqlUtil#lookupSubjectRoutinesByName doesn't handle
inferences on this side, causing problems. Can we add a function ITEM to
handle this?
[image: image.png]


I guess this is a bug.



On Mon, Aug 7, 2023 at 4:34 PM LakeShen <shenleifight...@gmail.com> wrote:

> Hi P.F ZHAN,
> From the exception you posted, it seems that after changing the behavior of
> the Split function, you are affecting the results of BIGQUERY. You should
> investigate why you are affecting the results of BIGQUERY, and whether the
> results are correct.
> Generally, after you change the Calcite code, if it does not compile
> successfully, you may use the code that compiled successfully before. So
> you run the single test successfully in IDEA.You should check whether the
> behavior of the Split function you modified is correct. Best, LakeShen
>
> P.F. ZHAN <dethr...@gmail.com> 于2023年8月7日周一 15:22写道:
>
> > Sorry, I made a mistake,  used Chinese to describe my question.
> >
> > Hi, When I was testing the split function with a  case as follows:
> > org.apache.calcite.test.SqlOperatorTest#testSplitFunction
> >
> > > f.checkScalar("SPLIT('h-e-l-l-o', '-')[0]", "h", "VARCHAR");
> > >
> >
> >  I found that when I use "*./gradlew  build*" to build the project
> happens
> > with some errors, but I execute this case in IDEA alone and it is
> > successful.
> >
> > FAILURE   0.3sec, org.apache.calcite.test.CalciteSqlOperatorTest >
> > > testSplitFunction()
> > >     java.lang.AssertionError: Query: values (SPLIT('h-e-l-l-o',
> '-')[0])
> > >     Expected: is "h"
> > >          but: was null
> > >         at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
> > >         at
> > >
> >
> org.apache.calcite.sql.test.ResultCheckers.compareResultSetWithMatcher(ResultCheckers.java:252)
> > >         at
> > >
> >
> org.apache.calcite.sql.test.ResultCheckers$MatcherResultChecker.checkResult(ResultCheckers.java:321)
> > >         at
> > >
> >
> org.apache.calcite.test.SqlOperatorTest$TesterImpl.check(SqlOperatorTest.java:12150)
> > >         at
> > org.apache.calcite.sql.test.SqlTester.check(SqlTester.java:160)
> > >         at
> > >
> >
> org.apache.calcite.test.SqlOperatorFixtureImpl.lambda$checkScalar$2(SqlOperatorFixtureImpl.java:224)
> > >         at
> > >
> >
> org.apache.calcite.sql.test.AbstractSqlTester.forEachQuery(AbstractSqlTester.java:446)
> > >         at
> > >
> >
> org.apache.calcite.test.SqlOperatorFixtureImpl.checkScalar(SqlOperatorFixtureImpl.java:223)
> > >         at
> > >
> >
> org.apache.calcite.sql.test.SqlOperatorFixture.checkScalar(SqlOperatorFixture.java:238)
> > >         at
> > >
> >
> org.apache.calcite.test.SqlOperatorTest.testSplitFunction(SqlOperatorTest.java:7657)
> > >         at
> > >
> >
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
> > >
> >
> > I also add a case in the file big-query.iq
> >
> > SELECT SPLIT("h,e,l,l,o", ',')[1] as result;
> > > +------- +
> > > | result |
> > > +------- +
> > > | e |
> > > +------- +
> > > (1 row)
> > >
> > > !ok
> > >
> >
> > The error log is as follows:
> >
> > > FAILURE  27.6sec, org.apache.calcite.test.BabelQuidemTest >
> > > test(String)[3], [3] sql/big-query.iq
> > >     org.opentest4j.AssertionFailedError: Files differ:
> > > ~/calcite/babel/build/quidem/test/sql/big-query.iq
> > >  ~/calcite/babel/build/resources/test/sql/big-query.iq
> > >     759c759
> > >     < +------- +
> > >     ---
> > >     > +--------+
> > >     761,763c761,763
> > >     < +------- +
> > >     < | e      |
> > >     < +------- +
> > >     ---
> > >     > +--------+
> > >     > | h      |
> > >     > +--------+
> > >
> > >         at
> > > org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38)
> > >         at org.junit.jupiter.api.Assertions.fail(Assertions.java:135)
> > >         at
> > org.apache.calcite.test.QuidemTest.checkRun(QuidemTest.java:183)
> > >         at org.apache.calcite.test.QuidemTest.test(QuidemTest.java:236)
> > >
> > >
> > On Mon, Aug 7, 2023 at 3:13 PM P.F. ZHAN <dethr...@gmail.com> wrote:
> >
> > > 大家好。我在测试 split 函数功能的时候,添加了个 case
> > > org.apache.calcite.test.SqlOperatorTest#testSplitFunction
> > >
> > >> f.checkScalar("SPLIT('h-e-l-l-o', '-')[0]", "h", "VARCHAR");
> > >>
> > >
> > > 我发现我使用 gradlew build 整个项目时会出错,但我单独在 IDEA 里面执行这个 case 是成功的。
> > >
> > >> FAILURE   0.3sec, org.apache.calcite.test.CalciteSqlOperatorTest >
> > >> testSplitFunction()
> > >>     java.lang.AssertionError: Query: values (SPLIT('h-e-l-l-o',
> '-')[0])
> > >>     Expected: is "h"
> > >>          but: was null
> > >>         at
> org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
> > >>         at
> > >>
> >
> org.apache.calcite.sql.test.ResultCheckers.compareResultSetWithMatcher(ResultCheckers.java:252)
> > >>         at
> > >>
> >
> org.apache.calcite.sql.test.ResultCheckers$MatcherResultChecker.checkResult(ResultCheckers.java:321)
> > >>         at
> > >>
> >
> org.apache.calcite.test.SqlOperatorTest$TesterImpl.check(SqlOperatorTest.java:12150)
> > >>         at
> > org.apache.calcite.sql.test.SqlTester.check(SqlTester.java:160)
> > >>         at
> > >>
> >
> org.apache.calcite.test.SqlOperatorFixtureImpl.lambda$checkScalar$2(SqlOperatorFixtureImpl.java:224)
> > >>         at
> > >>
> >
> org.apache.calcite.sql.test.AbstractSqlTester.forEachQuery(AbstractSqlTester.java:446)
> > >>         at
> > >>
> >
> org.apache.calcite.test.SqlOperatorFixtureImpl.checkScalar(SqlOperatorFixtureImpl.java:223)
> > >>         at
> > >>
> >
> org.apache.calcite.sql.test.SqlOperatorFixture.checkScalar(SqlOperatorFixture.java:238)
> > >>         at
> > >>
> >
> org.apache.calcite.test.SqlOperatorTest.testSplitFunction(SqlOperatorTest.java:7657)
> > >>         at
> > >>
> >
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
> > >>
> > >
> > > 我在big-query.iq 中加入下面这段
> > >
> > >> SELECT SPLIT("h,e,l,l,o", ',')[1] as result;
> > >> +------- +
> > >> | result |
> > >> +------- +
> > >> | e |
> > >> +------- +
> > >> (1 row)
> > >>
> > >> !ok
> > >>
> > >
> > > 报错如下:
> > >
> > >> FAILURE  27.6sec, org.apache.calcite.test.BabelQuidemTest >
> > >> test(String)[3], [3] sql/big-query.iq
> > >>     org.opentest4j.AssertionFailedError: Files differ:
> > >> ~/calcite/babel/build/quidem/test/sql/big-query.iq
> > >> ~/calcite/babel/build/resources/test/sql/big-query.iq
> > >>     759c759
> > >>     < +------- +
> > >>     ---
> > >>     > +--------+
> > >>     761,763c761,763
> > >>     < +------- +
> > >>     < | e      |
> > >>     < +------- +
> > >>     ---
> > >>     > +--------+
> > >>     > | h      |
> > >>     > +--------+
> > >>
> > >>         at
> > >> org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38)
> > >>         at org.junit.jupiter.api.Assertions.fail(Assertions.java:135)
> > >>         at
> > >> org.apache.calcite.test.QuidemTest.checkRun(QuidemTest.java:183)
> > >>         at
> org.apache.calcite.test.QuidemTest.test(QuidemTest.java:236)
> > >>
> > >
> >
>

Reply via email to