Skip to content

Instantly share code, notes, and snippets.

@milinda
milinda / CALCITE-968
Created Nov 20, 2015
Calcite query optimizer error for stream-to-realtion joins
View CALCITE-968
Root: rel#25:Subset#6.ENUMERABLE.[]
Original rel:
Sets:
Set#0, type: RecordType(TIMESTAMP(0) ROWTIME, INTEGER ID, VARCHAR(10) PRODUCT, INTEGER UNITS)
rel#8:Subset#0.NONE.[0], best=null, importance=0.531441
rel#0:LogicalTableScan.NONE.[[0]](table=[STREAMJOINS, ORDERS]), rowcount=100.0, cumulative cost={inf}
rel#152:Subset#0.BINDABLE.[0], best=rel#151, importance=0.4304672100000001
rel#151:BindableTableScan.BINDABLE.[[0]](table=[STREAMJOINS, ORDERS]), rowcount=100.0, cumulative cost={1.0 rows, 1.01 cpu, 0.0 io}
rel#160:Subset#0.ENUMERABLE.[0], best=rel#592, importance=0.4782969000000001
View Calcite query planning error
org.apache.calcite.plan.RelOptPlanner$CannotPlanException: Node [rel#16:Subset#2.LOGICAL.[]] could not be implemented; planner state:
Root: rel#16:Subset#2.LOGICAL.[]
Original rel:
Sets:
Set#0, type: RecordType(INTEGER id, VARCHAR(10) productId, INTEGER units, TIMESTAMP(0) rowtime)
rel#11:Subset#0.NONE.[], best=null, importance=0.7290000000000001
rel#3:LogicalTableScan.NONE.[](table=[KAFKA, ORDERS]), rowcount=100.0, cumulative cost={inf}
Set#1, type: RecordType(VARCHAR(10) productId, INTEGER units)
View stream-query-plan-with-optimization
LogicalDelta
LogicalProject(id=[$0], product=[$1], quantity=[$2])
LogicalNowWindow
LogicalFilter(condition=[>($2, 5)])
StreamScan(table=[[KAFKA, ORDERS]], fields=[[0, 1, 2]])
View stream-query-plan-with-now
LogicalDelta
LogicalProject(id=[$0], product=[$1], quantity=[$2])
LogicalFilter(condition=[>($2, 5)])
LogicalNowWindow
StreamScan(table=[[KAFKA, ORDERS]], fields=[[0, 1, 2]])
View stream-query-plan
LogicalDelta
LogicalProject(id=[$0], product=[$1], quantity=[$2])
LogicalFilter(condition=[>($2, 5)])
StreamScan(table=[[KAFKA, ORDERS]], fields=[[0, 1, 2]])
View SelectQuery.java
public class SelectQuery {
private FromClause fromClause;
private WhereCaluse whereCaluse;
public void setFromClause(FromClause fromClause) {
this.fromClause = fromClause;
}
public void setWhereCaluse(WhereCaluse whereCaluse) {
this.whereCaluse = whereCaluse;
@milinda
milinda / RelExpr.java
Created Jan 13, 2015
Relation Algebra Expression OM
View RelExpr.java
// Recursive data structure
public class RelExpr {
// This can be a subquery, window operation, etc.
private RelExpr operand1;
private RelExpr operand2;
private BinaryOp binaryOp;
private SelectionClause selection;
private ProjectionClause projection;
private WindowClause window;
@milinda
milinda / footer.tex
Created Sep 25, 2014
Footer to use with Markdown-To-LaTeX
View footer.tex
@milinda
milinda / header.tex
Created Sep 25, 2014
Header to use with Markdown-To-LaTeX
View header.tex
\documentclass{sig-alternate}
%\usepackage[urw-garamond]{mathdesign}
%\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{longtable, booktabs}
% SIG Alternate copyright removal
\usepackage{etoolbox}
@milinda
milinda / gist:2d62114c781a19333f9e
Created Aug 27, 2014
Makefile for latex based on latexmk
View gist:2d62114c781a19333f9e
.PHONY: paper.pdf all clean
all: paper.pdf
paper.pdf: main.tex
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode"
clean:
latexmk -CA