[jira] [Commented] (CALCITE-1240) Avatica client written in Golang
[ https://issues.apache.org/jira/browse/CALCITE-1240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093971#comment-16093971 ] Francis Chuang commented on CALCITE-1240: - [~julianhyde] A few questions: 1. What is the process for getting the code into the Calcite/Avatica project? 2. Is it possible to get a separate git repo for this? It makes it easier to import using Go's dependency tools like dep and the package structure would be more idiomatic. > Avatica client written in Golang > > > Key: CALCITE-1240 > URL: https://issues.apache.org/jira/browse/CALCITE-1240 > Project: Calcite > Issue Type: Bug > Components: avatica >Reporter: Julian Hyde >Assignee: Julian Hyde > > Add a client for Avatica written in the Go language (aka "Golang"). > There is one at https://github.com/Boostport/avatica and the author has > offered to contribute it. > The driver is currently somewhat specialized for Phoenix but our goal should > be to allow it to work against any Avatica provider (without diminishing its > value to Phoenix users). -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093907#comment-16093907 ] Haohui Mai commented on CALCITE-1884: - I have verified that {{CAST(DATE '1752-09-20' - INTERVAL '10' DAY AS VARCHAR(10))}} returns {{1752-09-10}} in another project. Can you suggest how to add this as a unit test in avatica? bq. If you want a function that is consistent with Java's internal representation of dates, maybe you need a new function. That was not the goal of this function. I think there is some misunderstanding here. It is the approach but not the goal of the PR. This PR proposes to represent all the dates internally in Julian day that also considers both the old and the new styles (which happens to be consistent with Java representation). All users externally will only see the "new-style" dates. Does it make sense to you? > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: Haohui Mai > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093829#comment-16093829 ] Julian Hyde commented on CALCITE-1884: -- It's difficult to make claims about the behavior of java.sql.Date because a lot of operations (e.g. extracting days of the week, converting to a string) occur in the context of a calendar, usually GregorialCalendar, and/or a locale. One can run a SQL query, convert the results to a string, and examine the results in a context where no Java is involved. The SQL standard is written in those terms. As I said in CALCITE-1832, It follows from the SQL standard that {{CAST(DATE '1752-09-20' - INTERVAL '10' DAY AS VARCHAR(10))}} should return the string '1752-09-10'. I think your change breaks that. If you want a function that is consistent with Java's internal representation of dates, maybe you need a new function. That was not the goal of this function. > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: Haohui Mai > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093810#comment-16093810 ] Haohui Mai commented on CALCITE-1884: - The PR did change the tests in DateTimeUtilTests as now it produces results without the rounding errors. Other existing tests should cover other cases. Do you have any other tests that you have in mind might be beneficial? > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: Haohui Mai > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093796#comment-16093796 ] Julian Hyde commented on CALCITE-1884: -- I assume your PR intends to change the specification. If so why are there no new tests? > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: Haohui Mai > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093787#comment-16093787 ] Haohui Mai commented on CALCITE-1884: - It turns out that this is more complicated that just switching everything to the "new style" internally, because {{java.sql.Date}} / {{java.Date}} actually uses the "old styles" and handles the dates before the cutovers. The cleaner fix is to just implement the required algorithm to handle all these cases gracefully. Please take a look at the PR. Comments are appreciated. > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: Haohui Mai > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093780#comment-16093780 ] ASF GitHub Bot commented on CALCITE-1884: - GitHub user haohui opened a pull request: https://github.com/apache/calcite-avatica/pull/11 [CALCITE-1884] DateTimeUtils produces incorrect results for days before the Gregorian cutovers This PR augments the supports of Julian days that are before the Gregorian cutovers in DateTimeUtils. It implements the algorithm from the book "Astronomical Algorithms" by Jean Meeus, 1998. You can merge this pull request into a Git repository by running: $ git pull https://github.com/haohui/calcite-avatica CALCITE-1884 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/calcite-avatica/pull/11.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #11 commit a62c3108eb4cb1474c8540104744c44e34ccf66d Author: Haohui MaiDate: 2017-07-19T20:51:51Z [CALCITE-1884] DateTimeUtils produces incorrect results for days before Gregorian cutovers. > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: Haohui Mai > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093779#comment-16093779 ] Julian Hyde commented on CALCITE-1884: -- You've now made this bug a duplicate of CALCITE-1832, which I recently closed as not-a-bug because it is intended behavior. > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: Haohui Mai > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Assigned] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Haohui Mai reassigned CALCITE-1884: --- Assignee: Haohui Mai (was: yuemeng) > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: Haohui Mai > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Haohui Mai updated CALCITE-1884: Summary: DateTimeUtils produces incorrect results for days before Gregorian cutovers (was: dateStringToUnixDate() / unixDateToString() returns wrong results) > DateTimeUtils produces incorrect results for days before Gregorian cutovers > --- > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: yuemeng > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1841) Create handlers for Jdbc dialect specific generated sql
[ https://issues.apache.org/jira/browse/CALCITE-1841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093733#comment-16093733 ] Julian Hyde commented on CALCITE-1841: -- I did a quick review and the overall structure looks good. Do you think we should move the dialect handlers into a new package? org.apache.calcite.sql is rather full. Maybe org.apache.calcite.sql.dialect or org.apache.calcite.sql.unparse. It's worth stating in the interface that handlers are stateless, therefore immutable. We should use a singleton instance of the default handler. Currently, because of how they are created, handlers must correspond to a database product, and to add a handler, you have to change Calcite code (i.e. DatabaseProduct). Is that too restrictive? > Create handlers for Jdbc dialect specific generated sql > --- > > Key: CALCITE-1841 > URL: https://issues.apache.org/jira/browse/CALCITE-1841 > Project: Calcite > Issue Type: Improvement > Components: jdbc-adapter >Reporter: Chris Baynes >Assignee: Julian Hyde > > Currently the only way to generate different sql for dialects is to switch on > the dialect in the unparse method. This is used quite heavily in e.g. > SqlFloorFunction, but there are also switches in: > * SUBSTRING() > * SqlDateLiteral quoting > * SqlTimestampLiteral quoting > * Dialects using different interval literals (e.g. Hsqldb uses & MM > rather than YEAR & MONTH) > * limit/offset construction > * mysql isnull function > * type differences (*) > It would be great to have dialect specific handlers to deal with these, > making testing & addition of new handlers (new dialects, or new overrides for > a given function) much easier in the future. > One suggested path to approach this: > https://issues.apache.org/jira/browse/CALCITE-1798?focusedCommentId=16031609=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16031609 > (*) There is a comment in SqlImplementor that reads "MySQL doesn't have a > VARCHAR type, only CHAR.". Not sure if this was for a very old version of > mysql, but it's certainly not true anymore. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1841) Create handlers for Jdbc dialect specific generated sql
[ https://issues.apache.org/jira/browse/CALCITE-1841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093708#comment-16093708 ] Chris Baynes commented on CALCITE-1841: --- I've created a PR for this: https://github.com/apache/calcite/pull/501 During the refactoring I also noticed this issue: https://issues.apache.org/jira/browse/CALCITE-1895 > Create handlers for Jdbc dialect specific generated sql > --- > > Key: CALCITE-1841 > URL: https://issues.apache.org/jira/browse/CALCITE-1841 > Project: Calcite > Issue Type: Improvement > Components: jdbc-adapter >Reporter: Chris Baynes >Assignee: Julian Hyde > > Currently the only way to generate different sql for dialects is to switch on > the dialect in the unparse method. This is used quite heavily in e.g. > SqlFloorFunction, but there are also switches in: > * SUBSTRING() > * SqlDateLiteral quoting > * SqlTimestampLiteral quoting > * Dialects using different interval literals (e.g. Hsqldb uses & MM > rather than YEAR & MONTH) > * limit/offset construction > * mysql isnull function > * type differences (*) > It would be great to have dialect specific handlers to deal with these, > making testing & addition of new handlers (new dialects, or new overrides for > a given function) much easier in the future. > One suggested path to approach this: > https://issues.apache.org/jira/browse/CALCITE-1798?focusedCommentId=16031609=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16031609 > (*) There is a comment in SqlImplementor that reads "MySQL doesn't have a > VARCHAR type, only CHAR.". Not sure if this was for a very old version of > mysql, but it's certainly not true anymore. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (CALCITE-1895) Substring operator broken for MSSQL
Chris Baynes created CALCITE-1895: - Summary: Substring operator broken for MSSQL Key: CALCITE-1895 URL: https://issues.apache.org/jira/browse/CALCITE-1895 Project: Calcite Issue Type: Bug Components: jdbc-adapter Reporter: Chris Baynes Assignee: Julian Hyde The format mssql uses looks like: SUBSTRING(input, start, length) but the default is currently to unparse to SUBSTRING(input FROM start FOR length) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1882) Can't obtain the user defined aggregate function such as sum,avg by calcite
[ https://issues.apache.org/jira/browse/CALCITE-1882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093421#comment-16093421 ] Julian Hyde commented on CALCITE-1882: -- The built-in SUM aggregate function accepts any kind of numeric arguments. So I'm not surprised that it wins. Just curious, if you write a user-defined SUM aggregate function that accepts a VARCHAR argument, can the validator find it? We haven't tested creating user-defined functions with the same name as a built-in, so I'm not sure it works. > Can't obtain the user defined aggregate function such as sum,avg by calcite > --- > > Key: CALCITE-1882 > URL: https://issues.apache.org/jira/browse/CALCITE-1882 > Project: Calcite > Issue Type: Bug >Affects Versions: 1.12.0 >Reporter: yuemeng >Assignee: yuemeng >Priority: Critical > > If we want to register a sum or avg aggregate function to deal with different > data type such as sum(double) ,we implement a SqlUserDefinedAggFunction and > register with name sum,but when we execute a sql like: > {code} > select id,sum(payment) from table test group by id > {code} > in fact,it always give the SqlSumAggFunction function which builtin by > calcite,never find the exactly function which we register by ourself. > During sql parse process,method createCall in SqlAbstractParserImpl will be > called, > {code} > protected SqlCall createCall( > SqlIdentifier funName, > SqlParserPos pos, > SqlFunctionCategory funcType, > SqlLiteral functionQualifier, > SqlNode[] operands) { > SqlOperator fun = null; > // First, try a half-hearted resolution as a builtin function. > // If we find one, use it; this will guarantee that we > // preserve the correct syntax (i.e. don't quote builtin function > /// name when regenerating SQL). > if (funName.isSimple()) { > final List list = Lists.newArrayList(); > opTab.lookupOperatorOverloads(funName, funcType, SqlSyntax.FUNCTION, > list);//we lookup in SqlStdOperatorTable,and always find buidin function for > sum ,avg .eg > if (list.size() == 1) { > fun = list.get(0); > } > } > // Otherwise, just create a placeholder function. Later, during > // validation, it will be resolved into a real function reference. > if (fun == null) { > fun = new SqlUnresolvedFunction(funName, null, null, null, null, > funcType); > } > return fun.createCall(functionQualifier, pos, operands); > } > {code} > but the problem will be appear in deriveType,because of we get the > SqlSumAggFunction previously,and the sqlKind of SqlSumAggFunction is AVG,but > the sqlKind of sql user defined agg function (sum) which we register by > ourself is OTHER_FUNCTION,so it filter out our sum function. > {code} > private static Iterator > filterOperatorRoutinesByKind(Iterator routines, > final SqlKind sqlKind) { > return Iterators.filter(routines, > new PredicateImpl() { > public boolean test(SqlOperator input) { > return input.getKind() == sqlKind; > } > }); > } > {code} > that cause we never obtain sum function which registered by user . -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1885) calcite code gen make many class in perm and it cant be gc
[ https://issues.apache.org/jira/browse/CALCITE-1885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093398#comment-16093398 ] Julian Hyde commented on CALCITE-1885: -- This is not surprising. If you use a connection pool the connections in the pool are not closed, only the wrapper that the connection pool creates on top of the connections is closed. That said, I'd hope that the generated class could be garbage collected when only the statement is closed; it should not have to wait for the connection. Have you tried using just a small pool (say 5 connections)? > calcite code gen make many class in perm and it cant be gc > --- > > Key: CALCITE-1885 > URL: https://issues.apache.org/jira/browse/CALCITE-1885 > Project: Calcite > Issue Type: Bug >Reporter: yiming.xu >Assignee: Julian Hyde > > calcite code gen make many class in perm and it cant be gc, how to unload > that class, i need help ! thx! > this is log for cluster env , i find it locked in classload and > Class.forname01: > java.lang.Thread.State: BLOCKED (on object monitor) > at > org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) > - waiting to lock <0x000340001cf8> (a > io.kyligence.kap.ext.CustomizedWebappClassloader) > at > io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76) > at java.lang.ClassLoader.loadClass(ClassLoader.java:411) > - locked <0x0005f9805b18> (a > org.codehaus.janino.ByteArrayClassLoader) > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > at Baz.bind(Unknown Source) > at > org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331) > at > org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294) > at > org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:553) > at > org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:544) > at > org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:193) > at > org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67) > at > org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44) > java.lang.Thread.State: BLOCKED (on object monitor) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:348) > at > org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:78) > at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254) > - locked <0x0005e9802818> (a > org.codehaus.janino.ClassLoaderIClassLoader) > this test case can reappear memory leak ,use it with csvtest! > BasicDataSource dataSource = (BasicDataSource) > BasicDataSourceFactory.createDataSource(new Properties()); > private void checkSql(String sql, String model, Function> fn) > throws SQLException { > Connection connection = null; > Statement statement = null; > try { > Properties info = new Properties(); > info.put("model", jsonPath(model)); > dataSource.setDriverClassName(Driver.class.getName()); > dataSource.setUrl("jdbc:calcite:model=" + jsonPath(model)); > connection = dataSource.getConnection(); > statement = connection.createStatement(); > final ResultSet resultSet = > statement.executeQuery( > sql); > fn.apply(resultSet); > } catch (Exception e) { > e.printStackTrace(); > } finally { > close(connection, statement); > } > } > the test case: > @Test > public void testConcurrentQuery() throws SQLException, InterruptedException > { > final String sql = "select * \n" > + "from long_emps"; > final AtomicLong a = new AtomicLong(0); > long start = System.currentTimeMillis(); > final Semaphore semaphore = new Semaphore(0); > for (int i = 0; i < 8; i++) { > new Thread(new Runnable() { > int count = 0; > @Override > public void run() { > while (true) { > sql("bug", sql).checking(new Function () { > public Void apply(ResultSet resultSet) { > return null; > } > }).ok(); > semaphore.release(); > //System.out.println(Thread.currentThread().getName() + ":" + > count); > } > } > }).start(); > } > semaphore.acquire(100); > System.out.println(System.currentTimeMillis() - start); > } -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-1884) dateStringToUnixDate() / unixDateToString() returns wrong results
[ https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093387#comment-16093387 ] Julian Hyde commented on CALCITE-1884: -- [~yuqi], What wiki are you referring to? Calcite doesn't have a wiki. > dateStringToUnixDate() / unixDateToString() returns wrong results > - > > Key: CALCITE-1884 > URL: https://issues.apache.org/jira/browse/CALCITE-1884 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.13.0 >Reporter: Haohui Mai >Assignee: yuemeng > > dateStringToUnixDate() / unixDateToString() do not return consistent result. > The following test fails: > {noformat} > @Test public void testUnixDate() { > int days = DateTimeUtils.dateStringToUnixDate("1500-04-30"); > assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days)); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (CALCITE-1885) calcite code gen make many class in perm and it cant be gc
[ https://issues.apache.org/jira/browse/CALCITE-1885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] yiming.xu updated CALCITE-1885: --- Description: calcite code gen make many class in perm and it cant be gc, how to unload that class, i need help ! thx! this is log for cluster env , i find it locked in classload and Class.forname01: java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) - waiting to lock <0x000340001cf8> (a io.kyligence.kap.ext.CustomizedWebappClassloader) at io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) - locked <0x0005f9805b18> (a org.codehaus.janino.ByteArrayClassLoader) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at Baz.bind(Unknown Source) at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331) at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294) at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:553) at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:544) at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:193) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44) java.lang.Thread.State: BLOCKED (on object monitor) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:78) at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254) - locked <0x0005e9802818> (a org.codehaus.janino.ClassLoaderIClassLoader) this test case can reappear memory leak ,use it with csvtest! BasicDataSource dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(new Properties()); private void checkSql(String sql, String model, Functionfn) throws SQLException { Connection connection = null; Statement statement = null; try { Properties info = new Properties(); info.put("model", jsonPath(model)); dataSource.setDriverClassName(Driver.class.getName()); dataSource.setUrl("jdbc:calcite:model=" + jsonPath(model)); connection = dataSource.getConnection(); statement = connection.createStatement(); final ResultSet resultSet = statement.executeQuery( sql); fn.apply(resultSet); } catch (Exception e) { e.printStackTrace(); } finally { close(connection, statement); } } the test case: @Test public void testConcurrentQuery() throws SQLException, InterruptedException { final String sql = "select * \n" + "from long_emps"; final AtomicLong a = new AtomicLong(0); long start = System.currentTimeMillis(); final Semaphore semaphore = new Semaphore(0); for (int i = 0; i < 8; i++) { new Thread(new Runnable() { int count = 0; @Override public void run() { while (true) { sql("bug", sql).checking(new Function () { public Void apply(ResultSet resultSet) { return null; } }).ok(); semaphore.release(); //System.out.println(Thread.currentThread().getName() + ":" + count); } } }).start(); } semaphore.acquire(100); System.out.println(System.currentTimeMillis() - start); } was: calcite code gen make many class in perm and it cant be gc, how to unload that class, i need help ! thx! this is log for cluster env , i find it locked in classload and Class.forname01: java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) - waiting to lock <0x000340001cf8> (a io.kyligence.kap.ext.CustomizedWebappClassloader) at io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) - locked <0x0005f9805b18> (a org.codehaus.janino.ByteArrayClassLoader) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at Baz.bind(Unknown Source) at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331) at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294) at
[jira] [Updated] (CALCITE-1885) calcite code gen make many class in perm and it cant be gc
[ https://issues.apache.org/jira/browse/CALCITE-1885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] yiming.xu updated CALCITE-1885: --- Description: calcite code gen make many class in perm and it cant be gc, how to unload that class, i need help ! thx! this is log for cluster env , i find it locked in classload and Class.forname01: java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) - waiting to lock <0x000340001cf8> (a io.kyligence.kap.ext.CustomizedWebappClassloader) at io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) - locked <0x0005f9805b18> (a org.codehaus.janino.ByteArrayClassLoader) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at Baz.bind(Unknown Source) at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331) at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294) at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:553) at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:544) at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:193) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44) java.lang.Thread.State: BLOCKED (on object monitor) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:78) at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254) - locked <0x0005e9802818> (a org.codehaus.janino.ClassLoaderIClassLoader) this test case can reappear memory leak ,use it with csvtest! BasicDataSource dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(new Properties()); private void checkSql(String sql, String model, Functionfn) throws SQLException { Connection connection = null; Statement statement = null; try { Properties info = new Properties(); info.put("model", jsonPath(model)); dataSource.setDriverClassName(Driver.class.getName()); dataSource.setUrl("jdbc:calcite:model=" + jsonPath(model)); connection = dataSource.getConnection(); statement = connection.createStatement(); final ResultSet resultSet = statement.executeQuery( sql); fn.apply(resultSet); } catch (Exception e) { e.printStackTrace(); } finally { close(connection, statement); } } the test case: @Test public void testConcurrentQuery() throws SQLException, InterruptedException { final String sql = "select * \n" + "from long_emps"; final AtomicLong a = new AtomicLong(0); long start = System.currentTimeMillis(); final Semaphore semaphore = new Semaphore(0); for (int i = 0; i < 8; i++) { new Thread(new Runnable() { int count = 0; @Override public void run() { while (true) { sql("bug", sql).checking(new Function () { public Void apply(ResultSet resultSet) { return null; } }).ok(); semaphore.release(); //System.out.println(Thread.currentThread().getName() + ":" + count); } } }).start(); } semaphore.acquire(100); System.out.println(System.currentTimeMillis() - start); } was: calcite code gen make many class in perm and it cant be gc, how to unload that class, i need help ! thx! this is log for cluster env , i find it locked in classload and Class.forname01: java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) - waiting to lock <0x000340001cf8> (a io.kyligence.kap.ext.CustomizedWebappClassloader) at io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) - locked <0x0005f9805b18> (a org.codehaus.janino.ByteArrayClassLoader) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at Baz.bind(Unknown Source) at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331) at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294) at
[jira] [Commented] (CALCITE-1885) calcite code gen make many class in perm and it cant be gc
[ https://issues.apache.org/jira/browse/CALCITE-1885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16093030#comment-16093030 ] yiming.xu commented on CALCITE-1885: Hi !Julian,I have a new discovery,{color:red} if i use dbcp connect pool{color} , the bz class cant be gc , because CalciteSignature have it referring. i close connection still invalid, Is this a bug? > calcite code gen make many class in perm and it cant be gc > --- > > Key: CALCITE-1885 > URL: https://issues.apache.org/jira/browse/CALCITE-1885 > Project: Calcite > Issue Type: Bug >Reporter: yiming.xu >Assignee: Julian Hyde > > calcite code gen make many class in perm and it cant be gc, how to unload > that class, i need help ! thx! > this is log for cluster env , i find it locked in classload and > Class.forname01: > java.lang.Thread.State: BLOCKED (on object monitor) > at > org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) > - waiting to lock <0x000340001cf8> (a > io.kyligence.kap.ext.CustomizedWebappClassloader) > at > io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76) > at java.lang.ClassLoader.loadClass(ClassLoader.java:411) > - locked <0x0005f9805b18> (a > org.codehaus.janino.ByteArrayClassLoader) > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > at Baz.bind(Unknown Source) > at > org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331) > at > org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294) > at > org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:553) > at > org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:544) > at > org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:193) > at > org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67) > at > org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44) > java.lang.Thread.State: BLOCKED (on object monitor) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:348) > at > org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:78) > at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254) > - locked <0x0005e9802818> (a > org.codehaus.janino.ClassLoaderIClassLoader) > this test case can reappear memory leak ,use it with csvtest! > BasicDataSource dataSource = (BasicDataSource) > BasicDataSourceFactory.createDataSource(new Properties()); > private void checkSql(String sql, String model, Function> fn) > throws SQLException { > Connection connection = null; > Statement statement = null; > try { > Properties info = new Properties(); > info.put("model", jsonPath(model)); > dataSource.setDriverClassName(Driver.class.getName()); > dataSource.setUrl("jdbc:calcite:model=" + jsonPath(model)); > connection = dataSource.getConnection(); > statement = connection.createStatement(); > final ResultSet resultSet = > statement.executeQuery( > sql); > fn.apply(resultSet); > } catch (Exception e) { > e.printStackTrace(); > } finally { > close(connection, statement); > } > } -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (CALCITE-1885) calcite code gen make many class in perm and it cant be gc
[ https://issues.apache.org/jira/browse/CALCITE-1885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] yiming.xu updated CALCITE-1885: --- Description: calcite code gen make many class in perm and it cant be gc, how to unload that class, i need help ! thx! this is log for cluster env , i find it locked in classload and Class.forname01: java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) - waiting to lock <0x000340001cf8> (a io.kyligence.kap.ext.CustomizedWebappClassloader) at io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) - locked <0x0005f9805b18> (a org.codehaus.janino.ByteArrayClassLoader) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at Baz.bind(Unknown Source) at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331) at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294) at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:553) at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:544) at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:193) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44) java.lang.Thread.State: BLOCKED (on object monitor) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:78) at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254) - locked <0x0005e9802818> (a org.codehaus.janino.ClassLoaderIClassLoader) this test case can reappear memory leak ,use it with csvtest! BasicDataSource dataSource = (BasicDataSource) BasicDataSourceFactory.createDataSource(new Properties()); private void checkSql(String sql, String model, Functionfn) throws SQLException { Connection connection = null; Statement statement = null; try { Properties info = new Properties(); info.put("model", jsonPath(model)); dataSource.setDriverClassName(Driver.class.getName()); dataSource.setUrl("jdbc:calcite:model=" + jsonPath(model)); connection = dataSource.getConnection(); statement = connection.createStatement(); final ResultSet resultSet = statement.executeQuery( sql); fn.apply(resultSet); } catch (Exception e) { e.printStackTrace(); } finally { close(connection, statement); } } was: calcite code gen make many class in perm and it cant be gc, how to unload that class, i need help ! thx! this is log for cluster env , i find it locked in classload and Class.forname01: java.lang.Thread.State: BLOCKED (on object monitor) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) - waiting to lock <0x000340001cf8> (a io.kyligence.kap.ext.CustomizedWebappClassloader) at io.kyligence.kap.ext.CustomizedWebappClassloader.loadClass(CustomizedWebappClassloader.java:76) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) - locked <0x0005f9805b18> (a org.codehaus.janino.ByteArrayClassLoader) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at Baz.bind(Unknown Source) at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:331) at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294) at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:553) at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:544) at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:193) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67) at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44) java.lang.Thread.State: BLOCKED (on object monitor) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.codehaus.janino.ClassLoaderIClassLoader.findIClass(ClassLoaderIClassLoader.java:78) at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254) - locked <0x0005e9802818> (a org.codehaus.janino.ClassLoaderIClassLoader) > calcite code gen make many class in perm and it cant be gc >
[jira] [Issue Comment Deleted] (CALCITE-1882) Can't obtain the user defined aggregate function such as sum,avg by calcite
[ https://issues.apache.org/jira/browse/CALCITE-1882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] yuqi updated CALCITE-1882: -- Comment: was deleted (was: I think this is caused by the fact that when construct UserDefineAggFunction, calcite set the parameter paramType null ,and thus can't distinct which is buildin and which is created by us. this will lead to another problem: {color:red}udaf does not support overload{color} ) > Can't obtain the user defined aggregate function such as sum,avg by calcite > --- > > Key: CALCITE-1882 > URL: https://issues.apache.org/jira/browse/CALCITE-1882 > Project: Calcite > Issue Type: Bug >Affects Versions: 1.12.0 >Reporter: yuemeng >Assignee: yuemeng >Priority: Critical > > If we want to register a sum or avg aggregate function to deal with different > data type such as sum(double) ,we implement a SqlUserDefinedAggFunction and > register with name sum,but when we execute a sql like: > {code} > select id,sum(payment) from table test group by id > {code} > in fact,it always give the SqlSumAggFunction function which builtin by > calcite,never find the exactly function which we register by ourself. > During sql parse process,method createCall in SqlAbstractParserImpl will be > called, > {code} > protected SqlCall createCall( > SqlIdentifier funName, > SqlParserPos pos, > SqlFunctionCategory funcType, > SqlLiteral functionQualifier, > SqlNode[] operands) { > SqlOperator fun = null; > // First, try a half-hearted resolution as a builtin function. > // If we find one, use it; this will guarantee that we > // preserve the correct syntax (i.e. don't quote builtin function > /// name when regenerating SQL). > if (funName.isSimple()) { > final List list = Lists.newArrayList(); > opTab.lookupOperatorOverloads(funName, funcType, SqlSyntax.FUNCTION, > list);//we lookup in SqlStdOperatorTable,and always find buidin function for > sum ,avg .eg > if (list.size() == 1) { > fun = list.get(0); > } > } > // Otherwise, just create a placeholder function. Later, during > // validation, it will be resolved into a real function reference. > if (fun == null) { > fun = new SqlUnresolvedFunction(funName, null, null, null, null, > funcType); > } > return fun.createCall(functionQualifier, pos, operands); > } > {code} > but the problem will be appear in deriveType,because of we get the > SqlSumAggFunction previously,and the sqlKind of SqlSumAggFunction is AVG,but > the sqlKind of sql user defined agg function (sum) which we register by > ourself is OTHER_FUNCTION,so it filter out our sum function. > {code} > private static Iterator > filterOperatorRoutinesByKind(Iterator routines, > final SqlKind sqlKind) { > return Iterators.filter(routines, > new PredicateImpl() { > public boolean test(SqlOperator input) { > return input.getKind() == sqlKind; > } > }); > } > {code} > that cause we never obtain sum function which registered by user . -- This message was sent by Atlassian JIRA (v6.4.14#64029)