Skip to content

Commit ca2b76c

Browse files
authored
[Bug] Fix that Hive DDL and paimon schema mismatched excetion when show the table's schema with the timestamp type (#5501)
1 parent b377440 commit ca2b76c

File tree

1 file changed

+11
-0
lines changed
  • paimon-hive/paimon-hive-connector-common/src/main/java/org/apache/paimon/hive

1 file changed

+11
-0
lines changed

paimon-hive/paimon-hive-connector-common/src/main/java/org/apache/paimon/hive/HiveSchema.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,17 @@ private static void checkFieldsMatched(
255255
for (int i = 0; i < hiveFieldNames.size(); i++) {
256256
if (!hiveFieldNames.get(i).equalsIgnoreCase(schemaFieldNames.get(i))
257257
|| !Objects.equals(hiveFieldTypeInfos.get(i), schemaFieldTypeInfos.get(i))) {
258+
if (hiveFieldNames.get(i).equalsIgnoreCase(schemaFieldNames.get(i))
259+
&& hiveFieldTypeInfos.get(i).getTypeName().equals("timestamp")
260+
&& schemaFieldTypeInfos
261+
.get(i)
262+
.getTypeName()
263+
.equals("timestamp with local time zone")) {
264+
// Hive timestamp is compatible with paimon timestamp with local time zone
265+
LOG.warn(
266+
"Hive DDL and paimon schema mismatched, but Hive timestamp is compatible with paimon timestamp with local time zone");
267+
continue;
268+
}
258269
String ddlField =
259270
hiveFieldNames.get(i) + " " + hiveFieldTypeInfos.get(i).getTypeName();
260271
String schemaField =

0 commit comments

Comments
 (0)