g3blv commented on issue #15136:
URL: https://github.com/apache/datafusion/issues/15136#issuecomment-2712910534

   I've tried a couple of potential workarounds without success:
   
   1. Using explicit casting in the query:
    ```sql
    SELECT sources.id, media.title FROM sources JOIN media ON CAST(sources.id 
AS TEXT) = media.source_id
    ```
    This still produces the same schema mismatch error.
   
   2. Attempted to disable the problematic optimization rule by configuring the 
session to skip failed rules:
    ```rust
    let config = SessionConfig::new().set(
        "datafusion.optimizer.skip_failed_rules",
        &ScalarValue::Boolean(Some(true)),
    );
    let ctx = SessionContext::new_with_config(config);
    ```
    Unfortunately, this configuration has no impact on the error - I still get 
the same schema mismatch.
   
   I've verified that both fields (`sources.id` and `media.source_id`) are of 
type `Utf8`, so they should be compatible for joining. The error message 
mentions old and new schema. What is error actually suggesting?
   
   ```
   Expected original schema: 
   Schema {
       fields: [
           Field {
               name: "id",
               data_type: Utf8,
               nullable: true,
               dict_id: 0,
               dict_is_ordered: false,
               metadata: {}
           },
           Field {
               name: "title",
               data_type: Utf8,
               nullable: true,
               dict_id: 0,
               dict_is_ordered: false,
               metadata: {}
           }
       ],
       metadata: {"table_name": "media"}
   }
   
   Got new schema:
   Schema {
       fields: [
           Field {
               name: "id",
               data_type: Utf8,
               nullable: true,
               dict_id: 0,
               dict_is_ordered: false,
               metadata: {}
           },
           Field {
               name: "title",
               data_type: Utf8,
               nullable: true,
               dict_id: 0,
               dict_is_ordered: false,
               metadata: {}
           }
       ],
       metadata: {"table_name": "sources"}
   }
   ```
   
   Let me know if there are other workarounds I could try or if you need any 
additional debugging information.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to