MaterializationService.THREAD_INSTANCE vs INSTANCE

2018-09-26 Thread Luis Fernando Kauer
Hi. I'm trying to use Calcite to optimize queries rewriting the queries to use materialized views. First, I found the following doc page about materialization in Calcite website by googling but I coudn't find a link to it in Calcite's website. Anyway, it does not explain how to add

Benchmarking Calcite - starting the conversation on the targets and design of the benchmark

2018-02-04 Thread Luis Fernando Kauer
I'd like to share the following link that I came across sime time ago about a product that uses Calcite to optimize Spark queries.  https://www.datascience.com/blog/grunion-data-science-tools-query-optimizer-apache-spark

[jira] [Created] (CALCITE-2081) NPE in join of 2 subqueries using window functions

2017-12-08 Thread Luis Fernando Kauer (JIRA)
Luis Fernando Kauer created CALCITE-2081: Summary: NPE in join of 2 subqueries using window functions Key: CALCITE-2081 URL: https://issues.apache.org/jira/browse/CALCITE-2081 Project: Calcite

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Luis Fernando Kauer
cause it was recently refactored. It's usually easier for other people to test the problem if you create runnable test cases to show the problem. Em sexta-feira, 17 de novembro de 2017 14:29:09 BRST, Enrico Olivelli <eolive...@gmail.com> escreveu: In the RowType I have 'k1' and not &

Re: BindableTableScan is losing aliased named

2017-11-17 Thread Luis Fernando Kauer
Did you execute the query? ProjectRemoveRule removes the Project when it is "trivial".  Since the only used project was pushed to BindableTableScan, the Project would only set the alias, but that can be done in row type. The result is correct because RowType is preserved with the alias.  It

Re: Project + Sort on single and on multiple columns

2017-11-14 Thread Luis Fernando Kauer
t reduces the > number of columns (as most Projects do) then the Sort will have lower cost > if performed after the Project, because it is handling fewer bytes. > > > > On Nov 10, 2017, at 10:32 AM, Luis Fernando Kauer > <lfka...@yahoo.com.br.INVALID> wrote: > > > &

Re: Aliases for schemas

2017-11-14 Thread Luis Fernando Kauer
Hi, FrameworkConfig has getDefaultSchema(), from javadoc "Returns the default schema that should be checked before looking at the root schema.  Returns null to only consult the root schema". So, if you are using Frameworks.newConfigBuilder(), you can set it using ".defaultSchema(

Re: Project + Sort on single and on multiple columns

2017-11-10 Thread Luis Fernando Kauer
I'm trying to fix https://issues.apache.org/jira/browse/CALCITE-1906 and I'm facing a similar problem. After managing to make JdbcSort to work, sometimes the JdbcProject is above JdbcSort and the generated SQL is wrong because RelToSqlConverter uses SqlImplementator.Clause enum to decide when

Re: Recycling Planner objects

2017-11-10 Thread Luis Fernando Kauer
Sorry, My knowledge hasn't reached that far. Currently the tutorial and example code is mostly for creating new adapters. I think we need tutorial, documentation and example code to work directly with the planner, because it is a lot harder. Regards, Luis Fernando Em quinta-feira, 9 de

Re: Volcano planner

2017-11-08 Thread Luis Fernando Kauer
If you intend to run a query then you should follow the tutorial and try to change the csv adapter.  You can add the table to the schema at runtime using something like: - Class.forName("org.apache.calcite.jdbc.Driver");

[jira] [Created] (CALCITE-2044) Tweak cost of BindableTableScan to make sure Project is pushed through Aggregate

2017-11-08 Thread Luis Fernando Kauer (JIRA)
Luis Fernando Kauer created CALCITE-2044: Summary: Tweak cost of BindableTableScan to make sure Project is pushed through Aggregate Key: CALCITE-2044 URL: https://issues.apache.org/jira/browse/CALCITE

Re: ProjectableFilterableTable.scan() and expensive columns

2017-11-06 Thread Luis Fernando Kauer
CnSmzU2hPgGoBHx67hhcdFfWo4OSoQob6udt6lpA=wxCJy0-IChQRB53y7qCSONbcgJj24vGDvV1P8DylhMg=LBpaGzJP6rHVxjUmLc_MXY_w4P_jkJSIx5QhtdXGuiw=> > ?  There I suggested adding a new kind of metadata called > ExpressionComplexity. You could write your own handler that takes into > account SqlTypeName or wh

Re: ProjectableFilterableTable.scan() and expensive columns

2017-10-31 Thread Luis Fernando Kauer
outubro de 2017 13:38:05 BRST, Alexey Roytman <alexey.royt...@oracle.com> escreveu: Sorry for the delay, Luis Fernando. Please see below, as there are a number of answers. On 10/26/2017 09:37 PM, Luis Fernando Kauer wrote: >  I'm sorry, but I have no idea what you are talk

Re: ProjectableFilterableTable.scan() and expensive columns

2017-10-26 Thread Luis Fernando Kauer
:38:14 BRST, Luis Fernando Kauer <lfka...@yahoo.com.br.INVALID> escreveu: I'm sorry, but I have no idea what you are talking about. Cassandra Adapter has code to translate the plan to run the query in Cassandra Server. If you are only interested in querying CSV files I don't see how c

Re: ProjectableFilterableTable.scan() and expensive columns

2017-10-26 Thread Luis Fernando Kauer
I'm sorry, but I have no idea what you are talking about. Cassandra Adapter has code to translate the plan to run the query in Cassandra Server. If you are only interested in querying CSV files I don't see how copying that code without understanding it will help you. First of all, you need to

Re: ProjectableFilterableTable.scan() and expensive columns

2017-10-23 Thread Luis Fernando Kauer
Hi, Can you give us some examples of the queries you tested? Include the the query plan Calcite generated.  (Use EXPLAIN PLAN FOR you query) Currently, aggregates with no column reference, like count(*), generates a plan that scans all projects when using ProjectableFilterableTable. I'm not

Re: Re: Assunto: querying elastisearch fields

2017-10-05 Thread Luis Fernando Kauer
Your problem, again, is about the names being case sensitive.  Try using double quotes around column and table names to make sure they are interpreted correctly or use them all in uppercase, both in the json model and in the query.  You can also set a different lex property for the

Assunto: querying elastisearch fields

2017-10-05 Thread Luis Fernando Kauer
Did you take a look in the test cases for some examples of use?  https://github.com/apache/calcite/blob/master/elasticsearch5/src/test/java/org/apache/calcite/test/Elasticsearch5AdapterIT.java What have you tried? 

Re: Support of query for complex/nested data in calcite

2017-10-05 Thread Luis Fernando Kauer
Julian > On Oct 4, 2017, at 12:07 PM, Luis Fernando Kauer > <lfka...@yahoo.com.br.INVALID> wrote: > > > > Hi Joel. > > Nice to hear someone else is also concerned about this. > I'm more concerned about nested structures than unnesting simple arrays.What &

[jira] [Created] (CALCITE-2000) UNNEST a collection that has a field with nested data generates an Exception

2017-10-05 Thread Luis Fernando Kauer (JIRA)
Luis Fernando Kauer created CALCITE-2000: Summary: UNNEST a collection that has a field with nested data generates an Exception Key: CALCITE-2000 URL: https://issues.apache.org/jira/browse/CALCITE-2000

[jira] [Created] (CALCITE-1999) UNNEST generates a NPE when the parameter is null

2017-10-05 Thread Luis Fernando Kauer (JIRA)
Luis Fernando Kauer created CALCITE-1999: Summary: UNNEST generates a NPE when the parameter is null Key: CALCITE-1999 URL: https://issues.apache.org/jira/browse/CALCITE-1999 Project: Calcite

Re: Support of query for complex/nested data in calcite

2017-10-04 Thread Luis Fernando Kauer
quarta-feira, 4 de outubro de 2017 11:26:38 BRT, Joel Pfaff <joel.pf...@gmail.com> escreveu: Hello, Sorry I was not registered in the mailing list when Luis Fernando Kauer sent the mail, so I cannot reply directly to his. But we share a similar concern with ability to implement more

Query complex/nested data

2017-09-13 Thread Luis Fernando Kauer
Hi, We have many data in complex formats, similar to a json file, with nested collections and I would like to know what is the best approach to implement an adapter to read it efficiently.Users will probably end up joining the top level struct with the nested collections of struct when they

Re: Two newbie questions regarding Calcite Cassandra Adapter

2017-09-04 Thread Luis Fernando Kauer
Hi, I'll try to answer your questions since nobody else did. But I'm still fairly new to Calcite and I'm still learning it. I'll answer your questions in reverse order because the answer to the second question is important to answer the first question. 2. ConverterRules: how Calcite knows

BindableTableScan.computeSelfCost does not use projects or filters info into account

2017-08-28 Thread Luis Fernando Kauer
At first I was using TranslatableTable for my adapters (read files in different formats), but I realized that many rules apply only to ProjectableFilterableTable, so I started using it to take advantage of all these builtin rules. Restricting the projects that need to be scanned is very

Re: Rule to remove right part of a left join when no project is used after the join

2017-07-28 Thread Luis Fernando Kauer
e it would be wrong to fire the rule. If you intend to contribute this at some point, please file a JIRA case. You can attach a PR later. Julian On Fri, Jul 28, 2017 at 7:53 AM, Luis Fernando Kauer <lfka...@yahoo.com.br.invalid> wrote: > I'm still learning Calcite and how to conv

Re: Rule to remove right part of a left join when no project is used after the join

2017-07-28 Thread Luis Fernando Kauer
to (Project A). I don't recall how to add rules. Some people use Frameworks or Planner. Julian On Fri, Jul 21, 2017 at 12:42 PM, Luis Fernando Kauer <lfka...@yahoo.com.br.invalid> wrote: > Hi, > > I have a schema with a lot of normalized tables, which makes it hard for > us

[jira] [Created] (CALCITE-1906) JdbcSortRule has a bug and it is chosen

2017-07-27 Thread Luis Fernando Kauer (JIRA)
Luis Fernando Kauer created CALCITE-1906: Summary: JdbcSortRule has a bug and it is chosen Key: CALCITE-1906 URL: https://issues.apache.org/jira/browse/CALCITE-1906 Project: Calcite

Rule to remove right part of a left join when no project is used after the join

2017-07-21 Thread Luis Fernando Kauer
Hi, I have a schema with a lot of normalized tables, which makes it hard for users to build the queries. I would like to create views with all the joins already included so that users could just select the fields without worrying with multiple tables and join conditions. But the optimizer

Re: Explain Plan for aggregating a single column in CSV Adapter

2017-07-11 Thread Luis Fernando Kauer
ES, EMPS]], fields=[[1]])\n"; +sql("smart", "explain plan for " + sql).returns(plan).ok(); + } + @Test public void testFilterableSelect() throws SQLException { sql("filterable-model", "select name from EMPS").ok(); } Julian > O