Skip to content

Commit

Permalink
fixed mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
xiarixiaoyao committed Mar 30, 2022
1 parent c9f2901 commit 7c80ff0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ public long schemaId() {
/**
* Set the version ID for this schema.
*/
public void setMax_column_id(int maxColumnId) {
public void setMaxColumnId(int maxColumnId) {
this.maxColumnId = maxColumnId;
}

/**
* Returns the max column id for this schema.
*/
public int getMax_column_id() {
public int getMaxColumnId() {
return this.maxColumnId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ private void addColumnsInternal(String parent, String name, Type type, String do

private ColumnAddChange(InternalSchema internalSchema) {
super(internalSchema);
this.nextId = internalSchema.getMax_column_id() + 1;
this.nextId = internalSchema.getMaxColumnId() + 1;
}

public Map<Integer, ArrayList<Types.Field>> getParentId2AddCols() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static String toJson(InternalSchema internalSchema) {
}

private static void toJson(InternalSchema internalSchema, JsonGenerator generator) throws IOException {
toJson(internalSchema.getRecord(), internalSchema.getMax_column_id(), internalSchema.schemaId(), generator);
toJson(internalSchema.getRecord(), internalSchema.getMaxColumnId(), internalSchema.schemaId(), generator);
}

private static void toJson(Types.RecordType record, Integer maxColumnId, Long versionId, JsonGenerator generator) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ abstract class HoodieBaseRelation(val sqlContext: SQLContext,
}
)
// try to find internalSchema
val internalSchemaFromMeta = Try(schemaUtil.getTableInternalSchemaFromCommitMetadata).getOrElse(InternalSchema.getEmptyInternalSchema))
val internalSchemaFromMeta = Try(schemaUtil.getTableInternalSchemaFromCommitMetadata).getOrElse(InternalSchema.getEmptyInternalSchema)
(avroSchema, internalSchemaFromMeta)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ case class AlterTableCommand312(table: CatalogTable, changes: Seq[TableChange],
deleteChange.deleteColumn(originalColName)
}
val newSchema = SchemaChangeUtils.applyTableChanges2Schema(oldSchema, deleteChange)
// delete action should not change the max_column_id field.
newSchema.setMax_column_id(oldSchema.getMax_column_id)
// delete action should not change the getMaxColumnId field.
newSchema.setMaxColumnId(oldSchema.getMaxColumnId)
val verifiedHistorySchema = if (historySchema == null || historySchema.isEmpty) {
SerDeHelper.inheritSchemas(oldSchema, "")
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ case class AlterTableCommand(table: CatalogTable, changes: Seq[TableChange], cha
checkSchemaChange(Seq(originalColName), table)
deleteChange.deleteColumn(originalColName)
}
SchemaChangeUtils.applyTableChanges2Schema(oldSchema, deleteChange).setSchemaId(oldSchema.getMax_column_id)
SchemaChangeUtils.applyTableChanges2Schema(oldSchema, deleteChange).setSchemaId(oldSchema.getMaxColumnId)
}


Expand All @@ -128,8 +128,8 @@ case class AlterTableCommand(table: CatalogTable, changes: Seq[TableChange], cha
def applyDeleteAction(sparkSession: SparkSession): Unit = {
val (oldSchema, historySchema) = getInternalSchemaAndHistorySchemaStr(sparkSession)
val newSchema = applyDeleteAction2Schema(sparkSession, oldSchema, changes.map(_.asInstanceOf[DeleteColumn]))
// delete action should not change the max_column_id field.
newSchema.setMax_column_id(oldSchema.getMax_column_id)
// delete action should not change the getMaxColumnId field.
newSchema.setMaxColumnId(oldSchema.getMaxColumnId)
val verifiedHistorySchema = if (historySchema == null || historySchema.isEmpty) {
SerDeHelper.inheritSchemas(oldSchema, "")
} else {
Expand Down

0 comments on commit 7c80ff0

Please sign in to comment.