Skip to content

Commit

Permalink
DRILL-8273: Complex typed columns cannot be made implicit
Browse files Browse the repository at this point in the history
  • Loading branch information
jnturton committed Jul 31, 2022
1 parent f9b88d3 commit 230ab08
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,6 @@ public void load(Cell cell) {
}
}


public static class TimestampCellWriter extends ExcelBatchReader.CellWriter {
TimestampCellWriter(ScalarWriter columnWriter) {
super(columnWriter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ public class TestTupleProjection extends BaseTest {
MetadataUtils.newScalar("a", Types.required(MinorType.INT));
private static final ColumnMetadata UNPROJECTED_SPECIAL_COLUMN =
MetadataUtils.newScalar("bar", Types.required(MinorType.INT));
private static final ColumnMetadata COMPLEX_SPECIAL_COLUMN =
MetadataUtils.newMap("a_map");

static {
SPECIAL_COLUMN.setBooleanProperty(ColumnMetadata.EXCLUDE_FROM_WILDCARD, true);
UNPROJECTED_SPECIAL_COLUMN.setBooleanProperty(ColumnMetadata.EXCLUDE_FROM_WILDCARD, true);
COMPLEX_SPECIAL_COLUMN.setBooleanProperty(ColumnMetadata.EXCLUDE_FROM_WILDCARD, true);
}

/**
Expand All @@ -76,6 +79,7 @@ public void testProjectionAll() {
assertTrue(projSet.isProjected("foo"));
assertTrue(projSet.isProjected(NORMAL_COLUMN));
assertFalse(projSet.isProjected(SPECIAL_COLUMN));
assertFalse(projSet.isProjected(COMPLEX_SPECIAL_COLUMN));
assertTrue(projSet.projections().isEmpty());
assertFalse(projSet.isEmpty());
}
Expand All @@ -91,6 +95,7 @@ public void testWildcard() {
assertNull(projSet.get("foo"));
assertTrue(projSet.isProjected(NORMAL_COLUMN));
assertFalse(projSet.isProjected(SPECIAL_COLUMN));
assertFalse(projSet.isProjected(COMPLEX_SPECIAL_COLUMN));
assertEquals(1, projSet.projections().size());
assertFalse(projSet.isEmpty());
}
Expand All @@ -107,6 +112,7 @@ public void testProjectionNone() {
assertFalse(projSet.isProjected("foo"));
assertFalse(projSet.isProjected(NORMAL_COLUMN));
assertFalse(projSet.isProjected(SPECIAL_COLUMN));
assertFalse(projSet.isProjected(COMPLEX_SPECIAL_COLUMN));
assertTrue(projSet.projections().isEmpty());
assertTrue(projSet.isEmpty());
}
Expand All @@ -128,6 +134,7 @@ public void testProjectionSimple() {
assertTrue(projSet.isProjected(SPECIAL_COLUMN));
assertFalse(projSet.isProjected(UNPROJECTED_COLUMN));
assertFalse(projSet.isProjected(UNPROJECTED_SPECIAL_COLUMN));
assertFalse(projSet.isProjected(COMPLEX_SPECIAL_COLUMN));

List<RequestedColumn> cols = projSet.projections();
assertEquals(3, cols.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public ColumnMetadata copy() {

@Override
public ColumnMetadata cloneEmpty() {
return new DictColumnMetadata(name, mode, new TupleSchema());
ColumnMetadata colMeta = new DictColumnMetadata(name, mode, new TupleSchema());
colMeta.setProperties(this.properties());
return colMeta;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public ColumnMetadata copy() {

@Override
public ColumnMetadata cloneEmpty() {
return new MapColumnMetadata(name, mode, new TupleSchema());
ColumnMetadata colMeta = new MapColumnMetadata(name, mode, new TupleSchema());
colMeta.setProperties(this.properties());
return colMeta;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public MaterializedField emptySchema() {

@Override
public ColumnMetadata cloneEmpty() {
return new RepeatedListColumnMetadata(name, null);
ColumnMetadata colMeta = new RepeatedListColumnMetadata(name, null);
colMeta.setProperties(this.properties());
return colMeta;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ public boolean isArray() {

@Override
public ColumnMetadata cloneEmpty() {
return new VariantColumnMetadata(name, type, mode, new VariantSchema());
VariantColumnMetadata colMeta = new VariantColumnMetadata(name, type, mode, new VariantSchema());
colMeta.setProperties(this.properties());
return colMeta;
}

@Override
Expand Down

0 comments on commit 230ab08

Please sign in to comment.