Skip to content

Commit

Permalink
Merge pull request #1613 from zendesk/ben/table_encryption
Browse files Browse the repository at this point in the history
fixes #1611, parsing error on table encryption
  • Loading branch information
osheroff authored Dec 2, 2020
2 parents aec1315 + bf5113f commit 7382e7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/main/antlr4/imports/mysql_create_table.g4
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ table_creation_option:
| creation_storage_option
| creation_tablespace
| creation_union
| creation_encryption
| partition_by;


Expand Down Expand Up @@ -70,3 +71,5 @@ creation_stats_sample_pages: STATS_SAMPLE_PAGES '='? INTEGER_LITERAL;
creation_storage_option: STORAGE (DISK | MEMORY | DEFAULT);
creation_tablespace: TABLESPACE string;
creation_union: UNION '='? '(' name (',' name)* ')';
creation_encryption: ENCRYPTION '='? string_literal;

12 changes: 6 additions & 6 deletions src/test/java/com/zendesk/maxwell/schema/ddl/DDLParserTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.zendesk.maxwell.schema.ddl;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;

import java.io.File;
import java.io.FileOutputStream;
Expand All @@ -12,12 +12,11 @@
import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zendesk.maxwell.schema.columndef.ColumnDef;
import org.junit.*;

import com.zendesk.maxwell.schema.columndef.*;
import org.junit.Test;
import org.junit.Ignore;

public class DDLParserTest {
public String getSQLDir() {
Expand Down Expand Up @@ -251,15 +250,16 @@ public void testParsingSomeAlters() {
"alter table f add column i varchar(255) default ('environment,namespace,table_name')",
"CREATE DATABASE xyz DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT ENCRYPTION='N'",
"CREATE TABLE testTable18 ( command JSON NOT NULL DEFAULT (JSON_QUOTE(\"{'parent':'sched'}\")) )",
"CREATE TABLE testTable19 ( pid BIGINT NOT NULL DEFAULT(1) )"
"CREATE TABLE testTable19 ( pid BIGINT NOT NULL DEFAULT(1) )",
"CREATE TABLE encRTYPE ( i int ) ENCRYPTION='Y'"
};

for ( String s : testSQL ) {
try {
SchemaChange parsed = parse(s).get(0);
assertThat("Expected " + s + "to parse", parsed, not(nullValue()));
} catch ( MaxwellSQLSyntaxError e ) {
assertThat("Expected " + s + "to parse, but got: " + e.getMessage(), true, is(false));
assertThat("Expected '" + s + "' to parse, but got: " + e.getMessage(), true, is(false));
}
}

Expand Down

0 comments on commit 7382e7f

Please sign in to comment.