PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: pingcap/tidb-binlog (go)
Issue: Reparo: Add a support CreateView function
To add a function in Reparo tool when executing binlog data
As in the current version, it does not support "CREATE VIEW Statement".
The reparo main function treats it as invaild ddl type.
Pull request description: Fix the issue #1088 Reparo: Add a support CreateView function 
<!--
Thank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.
-->

### What problem does this PR solve? <!--add issue link with summary if exists-->
close #1088
To make reparo tool be able to support "Create View" statement from executing binlog file 

### What is changed and how it works?
Added the Create Statement function in /reparo/ddl.go and /syncer/ddl.go 
 
Tests <!-- At least one of them must be included. -->
Manual test is performed. (created a new execution file and to restore binlog with "create view" statement.

Related changes
 - Need to re-generate the reparo linux execution program for users to use 

### Release note

- No release note

Patch:
diff --git a/reparo/ddl.go b/reparo/ddl.go
index 0fc049a1..5ad9dee5 100644
--- a/reparo/ddl.go
+++ b/reparo/ddl.go
@@ -64,6 +64,8 @@ func parseDDL(sql string) (node ast.Node, table filter.TableName, err error) {
 			setSchemaIfExists(&table, v.Table.Schema.O, v.Table.Name.O)
 		case *ast.DropIndexStmt:
 			setSchemaIfExists(&table, v.Table.Schema.O, v.Table.Name.O)
+		case *ast.CreateViewStmt:
+			setSchemaIfExists(&table, v.ViewName.Schema.O, v.ViewName.Name.O)
 		}
 	}
 
diff --git a/reparo/syncer/translate.go b/reparo/syncer/translate.go
index 9c0f460e..dd6502b8 100644
--- a/reparo/syncer/translate.go
+++ b/reparo/syncer/translate.go
@@ -217,6 +217,11 @@ func parserSchemaTableFromDDL(ddlQuery string) (schema, table string, err error)
 				schema = node.TableToTables[0].NewTable.Schema.O
 			}
 			table = node.TableToTables[0].NewTable.Name.O
+		case *ast.CreateViewStmt:
+			if len(node.ViewName.Schema.O) != 0 {
+				schema = node.ViewName.Schema.O
+			}
+			table = node.ViewName.Name.O
 		default:
 			return "", "", errors.Errorf("unknown ddl type, ddl: %s", ddlQuery)
 		}


Test patch:
diff --git a/reparo/syncer/translate_test.go b/reparo/syncer/translate_test.go
index 5f9b5886..2cf71b71 100644
--- a/reparo/syncer/translate_test.go
+++ b/reparo/syncer/translate_test.go
@@ -51,6 +51,16 @@ func (s *testTranslateSuite) TestPBBinlogToTxn(c *check.C) {
 				Table:    "table1",
 			},
 		},
+		{
+			Tp:       pb.BinlogType_DDL,
+			DdlQuery: []byte("create view `db1`.`view1` as (select 1)"),
+		}: {
+			DDL: &loader.DDL{
+				SQL:      "create view `db1`.`view1` as (select 1)",
+				Database: "db1",
+				Table:    "view1",
+			},
+		},
 		{
 			Tp:       pb.BinlogType_DDL,
 			DdlQuery: []byte("drop database db1"),