diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/ir/type/derived/DBSPTypeStruct.java b/sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/ir/type/derived/DBSPTypeStruct.java index c830dbd09d..6fd53e19cd 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/ir/type/derived/DBSPTypeStruct.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/main/java/org/dbsp/sqlCompiler/ir/type/derived/DBSPTypeStruct.java @@ -283,7 +283,10 @@ public void accept(InnerVisitor visitor) { public IIndentStream toString(IIndentStream builder) { return builder.append("struct ") .append(this.mayBeNull ? "?" : "") - .append(this.name.name()); + .append(" ") + .append(this.name.name()) + .append(" ") + .append(this.hashName); } /** Generate a tuple type by ignoring the struct and field names. */ diff --git a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/CatalogTests.java b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/CatalogTests.java index 817e33a272..324d00ae10 100644 --- a/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/CatalogTests.java +++ b/sql-to-dbsp-compiler/SQL-compiler/src/test/java/org/dbsp/sqlCompiler/compiler/sql/CatalogTests.java @@ -890,4 +890,18 @@ CREATE TABLE example ( z ROW(x INT, y INT) NOT NULL default ROW(1, 2) );"""); } + + + @Test + public void issue5390() { + this.getCCS(""" + CREATE TYPE user_def AS(i1 INT); + CREATE TYPE user_def_row AS (val ROW(i1 INT)); + CREATE TYPE user_def_udt AS (val user_def); + + CREATE MATERIALIZED VIEW v AS SELECT + SAFE_CAST(NULL AS user_def_row) AS to_row, + SAFE_CAST(NULL AS user_def_udt) AS to_udt + ;"""); + } }