Skip to content

Commit c9762dc

Browse files
committed
link issue 575 in all relevant classes
1 parent 5ee910c commit c9762dc

File tree

8 files changed

+89
-328
lines changed

8 files changed

+89
-328
lines changed

coral-common/src/main/java/com/linkedin/coral/common/HiveCalciteTableAdapter.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,23 @@
5454
* into Calcite's {@link ScannableTable}, enabling Hive tables to be queried through Calcite's
5555
* SQL processing engine.
5656
*
57+
* <p><b>Integration with ParseTreeBuilder and HiveFunctionResolver:</b> This class provides critical
58+
* Dali UDF metadata extraction methods ({@link #getDaliFunctionParams()} and {@link #getDaliUdfDependencies()})
59+
* that are tightly coupled to {@link org.apache.hadoop.hive.metastore.api.Table} and used by:
60+
* <ul>
61+
* <li>{@code HiveFunctionResolver} - for resolving Dali function names to implementing classes</li>
62+
* <li>{@code ParseTreeBuilder} - for parsing view definitions with UDF metadata</li>
63+
* </ul>
64+
*
65+
* <p>These components currently require {@link org.apache.hadoop.hive.metastore.api.Table} and cannot
66+
* work directly with {@link com.linkedin.coral.common.catalog.CoralTable}. This tight coupling is being
67+
* addressed in <a href="https://github.com/linkedin/coral/issues/575">issue #575</a>, which will refactor
68+
* these APIs to accept {@code CoralTable} instead, enabling multi-format support (Hive, Iceberg, etc.).
69+
*
5770
* <p>Implementing this as a ScannableTable, instead of Table, is hacky approach to make calcite
5871
* correctly generate relational algebra. This will have to go away gradually.
72+
*
73+
* @see <a href="https://github.com/linkedin/coral/issues/575">Issue #575: Refactor ParseTreeBuilder to Use CoralTable</a>
5974
*/
6075
public class HiveCalciteTableAdapter implements ScannableTable {
6176

coral-common/src/main/java/com/linkedin/coral/common/HiveCalciteViewAdapter.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@
2626
*
2727
* <p>This adapter enables Calcite to process Hive views by implementing the TranslatableTable interface,
2828
* which allows the view definition to be expanded and converted into a relational algebra tree.
29+
*
30+
* <p><b>Integration with ParseTreeBuilder:</b> This class inherits the Dali UDF metadata extraction
31+
* methods from {@link HiveCalciteTableAdapter}, which are used by {@code ParseTreeBuilder} and
32+
* {@code HiveFunctionResolver} for parsing view definitions with custom functions. These components
33+
* are currently tightly coupled to {@link org.apache.hadoop.hive.metastore.api.Table} and cannot
34+
* work directly with {@link com.linkedin.coral.common.catalog.CoralTable}.
35+
*
36+
* <p>This coupling is being addressed in <a href="https://github.com/linkedin/coral/issues/575">issue #575</a>,
37+
* which will refactor these APIs to accept {@code CoralTable} instead, enabling multi-format support.
38+
*
39+
* @see HiveCalciteTableAdapter
40+
* @see <a href="https://github.com/linkedin/coral/issues/575">Issue #575: Refactor ParseTreeBuilder to Use CoralTable</a>
2941
*/
3042
public class HiveCalciteViewAdapter extends HiveCalciteTableAdapter implements TranslatableTable {
3143
private final List<String> schemaPath;

coral-common/src/main/java/com/linkedin/coral/common/HiveDbSchema.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,33 @@
2222

2323
/**
2424
* Adaptor from Hive catalog providing database and table names
25-
* to Calcite {@link Schema}
25+
* to Calcite {@link Schema}. This class represents a database-level schema
26+
* that contains tables and dispatches to format-specific Calcite adapters.
27+
*
28+
* <p><b>LEGACY API:</b> This class exists for backward compatibility with existing code
29+
* that uses {@link HiveMetastoreClient} directly. For new code, prefer {@link CoralDatabaseSchema}
30+
* which integrates with the unified {@link com.linkedin.coral.common.catalog.CoralCatalog} API
31+
* and provides cleaner multi-format support (Hive, Iceberg, etc.) without Hive-specific coupling.
32+
*
33+
* <p><b>Table Dispatch:</b> This class creates Calcite table adapters based on table type:
34+
* <ul>
35+
* <li>{@link HiveCalciteViewAdapter} for Hive views (VIRTUAL_VIEW)</li>
36+
* <li>{@link HiveCalciteTableAdapter} for regular Hive tables</li>
37+
* </ul>
38+
*
39+
* <p><b>Migration Path:</b>
40+
* <ul>
41+
* <li><b>Legacy:</b> {@link HiveSchema} → {@link HiveDbSchema} (this class) → {@link HiveCalciteTableAdapter}</li>
42+
* <li><b>Modern:</b> {@link CoralRootSchema} → {@link CoralDatabaseSchema} → Format-specific adapters</li>
43+
* </ul>
44+
*
45+
* <p><b>Future:</b> As part of <a href="https://github.com/linkedin/coral/issues/575">issue #575</a>,
46+
* this class will be evaluated for deprecation/cleanup once all clients migrate to {@link CoralDatabaseSchema}
47+
* and the {@link com.linkedin.coral.common.catalog.CoralCatalog} API.
48+
*
49+
* @see CoralDatabaseSchema Modern replacement with CoralCatalog integration
50+
* @see HiveSchema Legacy root-level schema
51+
* @see <a href="https://github.com/linkedin/coral/issues/575">Issue #575: Refactor ParseTreeBuilder to Use CoralTable</a>
2652
*/
2753
public class HiveDbSchema implements Schema {
2854

coral-common/src/main/java/com/linkedin/coral/common/HiveSchema.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,24 @@
2727
* to Calcite {@link Schema}. This class represents the "root" schema
2828
* that holds all hive databases as subschema and no tables.
2929
*
30-
* Can use either CoralCatalog for unified access to different table formats
31-
* or HiveMetastoreClient for Hive-specific access.
30+
* <p><b>LEGACY API:</b> This class exists for backward compatibility with existing code
31+
* that uses {@link HiveMetastoreClient} directly. For new code, prefer {@link CoralRootSchema}
32+
* which integrates with the unified {@link com.linkedin.coral.common.catalog.CoralCatalog} API
33+
* and supports multiple table formats (Hive, Iceberg, etc.) without Hive-specific coupling.
34+
*
35+
* <p><b>Migration Path:</b>
36+
* <ul>
37+
* <li><b>Legacy:</b> {@link HiveSchema} (this class) → {@link HiveDbSchema} → {@link HiveCalciteTableAdapter}</li>
38+
* <li><b>Modern:</b> {@link CoralRootSchema} → {@link CoralDatabaseSchema} → Format-specific adapters</li>
39+
* </ul>
40+
*
41+
* <p><b>Future:</b> As part of <a href="https://github.com/linkedin/coral/issues/575">issue #575</a>,
42+
* this class will be evaluated for deprecation/cleanup once all clients migrate to {@link CoralRootSchema}
43+
* and the {@link com.linkedin.coral.common.catalog.CoralCatalog} API.
44+
*
45+
* @see CoralRootSchema Modern replacement with CoralCatalog integration
46+
* @see HiveDbSchema Legacy database-level schema
47+
* @see <a href="https://github.com/linkedin/coral/issues/575">Issue #575: Refactor ParseTreeBuilder to Use CoralTable</a>
3248
*/
3349
public class HiveSchema implements Schema {
3450

coral-common/src/main/java/com/linkedin/coral/common/IcebergCalciteTableAdapter.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@
3434
*
3535
* <p>This class uses IcebergCoralTable to access Iceberg table metadata and converts
3636
* through the Coral type system for better abstraction and consistency with HiveCalciteTableAdapter.
37+
*
38+
* <p><b>Integration with ParseTreeBuilder and HiveFunctionResolver:</b> While this adapter itself
39+
* doesn't provide Dali UDF methods, Iceberg tables with UDF metadata still need to work with
40+
* {@code ParseTreeBuilder} and {@code HiveFunctionResolver}, which are currently tightly coupled to
41+
* {@link org.apache.hadoop.hive.metastore.api.Table}. The temporary workaround is
42+
* {@link com.linkedin.coral.common.catalog.IcebergHiveTableConverter}, which converts Iceberg tables
43+
* to Hive Table objects for UDF resolution.
44+
*
45+
* <p>This coupling is being addressed in <a href="https://github.com/linkedin/coral/issues/575">issue #575</a>,
46+
* which will refactor {@code ParseTreeBuilder} and {@code HiveFunctionResolver} to accept
47+
* {@link com.linkedin.coral.common.catalog.CoralTable} instead, enabling direct Iceberg support without conversion.
48+
*
49+
* @see com.linkedin.coral.common.catalog.IcebergHiveTableConverter
50+
* @see <a href="https://github.com/linkedin/coral/issues/575">Issue #575: Refactor ParseTreeBuilder to Use CoralTable</a>
3751
*/
3852
public class IcebergCalciteTableAdapter implements ScannableTable {
3953

coral-common/src/main/java/com/linkedin/coral/common/IcebergToCoralTypeConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
* Converts Iceberg Schema and Types to Coral data types.
2020
* This is the first stage of the two-stage conversion: Iceberg → Coral → Calcite.
2121
*
22-
* Mirrors the structure of IcebergTypeConverter but converts to Coral types
23-
* instead of directly to Calcite RelDataType, enabling better type system abstraction.
22+
* This converter provides a unified type system abstraction by converting Iceberg types
23+
* to Coral's intermediate type representation, which can then be converted to Calcite
24+
* RelDataType using {@link com.linkedin.coral.common.types.CoralTypeToRelDataTypeConverter}.
2425
*/
2526
public class IcebergToCoralTypeConverter {
2627

@@ -50,7 +51,6 @@ public static StructType convert(Schema icebergSchema) {
5051

5152
/**
5253
* Main dispatcher - converts Iceberg Type to Coral CoralDataType based on type category.
53-
* Similar to IcebergTypeConverter.convert(Type, RelDataTypeFactory).
5454
*
5555
* @param icebergType Iceberg type
5656
* @param nullable Whether this type instance is nullable

coral-common/src/main/java/com/linkedin/coral/common/IcebergTypeConverter.java

Lines changed: 0 additions & 218 deletions
This file was deleted.

0 commit comments

Comments
 (0)