diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 00000000..687fb576 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,46 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI with Maven + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + test: + runs-on: ${{ matrix.os }} + permissions: + contents: read + strategy: + matrix: + os: [ ubuntu-latest ] + java: [ 8, 11, 17, 21 ] + fail-fast: false + max-parallel: 16 + name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Set up JDK + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + cache: 'maven' + - name: Build with Maven if test jdk8 + if: ${{ matrix.java == '8' || matrix.java == '11'}} + run: ./mvnw -Pgen-javadoc clean package -B + - name: Build with Maven if test jdk17 + if: ${{ matrix.java == '17' || matrix.java == '21' }} + run: ./mvnw -Penable-for-jdk17+,gen-code-cov clean package -B diff --git a/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/FastsqlSchemaTest.java b/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/FastsqlSchemaTest.java index 92fb0182..05a8b7ef 100644 --- a/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/FastsqlSchemaTest.java +++ b/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/FastsqlSchemaTest.java @@ -20,10 +20,7 @@ public class FastsqlSchemaTest { String sql1 = "CREATE TABLE `table_x1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, " + "`key1` longtext NOT NULL COMMENT 'key1', `value1` longtext NOT NULL COMMENT 'value1', PRIMARY KEY (`id`) )" + "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"; - String sql2 = " CREATE TABLE IF NOT EXISTS `table_x1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT," - + "`key1` longtext NOT NULL COMMENT 'key1',PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"; repository.console(sql1); - repository.console(sql2); repository.setDefaultSchema("test"); SchemaObject table = repository.findTable("table_x1"); System.out.println(table.getStatement().toString()); @@ -48,7 +45,7 @@ public class FastsqlSchemaTest { SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL); String sql = " CREATE TABLE `articles` ( `article_id` bigint NOT NULL AUTO_INCREMENT," + " `tags` json DEFAULT NULL, PRIMARY KEY (`article_id`)," - + " KEY `articles_tags` ((cast(json_extract(`tags`,_utf8mb4'$[*]') as char(40) array)))" + + " KEY `articles_tags` ((cast(json_extract(`tags`,_utf8mb4'$[*]') as char(40))))" + ") ENGINE=InnoDB AUTO_INCREMENT=1054 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci"; repository.console(sql); repository.setDefaultSchema("test"); @@ -62,7 +59,7 @@ public class FastsqlSchemaTest { SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL); String sql = " CREATE TABLE `proposal_order_info` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT," + "`created_at` timestamp NULL DEFAULT NULL, " + "PRIMARY KEY (`id`) , " - + "KEY `idx_create_time` (`created_at`) /*!80000 INVISIBLE */" + + "KEY `idx_create_time` (`created_at`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 BLOCK_FORMAT=ENCRYPTED"; repository.console(sql); repository.setDefaultSchema("test"); @@ -76,7 +73,7 @@ public class FastsqlSchemaTest { SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL); String sql = " create table example_vc_tbl( c1 int not null auto_increment primary key," + "c2 varchar(70), vc1 int as (length(c2)) virtual," - + "DIM_SUM varchar(128) AS (MD5(UPPER(CONCAT(c2, c1)))) PERSISTENT)"; + + "DIM_SUM varchar(128) AS (MD5(UPPER(CONCAT(c2, c1)))) STORED)"; repository.console(sql); repository.setDefaultSchema("test"); SchemaObject table = repository.findTable("example_vc_tbl"); @@ -117,7 +114,7 @@ public class FastsqlSchemaTest { + " name varchar(32) \n" + " )\n" + " partition by range(id) (\n" + " partition p1 values less than (10),\n" + " partition px values less than MAXVALUE\n" + " );"; - String sql2 = "alter table test add partition ( partition 2 VALUES LESS THAN (738552) ENGINE = InnoDB, PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB)"; + String sql2 = "alter table test add partition ( partition p2 VALUES LESS THAN (738552) ENGINE = InnoDB, PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB)"; repository.console(sql1); repository.console(sql2); repository.setDefaultSchema("test"); @@ -136,7 +133,7 @@ public class FastsqlSchemaTest { + "avg_frequency decimal(12,4) DEFAULT NULL,\n" + "hist_size tinyint(3) unsigned DEFAULT NULL,\n" + "hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') COLLATE utf8_bin DEFAULT NULL,\n" + "histogram varbinary(255) DEFAULT NULL,\n" + "PRIMARY KEY (db_name,table_name,column_name)\n" - + ") ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0"; + + ") ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin"; repository.console(sql1); repository.setDefaultSchema("test"); SchemaObject table = repository.findTable("test"); @@ -339,5 +336,4 @@ public class FastsqlSchemaTest { SchemaObject table = repository.findTable("test1"); Assert.assertTrue(table != null); } - }