Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
181 lines (177 sloc) 7.66 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<tns:store xmlns:tns="http://tajo.apache.org/catalogstore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.xsd ">
<!--
Catalog base version history
* 13 - 2016-05-10: Apply new type implementation to Schema and Catalog. (TAJO-2129)
* 12 - 2015-09-28: Change the variable name storeType to dataFormat (TAJO-1663)
* 11 - 2015-09-23: Add contents length and file count for partition directory (TAJO-1493)
* 10 - 2015-09-22: Well support for self-describing data formats (TAJO-1832)
* 9 - 2015-09-12: Allow external catalog store for unit testing (TAJO-1813)
* 8 - 2015-09-02: Wrong table type problem in catalog (TAJO-1808)
* 7 - 2015-07-30: Add a column and index for partition keys (TAJO-1346)
* 6 - 2015-07-24: Merge the index branch into the master branch (TAJO-1300)
* 5 - 2015-06-15: Implement TablespaceManager to load Tablespaces (TAJO-1616)
* 4 - 2015-03-27: Partition Schema (TAJO-1284)
* 3 - 2015-03-12: Nested Schema (TAJO-1329)
* 2 - 2014-06-09: First versioning
* 1- Before 2013-03-20
-->
<tns:base version="12">
<tns:objects>
<tns:Object order="0" type="table" name="META">
<tns:sql><![CDATA[CREATE TABLE META (VERSION INT NOT NULL)]]></tns:sql>
</tns:Object>
<tns:Object order="1" type="table" name="TABLESPACES">
<tns:sql><![CDATA[
CREATE TABLE TABLESPACES (
SPACE_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
SPACE_NAME VARCHAR(128) BINARY NOT NULL UNIQUE,
SPACE_HANDLER VARCHAR (1024) DEFAULT 'HDFS',
SPACE_URI VARCHAR (4096) BINARY NOT NULL,
UNIQUE INDEX IDX_NAME (SPACE_NAME)
)]]>
</tns:sql>
</tns:Object>
<tns:Object order="2" type="table" name="DATABASES_">
<tns:sql><![CDATA[
CREATE TABLE DATABASES_ (
DB_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
DB_NAME VARCHAR(128) BINARY NOT NULL UNIQUE,
SPACE_ID INT NOT NULL,
FOREIGN KEY (SPACE_ID) REFERENCES TABLESPACES (SPACE_ID),
UNIQUE INDEX IDX_NAME (DB_NAME)
)]]>
</tns:sql>
</tns:Object>
<tns:Object order="3" type="table" name="TABLES">
<tns:sql><![CDATA[
CREATE TABLE TABLES (
TID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
DB_ID INT NOT NULL,
TABLE_NAME VARCHAR(128) BINARY NOT NULL,
TABLE_TYPE VARCHAR(128) NOT NULL,
PATH VARCHAR(4096) BINARY,
DATA_FORMAT CHAR(16),
HAS_SELF_DESCRIBE_SCHEMA BOOLEAN,
FOREIGN KEY (DB_ID) REFERENCES DATABASES_ (DB_ID),
INDEX IDX_DB_ID (DB_ID),
UNIQUE INDEX IDX_TABLE_ID (DB_ID, TABLE_NAME)
)]]>
</tns:sql>
</tns:Object>
<tns:Object order="4" type="table" name="COLUMNS">
<tns:sql><![CDATA[
CREATE TABLE COLUMNS (
TID INT NOT NULL,
COLUMN_NAME VARCHAR(255) BINARY NOT NULL,
ORDINAL_POSITION INT NOT NULL,
DATA_TYPE VARCHAR(8192),
PRIMARY KEY (TID, ORDINAL_POSITION),
FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
)]]>
</tns:sql>
<!--
The constraint for guaranteeing the unique column name should be added to COLUMNS table. However, it can
make this table's schema complicated due to nested fields. Fortunately, columns are always converted
into 'schema' which has a functionality of checking duplicated column names.
-->
</tns:Object>
<tns:Object order="5" type="table" name="OPTIONS">
<tns:sql><![CDATA[
CREATE TABLE OPTIONS (
TID INT NOT NULL,
KEY_ VARCHAR(255) BINARY NOT NULL,
VALUE_ VARCHAR(4000) NOT NULL,
PRIMARY KEY (TID, KEY_),
FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
)]]>
</tns:sql>
</tns:Object>
<tns:Object order="6" type="table" name="INDEXES">
<tns:sql><![CDATA[
CREATE TABLE INDEXES (
INDEX_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
DB_ID INT NOT NULL,
TID INT NOT NULL,
INDEX_NAME VARCHAR(128) NOT NULL,
INDEX_TYPE CHAR(32) BINARY NOT NULL,
PATH VARCHAR(4096) NOT NULL,
COLUMN_NAMES VARCHAR(255) NOT NULL, -- array of column names
DATA_TYPES VARCHAR(128) NOT NULL, -- array of column types
ORDERS VARCHAR(128) NOT NULL, -- array of column orders
NULL_ORDERS VARCHAR(128) NOT NULL, -- array of null orderings
IS_UNIQUE BOOLEAN NOT NULL,
IS_CLUSTERED BOOLEAN NOT NULL,
FOREIGN KEY (DB_ID) REFERENCES DATABASES_ (DB_ID) ON DELETE CASCADE,
FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE,
UNIQUE INDEX IDX_DB_ID_NAME (DB_ID, INDEX_NAME)
)]]>
</tns:sql>
</tns:Object>
<tns:Object order="7" type="index" name="INDEXES_IDX_TID_COLUMN_NAME" dependsOn="INDEXES">
<tns:sql><![CDATA[CREATE INDEX INDEXES_IDX_TID_COLUMN_NAME on INDEXES (DB_ID, TID, COLUMN_NAMES)]]></tns:sql>
</tns:Object>
<tns:Object order="8" type="table" name="STATS">
<tns:sql><![CDATA[
CREATE TABLE STATS (
TID INT NOT NULL PRIMARY KEY,
NUM_ROWS BIGINT,
NUM_BYTES BIGINT,
FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
)]]>
</tns:sql>
</tns:Object>
<tns:Object order="9" type="table" name="PARTITION_METHODS">
<tns:sql><![CDATA[
CREATE TABLE PARTITION_METHODS (
TID INT NOT NULL PRIMARY KEY,
PARTITION_TYPE VARCHAR(10) NOT NULL,
EXPRESSION VARCHAR(1024) NOT NULL,
EXPRESSION_SCHEMA VARCHAR(1024) NOT NULL,
FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
)]]>
</tns:sql>
</tns:Object>
<tns:Object order="10" type="table" name="PARTITIONS">
<tns:sql><![CDATA[
CREATE TABLE PARTITIONS (
PARTITION_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
TID INT NOT NULL,
PARTITION_NAME VARCHAR(255) BINARY,
PATH VARCHAR(4096) BINARY,
NUM_BYTES BIGINT,
UNIQUE INDEX PARTITION_UNIQUE_IDX (TID, PARTITION_NAME),
FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
)]]>
</tns:sql>
</tns:Object>
<tns:Object order="11" type="table" name="PARTITION_KEYS">
<tns:sql><![CDATA[
CREATE TABLE PARTITION_KEYS (
PARTITION_ID INT NOT NULL,
TID INT NOT NULL,
COLUMN_NAME VARCHAR(255) BINARY NOT NULL,
PARTITION_VALUE VARCHAR(255) BINARY,
INDEX PARTITION_KEYS_IDX (TID, COLUMN_NAME, PARTITION_VALUE),
FOREIGN KEY (PARTITION_ID) REFERENCES PARTITIONS (PARTITION_ID) ON DELETE CASCADE
)]]>
</tns:sql>
</tns:Object>
</tns:objects>
</tns:base>
</tns:store>
You can’t perform that action at this time.