@@ -142,27 +142,39 @@ private void checkDaliTable() {
142142 /**
143143 * Returns the row type (schema) for this table.
144144 *
145- * Two conversion paths are supported:
146- * 1. Two-stage (preferred): Hive → Coral → Calcite
147- * 2. Direct (legacy): Hive → Calcite (for backward compatibility)
145+ * Current behavior (validation/shadow mode):
146+ * - Always returns the legacy Hive → Calcite direct conversion
147+ * - Validates against the new Hive → Coral → Calcite two-stage conversion
148+ * - Logs warnings if conversions don't match or if validation fails
148149 *
149- * The two-stage conversion enables using Coral type system as an intermediary,
150- * allowing better type system unification and testing .
150+ * This allows safe validation of the new conversion path in production
151+ * before switching to use it as the primary path .
151152 *
152153 * @param typeFactory Calcite type factory
153154 * @return RelDataType representing the table schema
154155 */
155156 @ Override
156157 public RelDataType getRowType (RelDataTypeFactory typeFactory ) {
157- // Use two-stage conversion if HiveCoralTable is available
158+ // Always compute and return the legacy Hive direct conversion (production path)
159+ RelDataType hiveType = getRowTypeFromHiveType (typeFactory );
160+
161+ // Validate against new two-stage Coral conversion (shadow/validation mode)
158162 try {
159- return getRowTypeFromCoralType (typeFactory );
163+ RelDataType coralType = getRowTypeFromCoralType (typeFactory );
164+
165+ // Compare the two type representations
166+ if (!hiveType .equals (coralType )) {
167+ LOG .warn ("Hive and Coral type conversion mismatch for table {}.{}. Hive: {}, Coral: {}" , hiveTable .getDbName (),
168+ hiveTable .getTableName (), hiveType , coralType );
169+ }
160170 } catch (Exception e ) {
161- // Fall back to direct conversion if two-stage conversion fails
162- LOG .warn ("Two-stage type conversion failed for table {}, falling back to direct conversion. Error: {}" ,
163- hiveTable .getTableName (), e .getMessage (), e );
164- return getRowTypeFromHiveType (typeFactory );
171+ // Log validation failure but continue with Hive type (zero production impact)
172+ LOG .warn ("Coral type validation failed for table {}.{}. Proceeding with Hive type. Error: {}" ,
173+ hiveTable .getDbName (), hiveTable .getTableName (), e .getMessage (), e );
165174 }
175+
176+ // Always return the battle-tested Hive conversion result
177+ return hiveType ;
166178 }
167179
168180 /**
0 commit comments