Merge lp:~mmcm/akiban-server/sql-more-types into lp:~akiban-technologies/akiban-server/trunk

Proposed by Mike McMahon
Status: Merged
Approved by: Mike McMahon
Approved revision: 2646
Merged at revision: 2644
Proposed branch: lp:~mmcm/akiban-server/sql-more-types
Merge into: lp:~akiban-technologies/akiban-server/trunk
Diff against target: 60 lines (+13/-12)
2 files modified
src/main/java/com/akiban/sql/aisddl/TableDDL.java (+7/-4)
src/test/resources/com/akiban/sql/pg/yaml/functional/test-create-table.yaml (+6/-8)
To merge this branch: bzr merge lp:~mmcm/akiban-server/sql-more-types
Reviewer Review Type Date Requested Status
Akiban Build User Needs Fixing
Nathan Williams Approve
Mike McMahon Needs Resubmitting
Review via email: mp+161007@code.launchpad.net

Description of the change

Server side for parsing more types.

Most notable for actual users is that TEXT is now allowed in DDL and not just in higher-level layers.

Also includes the MySQL sized types, because they are known to the AIS, so this is mostly harmless.

The remaining exceptional types are:
* TIMESTAMP. As far as I know, we do not implement MySQL TIMESTAMP semantics on INSERT/UPDATE, even though we track the type for replication. So, TIMESTAMP on CREATE TABLE turns into DATETIME. We do not want to sacrifice the TIMESTAMP keyword (which is standard SQL for an instance within a day). So, if we did implement the semantics, we'd need a new name like MYSQL_TIMESTAMP.
* FLOAT. This will load as DOUBLE, because FLOAT in Derby takes precision. So, it needs to dump as REAL, thereby preserving the semantics at the expense of not having the same syntax.
* BLOB. This turns into LONGBLOB on load. Not that we care, but that better represents to the adapter what we want that standard type to be. So, a MySQL BLOB will load larger than it was if dumped and restored through PSQL.

I think these are reasonable tradeoffs, but I could be persuaded to take a different approach.

To post a comment you must log in.
Revision history for this message
Nathan Williams (nwilliams) wrote :

Your tradeoffs make sense to me.

There's a workaround TODO on TableDDL.java#285. Can that be removed after your associated parser change?

Looks fine otherwise.

review: Needs Information
Revision history for this message
Mike McMahon (mmcm) wrote :

Quite right. That isn't needed any more.

review: Needs Resubmitting
Revision history for this message
Nathan Williams (nwilliams) wrote :

Splendid.

review: Approve
Revision history for this message
Akiban Build User (build-akiban) wrote :

There were 2 failures during build/test:

* job server-build failed at build number 4000: http://172.16.20.104:8080/job/server-build/4000/

* view must-pass failed: server-build is yellow

review: Needs Fixing
2646. By Mike McMahon

Update test.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/main/java/com/akiban/sql/aisddl/TableDDL.java'
2--- src/main/java/com/akiban/sql/aisddl/TableDDL.java 2013-04-23 19:22:46 +0000
3+++ src/main/java/com/akiban/sql/aisddl/TableDDL.java 2013-04-25 22:47:29 +0000
4@@ -282,10 +282,6 @@
5 static Type columnType(DataTypeDescriptor type, Long[] typeParameters,
6 String schemaName, String tableName, String columnName) {
7 Type builderType = typeMap.get(type.getTypeId());
8- // TODO: Parser doesn't map tinyint properly
9- if (builderType == null && Types.TINYINT.name().equalsIgnoreCase(type.getTypeName())) {
10- builderType = typeMap.get(TypeId.TINYINT_ID);
11- }
12 if (builderType == null) {
13 throw new UnsupportedDataTypeException(new TableName(schemaName, tableName), columnName, type.getTypeName());
14 }
15@@ -539,6 +535,13 @@
16
17 types.put(TypeId.BLOB_ID, Types.LONGBLOB);
18 types.put(TypeId.CLOB_ID, Types.LONGTEXT);
19+ types.put(TypeId.TEXT_ID, Types.TEXT);
20+ types.put(TypeId.TINYBLOB_ID, Types.TINYBLOB);
21+ types.put(TypeId.TINYTEXT_ID, Types.TINYTEXT);
22+ types.put(TypeId.MEDIUMBLOB_ID, Types.MEDIUMBLOB);
23+ types.put(TypeId.MEDIUMTEXT_ID, Types.MEDIUMTEXT);
24+ types.put(TypeId.LONGBLOB_ID, Types.LONGBLOB);
25+ types.put(TypeId.LONGTEXT_ID, Types.LONGTEXT);
26 return Collections.unmodifiableMap(types);
27
28 }
29
30=== modified file 'src/test/resources/com/akiban/sql/pg/yaml/functional/test-create-table.yaml'
31--- src/test/resources/com/akiban/sql/pg/yaml/functional/test-create-table.yaml 2013-03-19 05:13:37 +0000
32+++ src/test/resources/com/akiban/sql/pg/yaml/functional/test-create-table.yaml 2013-04-25 22:47:29 +0000
33@@ -28,6 +28,12 @@
34 # mediumint is now supported
35 - CreateTable: table_mediumint (mediumint_field mediumint)
36 ---
37+# text is now supported
38+- CreateTable: table_text (text_field text)
39+---
40+
41+# Test not yet supported types
42+
43 # enum is not supported
44 - CreateTable: table_enum (enum_field enum)
45 - error: [50008]
46@@ -36,14 +42,6 @@
47 - CreateTable: table_xml (xml_field xml)
48 - error: [50008]
49 ---
50-
51-# Test not yet supported types
52-
53-# text is not supported yet
54-- CreateTable: table_text (text_field text)
55-- error: [50008]
56----
57-
58 # Bug 941657 -- number of fk columns != number of pk columns
59 - CreateTable: parent (pid int not null, primary key(pid))
60 ---

Subscribers

People subscribed via source and target branches