Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Calcite to preserve LATERALs in LATERAL UNNEST calls #542

Merged
merged 6 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ public void testLateralViewOuter() {
assertEquals(convertToSparkSql, targetSql);
}

@Test
public void testLateralViewOuterWithExtractUnion() {
RelNode relNode = TestUtils.toRelNode(String.join("\n", "", "SELECT extract_union(ut), t.ccol", "FROM complex",
"LATERAL VIEW OUTER explode(complex.c) t as ccol"));
String convertToSparkSql = createCoralSpark(relNode).getSparkSql();

String targetSql = "SELECT coalesce_struct(complex.ut, 'uniontype<int>'), t0.ccol\n"
+ "FROM default.complex complex LATERAL VIEW OUTER EXPLODE(complex.c) t0 AS ccol";
assertEquals(convertToSparkSql, targetSql);
}

@Test
public void testMultipleLateralView() {
RelNode relNode = TestUtils.toRelNode(String.join("\n", "", "SELECT a, t.ccol, t2.ccol2", "FROM complex ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void initializeViews(HiveConf conf) throws HiveException, MetaExce
run(driver, "CREATE TABLE IF NOT EXISTS baz(`timestamp` int, `select` double)");
run(driver, "CREATE VIEW IF NOT EXISTS baz_view as select `select`, `timestamp` from baz");
run(driver,
"CREATE TABLE IF NOT EXISTS complex(a int, b string, c array<double>, s struct<name:string, age:int>, m map<string, int>, sarr array<struct<name:string, age:int>>)");
"CREATE TABLE IF NOT EXISTS complex(a int, b string, c array<double>, s struct<name:string, age:int>, m map<string, int>, sarr array<struct<name:string, age:int>>, ut uniontype<int>)");

String baseComplexSchema = loadSchema("base-complex.avsc");
executeCreateTableQuery(driver, "default", "basecomplex", baseComplexSchema);
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def versions = [
'jetbrains': '16.0.2',
'jline': '0.9.94',
'kryo': '2.22',
'linkedin-calcite-core': '1.21.0.262',
'linkedin-calcite-core': '1.21.0.265',
'pig': '0.15.0',
'spark': '2.4.0',
'spark3': '3.1.1',
Expand Down
Loading