Skip to content

Commit

Permalink
Updated the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
malhotrashivam committed Feb 6, 2025
1 parent 85daf74 commit 85a611e
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
import java.util.List;
import java.util.stream.Collectors;
import static io.deephaven.engine.testutil.TstUtils.assertTableEquals;
import static io.deephaven.engine.util.TableTools.col;
import static io.deephaven.engine.util.TableTools.doubleCol;
import static org.apache.parquet.schema.LogicalTypeAnnotation.intType;
import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.DOUBLE;
import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.INT32;
Expand Down Expand Up @@ -293,9 +295,9 @@ void appendMultipleTablesWithDifferentDefinitionTest() {

@Test
void appendWithWrongDefinition() {
final Table source = TableTools.emptyTable(10)
.update("dateCol = java.time.LocalDate.now()",
"doubleCol = (double) 2.5 * i + 10");
final Table source = TableTools.newTable(
col("dateCol", java.time.LocalDate.now()),
doubleCol("doubleCol", 2.5));
final TableIdentifier tableIdentifier = TableIdentifier.parse("MyNamespace.MyTable");

final IcebergTableAdapter tableAdapter = catalogAdapter.createTable(tableIdentifier, source.getDefinition());
Expand Down Expand Up @@ -329,8 +331,8 @@ void appendWithWrongDefinition() {

// Try to write a table with the incorrect type using a correct writer
{
final Table appendTableWithIncorrectType = TableTools.emptyTable(5)
.update("dateCol = java.time.Instant.now()");
final Table appendTableWithIncorrectType = TableTools.newTable(
col("dateCol", java.time.Instant.now()));
try {
tableWriter.append(IcebergWriteInstructions.builder()
.addTables(appendTableWithIncorrectType)
Expand All @@ -347,12 +349,9 @@ void appendWithWrongDefinition() {
final IcebergTableWriter tableWriterWithSubset = tableAdapter.tableWriter(writerOptionsBuilder()
.tableDefinition(TableDefinition.of(ColumnDefinition.of("doubleCol", Type.doubleType())))
.build());
final Table appendTableWithAllColumns = TableTools.emptyTable(5)
.update("dateCol = java.time.LocalDate.now()",
"doubleCol = (double) 3.5 * i + 20");
try {
tableWriterWithSubset.append(IcebergWriteInstructions.builder()
.addTables(appendTableWithAllColumns)
.addTables(source)
.build());
failBecauseExceptionWasNotThrown(TableDefinition.IncompatibleTableDefinitionException.class);
} catch (TableDefinition.IncompatibleTableDefinitionException e) {
Expand Down

0 comments on commit 85a611e

Please sign in to comment.