Skip to content

Instantly share code, notes, and snippets.

@milinda
milinda / CALCITE-968
Created November 20, 2015 21:37
Calcite query optimizer error for stream-to-realtion joins
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
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)
LogicalDelta
LogicalProject(id=[$0], product=[$1], quantity=[$2])
LogicalNowWindow
LogicalFilter(condition=[>($2, 5)])
StreamScan(table=[[KAFKA, ORDERS]], fields=[[0, 1, 2]])
LogicalDelta
LogicalProject(id=[$0], product=[$1], quantity=[$2])
LogicalFilter(condition=[>($2, 5)])
LogicalNowWindow
StreamScan(table=[[KAFKA, ORDERS]], fields=[[0, 1, 2]])
LogicalDelta
LogicalProject(id=[$0], product=[$1], quantity=[$2])
LogicalFilter(condition=[>($2, 5)])
StreamScan(table=[[KAFKA, ORDERS]], fields=[[0, 1, 2]])
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 January 13, 2015 19:55
Relation Algebra Expression OM
// 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 September 25, 2014 14:33
Footer to use with Markdown-To-LaTeX
@milinda
milinda / header.tex
Created September 25, 2014 14:32
Header to use with Markdown-To-LaTeX
\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 August 27, 2014 03:45
Makefile for latex based on latexmk
.PHONY: paper.pdf all clean
all: paper.pdf
paper.pdf: main.tex
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode"
clean:
latexmk -CA