Skip to content

Commit

Permalink
create table test
Browse files Browse the repository at this point in the history
  • Loading branch information
clettieri committed Sep 21, 2023
1 parent 0b9c76e commit cc49a0a
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,17 +421,21 @@ public static PartitionSpec toPartitionSpec(Schema schema, Transform[] partition
case "bucket":
builder.bucket(colName, findWidth(transform));
break;
case "year":
case "years":
builder.year(colName);
break;
case "month":
case "months":
builder.month(colName);
break;
case "date":
case "day":
case "days":
builder.day(colName);
break;
case "date_hour":
case "hour":
case "hours":
builder.hour(colName);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ public void testTransformIgnoreCase() {
Assert.assertTrue("Table should already exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformSingularForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hour(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformPluralForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hours(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testCreateTable() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,17 +403,21 @@ public static PartitionSpec toPartitionSpec(Schema schema, Transform[] partition
case "bucket":
builder.bucket(colName, findWidth(transform));
break;
case "year":
case "years":
builder.year(colName);
break;
case "month":
case "months":
builder.month(colName);
break;
case "date":
case "day":
case "days":
builder.day(colName);
break;
case "date_hour":
case "hour":
case "hours":
builder.hour(colName);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ public void testTransformIgnoreCase() {
Assert.assertTrue("Table should already exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformSingularForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hour(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformPluralForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hours(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testCreateTable() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,17 +420,21 @@ public static PartitionSpec toPartitionSpec(Schema schema, Transform[] partition
case "bucket":
builder.bucket(colName, findWidth(transform));
break;
case "year":
case "years":
builder.year(colName);
break;
case "month":
case "months":
builder.month(colName);
break;
case "date":
case "day":
case "days":
builder.day(colName);
break;
case "date_hour":
case "hour"
case "hours":
builder.hour(colName);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ public void testTransformIgnoreCase() {
Assert.assertTrue("Table should already exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformSingularForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hour(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformPluralForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hours(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testCreateTable() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,17 +429,21 @@ public static PartitionSpec toPartitionSpec(Schema schema, Transform[] partition
case "bucket":
builder.bucket(colName, findWidth(transform));
break;
case "year":
case "years":
builder.year(colName);
break;
case "month":
case "months":
builder.month(colName);
break;
case "date":
case "day":
case "days":
builder.day(colName);
break;
case "date_hour":
case "hour":
case "hours":
builder.hour(colName);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ public void testTransformIgnoreCase() {
Assert.assertTrue("Table should already exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformSingularForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hour(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformPluralForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hours(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testCreateTable() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,17 +429,21 @@ public static PartitionSpec toPartitionSpec(Schema schema, Transform[] partition
case "bucket":
builder.bucket(colName, findWidth(transform));
break;
case "year":
case "years":
builder.year(colName);
break;
case "month":
case "months":
builder.month(colName);
break;
case "date":
case "day":
case "days":
builder.day(colName);
break;
case "date_hour":
case "hour":
case "hours":
builder.hour(colName);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ public void testTransformIgnoreCase() {
Assert.assertTrue("Table should already exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformSingularForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hour(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testTransformPluralForm() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
sql(
"CREATE TABLE IF NOT EXISTS %s (id BIGINT NOT NULL, ts timestamp) "
+ "USING iceberg partitioned by (hours(ts))",
tableName);
Assert.assertTrue("Table should exist", validationCatalog.tableExists(tableIdent));
}

@Test
public void testCreateTable() {
Assert.assertFalse("Table should not already exist", validationCatalog.tableExists(tableIdent));
Expand Down

0 comments on commit cc49a0a

Please sign in to comment.