Problem using MySQL with JDBC

2021-10-06 Thread Justin Swanhart
I am probably making some obvious mistake, but I am having a problem getting a simple MySQL JDBC connection working. I have the latest version of the Connector/J MySQL java client driver. I have a MySQL 8 server running on the local machine, and the following model JSON: { version: '1.0', def

Re: Problem using MySQL with JDBC

2021-10-06 Thread Justin Swanhart
d appreciate it. On Wed, Oct 6, 2021 at 1:59 PM Julian Hyde wrote: > It looks as if com.mysql.cj.jdbc.Driver is not on your class path. > > If you are launching via SQLLine, you will need to edit the sqlline shell > script to add a jar (or jars) to your class path. > > Julian &g

Re: Problem using MySQL with JDBC

2021-10-06 Thread Justin Swanhart
shading? Maybe Class.forName with a constant > argument is handled by the shading, but Calcite is calling Class.forName > with a dynamic argument. > > > On Oct 6, 2021, at 11:41 AM, Justin Swanhart > wrote: > > > > Hi, > > > > The jar is in the classpath, an

Re: Problem using MySQL with JDBC

2021-10-06 Thread Justin Swanhart
ly :) On Wed, Oct 6, 2021 at 2:59 PM Justin Swanhart wrote: > Hi, > > The class.forName doesn't work for me though (tried > org.mysql.cj.jdbc.Driver and org.mysql.jdbc.Driver), but just using a > "jdbc:mysql://" connection string does work. > > It makes sens

Re: Problem using MySQL with JDBC

2021-10-06 Thread Justin Swanhart
if you remove the line > > jdbcDriver: 'com.mysql.cj.jdbc.Driver’, > > from your Calcite model? Hopefully, it just works. Most drivers load > automatically these days, and if you don’t specify the class name, Calcite > won’t try to load it manually. > > >

Re: Problem using MySQL with JDBC

2021-10-06 Thread Justin Swanhart
nd: { jdbcUrl: 'jdbc:mysql://localhost/ssb', jdbcUser: 'root', jdbcPassword: '' } } ] } On Wed, Oct 6, 2021 at 3:15 PM Justin Swanhart wrote: > Caused by: com.google.common.util.concurrent.UncheckedExecutionException: > java.lan

Re: Problem using MySQL with JDBC

2021-10-07 Thread Justin Swanhart
cluded the MySQL driver. I reverted all my changes except the one to core/build.gradle.kts and it works. I assume this is the right thing to do, but if not, let me know. On Wed, Oct 6, 2021 at 3:16 PM Justin Swanhart wrote: > [justin@localhost calcite]$ cat ../calcite.old/test.json > { &

Re: Problem using MySQL with JDBC

2021-10-07 Thread Justin Swanhart
to respect the case of the tables and columns without using literals. Any suggestions? On Thu, Oct 7, 2021 at 4:08 PM Justin Swanhart wrote: > Hi, > > I had to really go down a rabbit hole here to figure out exactly what was > wrong (see below) but I was able to resolve the

Error using pre-built materializations with JDBC schema sources

2021-10-08 Thread Justin Swanhart
I have several materialized views in a MySQL database that I would like to use for materialized view rewrite. For example I have a "materialized view" named mv_date_summary which for simplicity could be created with: create table mv_date_summary as select LO_OrderDateKey, D_Year, D_Month, D_DayNum

Re: How to get the real column name and data type from a SQL view ?

2021-11-09 Thread Justin Swanhart
I have not looked at the code, so excuse me if this is a terrible question, but is this recursive? Ie: create view a_view as select a_column from a_table where b_column = 1; select * from ( -- this could be a view or just a dependent subquery like this select cast(sq1_col ...) as a_column fr

Re: [DISCUSS] Apache Calcite Online Meetup January 2022

2021-11-19 Thread Justin Swanhart
+1 for an online meetup On Fri, Nov 19, 2021, 11:32 AM Jacques Nadeau wrote: > WRT to talk structure, I propose we do 5 or 10 minute lightning talks as > opposed to something longer. It ensures a wider variety of topics, better > attendance and you never have to sit that long through something y

Re: [jira] [Created] (CALCITE-4896) GROUP BY might get wrong results under certain circumstances in Elasticsearch Adapter

2021-11-21 Thread Justin Swanhart
If I am understanding correctly, the field2 value is NULL. Count(0) should be 2 and count(field2)==2 because of the way aggregates treat NULL values. On Fri, Nov 19, 2021, 8:21 PM ZheHu (Jira) wrote: > ZheHu created CALCITE-4896: > -- > > Summary: GROUP

Re: [jira] [Created] (CALCITE-4896) GROUP BY might get wrong results under certain circumstances in Elasticsearch Adapter

2021-11-21 Thread Justin Swanhart
Typo. Count(int_field) should be 1. Oops. On Sun, Nov 21, 2021, 6:56 AM Justin Swanhart wrote: > If I am understanding correctly, the field2 value is NULL. > > Count(0) should be 2 and count(field2)==2 because of the way aggregates > treat NULL values. > > On Fri, Nov 19, 2

Re: [jira] [Created] (CALCITE-4896) GROUP BY might get wrong results under certain circumstances in Elasticsearch Adapter

2021-11-21 Thread Justin Swanhart
I should not send emails before I have coffee. On Sun, Nov 21, 2021, 6:57 AM Justin Swanhart wrote: > Typo. Count(int_field) should be 1. Oops. > > On Sun, Nov 21, 2021, 6:56 AM Justin Swanhart wrote: > >> If I am understanding correctly, the field2 value is NULL. >>

Re: [jira] [Created] (CALCITE-4896) GROUP BY might get wrong results under certain circumstances in Elasticsearch Adapter

2021-11-21 Thread Justin Swanhart
ter, NULL and > Integer.MIN_VALUE will be in the same group, which is not correct for SQL > users. > > > On 11/21/2021 19:56,Justin Swanhart wrote: > If I am understanding correctly, the field2 value is NULL. > > Count(0) should be 2 and count(field2)==2 because of the way agg

Re: [jira] [Created] (CALCITE-4896) GROUP BY might get wrong results under certain circumstances in Elasticsearch Adapter

2021-11-21 Thread Justin Swanhart
far as I know, in Elasticsearch, reserved value for NULL is often > used when people know specific data range. > As for this issue, someone else may find a better solution. Are you > interested? Swanhart. > > > > > On 11/21/2021 21:30,Justin Swanhart wrote: > Thanks for

Re: Error using pre-built materializations with JDBC schema sources

2022-01-06 Thread Justin Swanhart
> > There are a few tests similar to your use case in the repository; check > MaterializationTest#testViewSchemaPath [1] for instance. Maybe you can take > inspiration from there. > > Best, > Stamatis > > [1] > > https://github.com/apache/calcite/blob/460de048042

Re: Error using pre-built materializations with JDBC schema sources

2022-01-06 Thread Justin Swanhart
t; on \"LO_OrderDateKey\" = \"D_DateKey\" group by \"D_Year\", \"D_Month\", \"D_DayNumInMonth\", \"LO_OrderDateKey\"" } ] } ] } I can't see how to use existing materializations with the JDBC adapter and the test

Re: Projection for SELECT COUNT(*)

2022-01-19 Thread Justin Swanhart
Hi, So what you are saying is when the TableScan gets a zero length record (no projections means no record is projected so it has a length of zero) it treats that as a request to read all columns instead of zero columns? That sounds like a bug in the TableScan. On Wed, Jan 19, 2022 at 10:32 AM V

Re: New rule for Converting UNION ALL with same inputs but different filters to single input with OR FILTER

2022-01-19 Thread Justin Swanhart
Hi, Note that this will negate the optimization that one usually is looking for when writing such queries: Select * from TAB where a = 1 UNION ALL Select * from TAB where b = 1 In a database with indexes (most databases) this will allow indexes to be used on both the a column and the b column. D

Re: New rule for Converting UNION ALL with same inputs but different filters to single input with OR FILTER

2022-01-23 Thread Justin Swanhart
values. > > > > > > Otherwise > > > > > > the rule can't be applied. > > > > > > > > > > > > For EXCEPT ALL: > > > > > > same for EXCEPT. > > > > > > > > > > > > > > > &g

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-10 Thread Justin Swanhart
This is a SQL limitation. mysql> select sum(1); ++ | sum(1) | ++ | 1 | ++ 1 row in set (0.00 sec) mysql> select sum(sum(1)); ERROR (HY000): Invalid use of group function On Thu, Feb 10, 2022 at 12:39 PM Gavin Ray wrote: > Went to test this query out and found

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-10 Thread Justin Swanhart
(t.y + 3)” and “2 + SUM(t.y + 3)” occur after aggregation. SQL > semantics rely heavily on this stratification. Allowing an extra level of > aggregation would mess it all up. > > Julian > > > > > On Feb 10, 2022, at 9:45 AM, Justin Swanhart > wrote: >

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-10 Thread Justin Swanhart
Just out of curiosity, is the second level aggregation using AVG in a window context? It the frame is the whole table and it aggregates over it? On Thu, Feb 10, 2022 at 3:12 PM Justin Swanhart wrote: > That is really neat about Oracle. > > The alternative in general is to use a

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-10 Thread Justin Swanhart
I wish you could unsend emails :) Answering my own question, no, because that would return three rows with the average :D On Thu, Feb 10, 2022 at 3:16 PM Justin Swanhart wrote: > Just out of curiosity, is the second level aggregation using AVG in a > window context? It the frame is the

Re: Exception parsing "SELECT @@character_set_server"

2022-03-22 Thread Justin Swanhart
MySQL support two categories of variables, user variables which are prefixed with the @character and session/global SERVER variables which are prefixed with @@. You can also access them via: Select @@session.session_var; Select @@global.global_var; select @@session_or_global_var; for example: my

Re: A basic, DB-agnostic question about the concept of a "Physical Plan"

2022-03-23 Thread Justin Swanhart
Hi, Generally a cost-based optimizer chooses physical plans (sometimes with help from a rules-based optimizer). Hints (/*+USE_NL*/ /*+HASH_JOIN*/) etc (depends on RDBMS) generally allow the user to override the optimizer and choose a physical plan that differs from what the database would pick.

Re: Exception parsing "SELECT @@character_set_server"

2022-03-28 Thread Justin Swanhart
parser. > > > > Julian > > > > > >> On Mar 28, 2022, at 4:04 AM, Adolfo Ochagavía <mailto:ado...@ochagavia.nl>> wrote: > >> > >> Would you be open to a patch to add proper support for this kind of > MySQL variables, or do you consider it to be o

Re: Does someone interested in integration calcite + PostgreSQL wire protocol ?

2022-09-11 Thread Justin Swanhart
+1 On Sun, Sep 11, 2022 at 10:50 AM Gavin Ray wrote: > Understandable, no worries =) > > On Sun, Sep 11, 2022 at 2:49 AM Dmitry Sysolyatin > > wrote: > > > unfortunately, I can't reveal the details of the implementation until our > > company has given the official right to make this project ope