-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Coral IR friendly to missng table alias prefix
- Loading branch information
Yiqiang Ding
authored and
Yiqiang Ding
committed
Sep 7, 2023
1 parent
64ec9b5
commit 79cbc5e
Showing
4 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
coral-common/src/main/java/com/linkedin/coral/common/CoralJavaTypeFactoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.linkedin.coral.common; | ||
|
||
import org.apache.calcite.jdbc.JavaTypeFactoryImpl; | ||
import org.apache.calcite.rel.type.RelDataType; | ||
import org.apache.calcite.rel.type.RelDataTypeSystem; | ||
import org.apache.calcite.rel.type.StructKind; | ||
|
||
import java.util.List; | ||
|
||
public class CoralJavaTypeFactoryImpl extends JavaTypeFactoryImpl { | ||
public CoralJavaTypeFactoryImpl(RelDataTypeSystem typeSystem) { | ||
super(typeSystem); | ||
} | ||
|
||
@Override | ||
public RelDataType createStructType( | ||
final List<RelDataType> typeList, | ||
final List<String> fieldNameList) { | ||
return createStructType(StructKind.PEEK_FIELDS, typeList, fieldNameList); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
coral-common/src/main/java/com/linkedin/coral/common/HiveCommonRelBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.linkedin.coral.common; | ||
|
||
import org.apache.calcite.plan.Context; | ||
import org.apache.calcite.plan.RelOptCluster; | ||
import org.apache.calcite.plan.RelOptSchema; | ||
import org.apache.calcite.rex.RexBuilder; | ||
import org.apache.calcite.tools.FrameworkConfig; | ||
import org.apache.calcite.tools.Frameworks; | ||
import org.apache.calcite.tools.RelBuilder; | ||
|
||
public class HiveCommonRelBuilder extends RelBuilder { | ||
private HiveCommonRelBuilder(Context context, RelOptCluster cluster, RelOptSchema relOptSchema) { | ||
super(context, cluster, relOptSchema); | ||
} | ||
|
||
public static RelBuilder create(FrameworkConfig config) { | ||
return Frameworks.withPrepare(config, (cluster, relOptSchema, rootSchema, | ||
statement) -> { cluster = RelOptCluster.create(cluster.getPlanner(), | ||
new RexBuilder(new CoralJavaTypeFactoryImpl(cluster.getTypeFactory().getTypeSystem()))); | ||
return new HiveCommonRelBuilder(config.getContext(), cluster, relOptSchema);}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters