-
Notifications
You must be signed in to change notification settings - Fork 653
Closed
Description
Hi,
for a slice from a TableSliceGroup, a call to structure
fails with an Exception:
java.lang.ClassCastException: class tech.tablesaw.api.DoubleColumn cannot be cast to class tech.tablesaw.api.IntColumn (tech.tablesaw.api.DoubleColumn and tech.tablesaw.api.IntColumn are in unnamed module of loader 'app')
This was the case for a table with different columns of "real data", but is the same for this following small example:
import tech.tablesaw.api.StringColumn;
import tech.tablesaw.api.Table;
import tech.tablesaw.table.TableSlice;
import tech.tablesaw.table.TableSliceGroup;
public class SliceTest {
public static void main(String[] args) {
Table table = Table.create(StringColumn.create("MyCol", "A", "A", "B"));
TableSliceGroup sliceGroup = table.splitOn("MyCol");
System.out.println("++++++++++ structure() for slice fails ++++++++++");
for (TableSlice slice : sliceGroup.getSlices()) {
System.out.println("slice: " + slice);
System.out.println();
try {
System.out.print("slice.structure(): ");
System.out.println(slice.structure()); // FAILS
} catch (ClassCastException e) {
System.out.println(e);
}
System.out.println();
}
System.out.println();
System.out.println("++++++++++ ... but structure() for slices as tables works ++++++++++");
for (Table tableListTable : sliceGroup.asTableList()) {
System.out.println("tableListTable: " + tableListTable);
System.out.println();
System.out.println("tableListTable.structure(): ");
System.out.println(tableListTable.structure());
System.out.println();
}
}
}
I've tested it with Amazon Corretto 16 and tablesaw-core:0.38.2 / 0.38.3
Metadata
Metadata
Assignees
Labels
No labels