Questions tagged [apache-calcite]

Apache Calcite is a data management framework. Not to be confused with Apache (HTTP Server).

Apache Calcite is a data management framework. It has an implementation of relational algebra, an extensible cost-based optimizer, and an optional SQL parser and JDBC driver.

Calcite is used by Apache Hive and Apache Drill as their query optimizers, and you can use it as a framework to build your own data engine.

Calcite was previously known as Optiq.

255 questions
0
votes
0 answers

How to generate sql for a relational algebra model with table sample using apache calcite?

I'm trying generate SQL statement out of a relational algebra model that uses a table sample expression. But it seems that the RelToSqlConverter class doesn't have an implementation for the Sample class which is used to represent the table sample…
Ant
  • 63
  • 8
0
votes
0 answers

apache caclcite user-defined aggregate function

I am implementing a user-defined aggregate function, it needs input two parameters like "AGG(column, 5)", the first is the agg column, the second is a number literal. I implement it like this: public class CalciteUDAF { public List init()…
Mr.zs
  • 1
0
votes
0 answers

Very slow SQL execution with LEFT JOIN and subquery after upgrade from Apache Ignite 2.7.6 to 2.13.0 / 2.14.0

After migration from Ignite 2.7.6 to Ignite 2.13 (same is on v2.14) I noticed that the query below executes very slowly. A big difference in execution time can be seen already in tables with several thousands of records. If table have more than…
0
votes
0 answers

How to force Calcite NOT to optimise SQL query while executing RelNode?

I'm building and executing RelNodes, and have only one jdbc source connected to Calcite. Sometimes Calcite ignores what is said in the RelNode and can simply push down "SELECT *" even if the node contains aggregation or column rename. As far as I…
kalmar
  • 45
  • 5
0
votes
0 answers

How to access additional information from the parser in my enumerator?

I extended the parser so that it accepts a range with two arguments as integers in the from clause, i. e., SELECT * FROM a RANGE x AND y where x, y are SqlNumericLiterals and range is a tableRef operator. However, I'm clueless how to access this…
user1091344
  • 612
  • 6
  • 27
0
votes
0 answers

How to register UDF in Apache Calcite so it will be push down while executing RelNode

I've registered my custom UDF like described here Apache Calcite - registering UDFs for use in RelBuilder: public static class ConvertTimestampToString { public final static String NAME = "format_datetime"; private static final…
kalmar
  • 45
  • 5
0
votes
1 answer

Calcite does not return correct SqlKind

I'm trying to use Apache Calcite to parse the SQL statement, I find that it does not give correct SqlKind for funciton like 'avg', 'sum', etc. Here is the code snippet, public void test() throws SqlParseException { String sql = "select avg(age)…
gfytd
  • 1,747
  • 2
  • 24
  • 47
0
votes
1 answer

What is the relevant rules of Flink Window TVF and CEP SQL?

I am trying to parse Flink windowing TVF sql column level lineage, I initial a custom FlinkChainedProgram and set some Opt rules. Mostly works fine except Window TVF SQL and CEP SQL. for example, I get a logical plan as insert into sink_table(f1,…
slo
  • 23
  • 5
0
votes
1 answer

How to get insert fields from sql?

I am using Flink Sql to parse sql's lineage. I use flink planner to parse a sql as insert into target_table(dest_f1, dest_f2) select source_f1, source_f2 from source_table Obviously, source_f1 is the source of dest_f1. When I get a…
slo
  • 23
  • 5
0
votes
1 answer

how to remove quote gracefully from calcite parser?

I have a table and I am trying to parse it's create statement like As we seen, all fields of this sqlNode are quoted by ` . But this is not what I want How to remove all the quotes by SqlWriterConfig? thanks
slo
  • 23
  • 5
0
votes
1 answer

Apache Calcite throws exception when executing query (SchemaPlus.getSubSchema returns null)

[Using Apache Calcite 1.30.0] With query: SELECT * FROM mydb.employees I can see that when I relNode.explain( .. ) the * is expanded into the correct columns for the database, so I know that the connection to the database is working (somewhat) as…
localghost
  • 329
  • 1
  • 4
  • 11
0
votes
1 answer

How to enable calcite's dialect-specific operator like TO_TIMESTAMP

I want to parser the sql query using calcite to do some SQL equivalence verification. But I found the default setting of calcite don't support dialect-specific operator such as TO_TIMESTAMP. The error is below: No match found for function signature…
Huan Sun
  • 147
  • 6
0
votes
1 answer

Connect Calcite JDBC Connector in Tableau Software

I developed a custom connector for Elasticsearch with Apache Calcite. I could connect to the datasource with Dbeaver SQL Client. Now I want to use it as data source in Tableau Software. How should I configure it in Tableau, This is how it's…
O. Sam
  • 178
  • 1
  • 5
  • 17
0
votes
1 answer

typesafe joins in spark for 3.x

In old versions of Spark 3.x import org.apache.calcite.sql.JoinType Calcite was exposed. That meant a JOIN could not only be executed in a strongly typed fashion for dataframes (notice I do not mean datasets) by feeding: JoinType.LEFT.name. Calcite…
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
0
votes
1 answer

Apache Calcite CSV Adapter - SQL Client

I am working on the development of a Connector interface with Elasticsearch (translate SQL to API DSL query syntax) . I am starting with Apache Calcite CSV Adapter as a first step to test Calcite capabilities. I followed the tutorial…
O. Sam
  • 178
  • 1
  • 5
  • 17