Query =
SELECT '7df80d017c844ee5bd9e88f7ea218ef9' col1,
'asdfghjklasdfghjasdfghjklaaaaklflkj' col2
FROM <table_name>
Issue Summary:
When reading the above query via Spark JDBC, two different Oracle database versions (12c and 19c) exhibit different behaviors regarding the handling of string literals. Specifically:
- Oracle DB (version 12c): Does not append any whitespace to the end of string constants, regardless of their length.
- Oracle DB (version 19c): Appends whitespace to string literals under the following conditions:
- If the string length is ≤ 32 characters, Oracle appends spaces to ensure the final string length is exactly 32 characters.
- If the string length is > 32 characters, Oracle appends spaces to ensure the final string length is 128 characters.
This difference in behavior results in inconsistencies when the query is processed in Spark, as the data frame (DF) shows padded string values from the Oracle 19c database, but not from the Oracle 12c database.
How can i make it consistent across different version?