[jira] [Created] (CALCITE-5121) Rethrow RuntimeException as SQLException in Driver#onConnectionInit
Gregory Hart created CALCITE-5121: - Summary: Rethrow RuntimeException as SQLException in Driver#onConnectionInit Key: CALCITE-5121 URL: https://issues.apache.org/jira/browse/CALCITE-5121 Project: Calcite Issue Type: Bug Components: core Affects Versions: 1.30.0 Reporter: Gregory Hart The documentation for org.apache.calcite.avatica.Handler#onConnectionInit states that a SQLException should be thrown "on error". However, the implementation of onConnectInit in org.apache.calcite.jdbc.Driver allows for other types of exceptions to be thrown. This also breaks the documentation contract for java.sql.Driver#connect since a RuntimeException could be throw instead of the expected SQLException. *Steps to reproduce:* DriverManager.getConnection("jdbc:calcite:schemaType=JDBC;schema.jdbcUrl=jdbc:invalid:"); *Expected result:* A SQLException is thrown *Actual result:* A RuntimeException is thrown {code:java} java.lang.RuntimeException: Error instantiating JsonCustomSchema(name=adhoc) at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:277) at org.apache.calcite.model.JsonCustomSchema.accept(JsonCustomSchema.java:66) at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:200) at org.apache.calcite.model.ModelHandler.(ModelHandler.java:106) at org.apache.calcite.jdbc.Driver$1.onConnectionInit(Driver.java:101) at org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:139) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:270){code} -- This message was sent by Atlassian Jira (v8.20.7#820007)
[jira] [Created] (CALCITE-5120) Throw SQLException from UnregisteredDriver#connect if url is null
Gregory Hart created CALCITE-5120: - Summary: Throw SQLException from UnregisteredDriver#connect if url is null Key: CALCITE-5120 URL: https://issues.apache.org/jira/browse/CALCITE-5120 Project: Calcite Issue Type: Bug Components: avatica Affects Versions: avatica-1.20.0 Reporter: Gregory Hart The documentation for java.sql.Driver#connect states that a SQLException should be thrown "if a database access error occurs or the url is null." However, UnregisteredDriver throws a NullPointerException instead. *Steps to reproduce:* new org.apache.calcite.avatica.remote.Driver().connect(null, new Properties()); *Expected result:* A SQLException is thrown *Actual result:* A NullPointerException is thrown {noformat} java.lang.NullPointerException at org.apache.calcite.avatica.UnregisteredDriver.acceptsURL(UnregisteredDriver.java:144) at org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:130){noformat} -- This message was sent by Atlassian Jira (v8.20.7#820007)
[jira] [Created] (CALCITE-5119) SqlNode#unparse hides an alias table when using CTE
Mitsunori Komatsu created CALCITE-5119: -- Summary: SqlNode#unparse hides an alias table when using CTE Key: CALCITE-5119 URL: https://issues.apache.org/jira/browse/CALCITE-5119 Project: Calcite Issue Type: Bug Components: core Affects Versions: 1.30.0 Reporter: Mitsunori Komatsu Hi team, I found SqlNode#unparse hides an alias table when using CTE. {code:java} val planner = Frameworks.getPlanner(config) val sql = """ WITH cte AS ( select 42 as i ) SELECT i FROM ( SELECT [i] from cte ) AS [alias] ORDER BY [alias].[i] """.trimIndent() val node = planner.parse(sql) println(node.toSqlString { c -> c.withDialect(PrestoSqlDialect.DEFAULT) .withAlwaysUseParentheses(false) .withSubQueryStyle(SqlWriter.SubQueryStyle.HYDE) .withClauseStartsLine(false) .withClauseEndsLine(false) }) {code} This code shows the following {code:java} WITH "cte" AS (SELECT 42 AS "i") (SELECT "i" FROM (SELECT "i" FROM "cte") AS "alias") ORDER BY "alias"."i"{code} The `AS "alias"` is inside a block and the last `ORDER BY` can't find `alias` and this query fails with Presto. I think the output should be as follows {code:java} WITH "cte" AS (SELECT 42 AS "i") SELECT "i" FROM (SELECT "i" FROM "cte") AS "alias" ORDER BY "alias"."i"{code} -- This message was sent by Atlassian Jira (v8.20.7#820007)
[jira] [Created] (CALCITE-5118) SqlDatePartFunction#rewriteCall should check operands length
Benchao Li created CALCITE-5118: --- Summary: SqlDatePartFunction#rewriteCall should check operands length Key: CALCITE-5118 URL: https://issues.apache.org/jira/browse/CALCITE-5118 Project: Calcite Issue Type: Improvement Components: core Affects Versions: 1.30.0 Reporter: Benchao Li Assignee: Benchao Li Fix For: 1.31.0 {{SqlDatePartFunction#rewriteCall}} does not check operands length for now, and it will be rewrite to {{EXTRACT}} unconditionally before validation. E.g. {code:sql} select week(); -- will throw ArrayIndexOutOfBoundsException select week(date '2022-04-27', 1); -- will just ignore second param {code} -- This message was sent by Atlassian Jira (v8.20.7#820007)
Re: [ANNOUNCE] Master branch renamed to main
Thanks for checking Francis! Hopefully that means we won't have any issues. -- Michael Mior mm...@apache.org Le mar. 26 avr. 2022 à 22:23, Francis Chuang a écrit : > Quick update. I just did a dry-run release for Avatica and it built fine > without needing to set the branch in vlsi-release-plugin's configuration. > > The plugin only pushes tags to git and I don't think it ever commits any > files, so I don't think it needs to know about us renaming our default > branch to main. I also ran `git branch -a` in my local copy of Avatica > and I don't see any branch or references to "master" after running a > dry-run release. > > On 27/04/2022 9:03 am, Michael Mior wrote: > > One outstanding issue is that I was unable to set the branch to main for > > stage-vote-release-plugin. I believe it may default to "master", so I'm > not > > sure if we'll run into issues on the next release. > > -- > > Michael Mior > > mm...@apache.org > > > > > > Le mar. 26 avr. 2022 à 16:30, Julian Hyde a écrit : > > > >> Thanks, Michael. It all looks good from my end. > >> > >> I had opened a pull request yesterday (when the branch was named > >> 'master') and it merged smoothly today (after the rename). > >> > >> Julian > >> > >> On Tue, Apr 26, 2022 at 7:54 AM Michael Mior wrote: > >>> > >>> The master branch has now been renamed to main. If you have an existing > >>> checkout, please follow the steps below (thanks to Francis!) to ensure > >> your > >>> local master branch is also correctly renamed. Note that if you do not > >> have > >>> any local changes, you can also simply clone a new copy of the > repository > >>> and the default branch will now be main. > >>> > >>> 1. Ensure you are in the repository's folder in your command line. > >>> 2. Stash any uncommitted changes: > >>>- git stash > >>> 3. Check out your local master branch: > >>>- git checkout master > >>> 4. Rename your local master branch to main: > >>>- git branch -m master main > >>> 5. Fetch latest commits and branches from remote: > >>>- git fetch > >>> 6. Remove the tracking branch: > >>>- git branch --unset-upstream > >>> 7. Create a new tracking branch (assuming the remote is called > >> origin): > >>>- git branch -u origin/main > >>> 8. Restore your uncommitted changes: > >>>- git stash pop > >>> > >>> -- > >>> Michael Mior > >>> mm...@apache.org > >> > > >