@@ -109,20 +109,19 @@ public static void createLineitem(QueryRunner queryRunner)
109
109
110
110
public static void createLineitem (QueryRunner queryRunner , boolean castDateToVarchar )
111
111
{
112
- if (!queryRunner .tableExists (queryRunner .getDefaultSession (), "lineitem" )) {
113
- String shipDate = castDateToVarchar ? "cast(shipdate as varchar) as shipdate" : "shipdate" ;
114
- String commitDate = castDateToVarchar ? "cast(commitdate as varchar) as commitdate" : "commitdate" ;
115
- String receiptDate = castDateToVarchar ? "cast(receiptdate as varchar) as receiptdate" : "receiptdate" ;
116
- queryRunner .execute ("CREATE TABLE lineitem AS " +
117
- "SELECT orderkey, partkey, suppkey, linenumber, quantity, extendedprice, discount, tax, " +
118
- " returnflag, linestatus, " + shipDate + ", " + commitDate + ", " + receiptDate + ", " +
119
- " shipinstruct, shipmode, comment, " +
120
- " linestatus = 'O' as is_open, returnflag = 'R' as is_returned, " +
121
- " cast(tax as real) as tax_as_real, cast(discount as real) as discount_as_real, " +
122
- " cast(linenumber as smallint) as linenumber_as_smallint, " +
123
- " cast(linenumber as tinyint) as linenumber_as_tinyint " +
124
- "FROM tpch.tiny.lineitem" );
125
- }
112
+ queryRunner .execute ("DROP TABLE IF EXISTS lineitem" );
113
+ String shipDate = castDateToVarchar ? "cast(shipdate as varchar) as shipdate" : "shipdate" ;
114
+ String commitDate = castDateToVarchar ? "cast(commitdate as varchar) as commitdate" : "commitdate" ;
115
+ String receiptDate = castDateToVarchar ? "cast(receiptdate as varchar) as receiptdate" : "receiptdate" ;
116
+ queryRunner .execute ("CREATE TABLE lineitem AS " +
117
+ "SELECT orderkey, partkey, suppkey, linenumber, quantity, extendedprice, discount, tax, " +
118
+ " returnflag, linestatus, " + shipDate + ", " + commitDate + ", " + receiptDate + ", " +
119
+ " shipinstruct, shipmode, comment, " +
120
+ " linestatus = 'O' as is_open, returnflag = 'R' as is_returned, " +
121
+ " cast(tax as real) as tax_as_real, cast(discount as real) as discount_as_real, " +
122
+ " cast(linenumber as smallint) as linenumber_as_smallint, " +
123
+ " cast(linenumber as tinyint) as linenumber_as_tinyint " +
124
+ "FROM tpch.tiny.lineitem" );
126
125
}
127
126
128
127
public static void createLineitemForIceberg (QueryRunner queryRunner )
@@ -143,13 +142,12 @@ public static void createOrders(QueryRunner queryRunner)
143
142
144
143
public static void createOrders (QueryRunner queryRunner , boolean castDateToVarchar )
145
144
{
146
- if (!queryRunner .tableExists (queryRunner .getDefaultSession (), "orders" )) {
147
- String orderDate = castDateToVarchar ? "cast(orderdate as varchar) as orderdate" : "orderdate" ;
148
- queryRunner .execute ("CREATE TABLE orders AS " +
149
- "SELECT orderkey, custkey, orderstatus, totalprice, " + orderDate + ", " +
150
- " orderpriority, clerk, shippriority, comment " +
151
- "FROM tpch.tiny.orders" );
152
- }
145
+ queryRunner .execute ("DROP TABLE IF EXISTS orders" );
146
+ String orderDate = castDateToVarchar ? "cast(orderdate as varchar) as orderdate" : "orderdate" ;
147
+ queryRunner .execute ("CREATE TABLE orders AS " +
148
+ "SELECT orderkey, custkey, orderstatus, totalprice, " + orderDate + ", " +
149
+ " orderpriority, clerk, shippriority, comment " +
150
+ "FROM tpch.tiny.orders" );
153
151
}
154
152
155
153
public static void createOrdersEx (QueryRunner queryRunner )
0 commit comments