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
2 answers

Calcite query to select a given percentage of data from the table

I am looking out for a way to select a given percentage of data from a table using calcite query, for example lets say we have a table name sample which has around 800 records and I want to select only 30% from the total data present in sample i.e…
bforblack
  • 65
  • 5
0
votes
1 answer

How can I perform an UPSERT on a CSV file using Apache Calcite?

I tried executing the query below "INSERT INTO " + schema + "." + fileName+" '(' id,name ')' VALUES (3,'abc')") I am not sure whether Calcite supports UPSERT or not. But I referred to the reference which shows different queries. If it's not…
kavyansh
  • 80
  • 7
0
votes
1 answer

When passing sql parameters to jdbcTemplate.query I get a SQLException with object args

I'm trying to use the Calcite Avatica JDBC driver calling into a sample Druid database using a Spring Boot project. Following along most examples I fashioned this query and it throws an exception if I pass along new Object[] { cityName }. However,…
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
0
votes
1 answer

Calcite: can we rewrite the optimized RelNode?

In Calcite, after optimization provided by the default VolcanoPlanner, we can get an optimized RelNode, but can we have a further optimization? For example I want to add an ElasticsearchSort or something like that to limit the dataset we…
jerryleooo
  • 843
  • 10
  • 16
0
votes
1 answer

how to traverse sqlNode in calcite

I need to convert all the table name and column name to another name in a SQL query which will be in form of string and I have to do it using the Calcite SQL parser. I only know that I have to implement the visitor interface, but I have no clue how…
Jay dev
  • 17
  • 7
0
votes
1 answer

How to format date fields in Apache Calcite?

I would like to create a RexNode to convert date fields in desired format. Below is the SQL equivalent SELECT CONVERT(varchar(12), "DATE_FIELD", 101) - 06/29/2009 I have been struggling past two days to find it in the calcite API. Please…
Krish
  • 31
  • 4
0
votes
1 answer

Dremio character set 'ISO-8859-1'

While running this simple query in Dremio: SELECT 'NBC Universal – NBC News' Data We got the following error message Failed to encode 'NBC Universal – NBC News' in character set 'ISO-8859-1' We tried setting saffron settings for character set with…
Abba
  • 519
  • 6
  • 17
0
votes
1 answer

How to insert data into excel table using Apache Calcite?

I am using Apache Calcite for reading data from excel. Excel has 'salary' table with following fields Integer id Integer emp_id Integer salary I have following model.json { "version": "1.0", "defaultSchema": "excelSchema", "schemas": [{ …
0
votes
1 answer

Java compatible simple expression language

I am building a system in Scala for feature engineering where the end user API receives aggregations on list of objects/events. For example, a client of this tool might pass into it a function that given an array of past pageviews for a specific…
0
votes
3 answers

Merging two tables with no unique keys without row number

I have two tables Table A: Name ---- Andy Greg Table B: Value ----- 1 2 I want to merge these two tables into one: Table C: Result ------ Andy 1 Greg 2 Note:- without changing the order. I cannot use row numbers as I am using Apache Calcite and…
0
votes
1 answer

Flink: Convert a retracting SQL to an appending SQL, using only SQL, to feed a temporal table

I am providing a Flink SQL interface to users, so I can't really use the Table or Java/Scala interface. Everything needs to be specified in SQL. I can parse comments in the SQL files though, and add specified ad hoc lower level API instructions. How…
0
votes
2 answers

Utilizing Apache Calcite without connecting to DB

I am trying to generate SQL query from relational algebra in Calcite without connecting to the database I saw an example at Calcite website where a JDBC adapter uses the DB connection for the first time and all subsequent calls get data from cache. …
0
votes
1 answer

Using RelBuilder how to create SELECT and WHEREclause?

I have the following code where I am trying to create a relational algebra: final RelNode relNode = relBuilder.scan(index).build(); I am looking for a sample code where I can create a SELECE and WHERE clause in the above code.
0
votes
0 answers

How to calculate one day's uv every minute by SQL in Flink

We want to calculate one day's uv and show the result every minute by Flink. We have implemented this by java code: dataStream.keyBy(dimension) .incrementWindow(Time.days(1), Time.minutes(1)) .uv(userId) The input data is…
user2928444
  • 49
  • 1
  • 7
0
votes
2 answers

Standard way to use ODBC or JDBC to get column metadata of Select statement?

Is there a cross-vendor-compatible way to get the column metadata for an arbitrary SELECT statement in ODBC or JDBC without needing to execute the query? I am building an analytics tool as a vendor. I cannot assume that the user can create temp…
jennykwan
  • 2,631
  • 1
  • 22
  • 33