Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[SQL] EXCEPT(ALL) and MINUS(all) with queries that include ARRAY/MAP fail compilation #5479

@rivudhk

Description

@rivudhk

Following SQL:

CREATE TABLE tbl(
mapp MAP<VARCHAR, INT>);

CREATE MATERIALIZED VIEW v AS
SELECT mapp FROM tbl
MINUS
SELECT MAP['a', 2] 
FROM tbl;

Example input: "mapp": {"a": 12, "b": 17}

Fail SQL compilation with error:

error: Compiler error
Operator 12 already inserted
org.dbsp.sqlCompiler.circuit.DBSPCircuit.addOperator(DBSPCircuit.java:168)
org.dbsp.sqlCompiler.compiler.frontend.CalciteToDBSPCompiler.addOperator(CalciteToDBSPCompiler.java:280)
org.dbsp.sqlCompiler.compiler.frontend.CalciteToDBSPCompiler.visitMinus(CalciteToDBSPCompiler.java:1181)
org.dbsp.sqlCompiler.compiler.frontend.CalciteToDBSPCompiler.visitIfMatches(CalciteToDBSPCompiler.java:325)
org.dbsp.sqlCompiler.compiler.frontend.CalciteToDBSPCompiler.visit(CalciteToDBSPCompiler.java:2932)
org.apache.calcite.rel.RelVisitor.go(RelVisitor.java:63)
org.dbsp.sqlCompiler.compiler.frontend.CalciteToDBSPCompiler.compileCreateView(CalciteToDBSPCompiler.java:2991)
org.dbsp.sqlCompiler.compiler.frontend.CalciteToDBSPCompiler.compile(CalciteToDBSPCompiler.java:3381)
org.dbsp.sqlCompiler.compiler.DBSPCompiler.runAllCompilerStages(DBSPCompiler.java:635)
org.dbsp.sqlCompiler.compiler.DBSPCompiler.getFinalCircuit(DBSPCompiler.java:796)
org.dbsp.sqlCompiler.CompilerMain.run(CompilerMain.java:169)
org.dbsp.sqlCompiler.CompilerMain.run(CompilerMain.java:300)
org.dbsp.sqlCompiler.CompilerMain.runAndReportErrors(CompilerMain.java:308)
org.dbsp.sqlCompiler.CompilerMain.main(CompilerMain.java:324)

ARRAY

CREATE TABLE tbl(
arr VARCHAR ARRAY);

CREATE MATERIALIZED VIEW v AS
SELECT arr FROM tbl
EXCEPT ALL
SELECT ARRAY[str] 
FROM tbl;

Example input: {"arr": ["bye", "hello "], "str": "hello "}

Metadata

Metadata

Assignees

Labels

SQL compilerRelated to the SQL compiler

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions