/*
 * 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.
 */
/*
 * Description  : Test variant syntax for delete
 *              : Ending semi-colon is optional for delete
 * Expected Res : Success
 * Date         : 6th March 2013
 */

drop  dataverse test if exists;
create  dataverse test;

use test;


create type test.LineItemType as
 closed {
  l_orderkey : int64,
  l_partkey : int64,
  l_suppkey : int64,
  l_linenumber : int64,
  l_quantity : int64,
  l_extendedprice : double,
  l_discount : double,
  l_tax : double,
  l_returnflag : string,
  l_linestatus : string,
  l_shipdate : string,
  l_commitdate : string,
  l_receiptdate : string,
  l_shipinstruct : string,
  l_shipmode : string,
  l_comment : string
}

create  dataset LineItem(LineItemType) primary key l_orderkey,l_linenumber;

