Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Vertica INT type support #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/main/java/mondrian/rolap/RolapAggregator.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ public Object aggregate(List<Object> rawData, Datatype datatype) {
if (sumInt == Integer.MIN_VALUE) {
sumInt = 0;
}

if (data instanceof Long)
{
data = ((Long) data).intValue();
}

if (data instanceof Double) {
data = ((Double) data).intValue();
}
}
sumInt += (Integer) data;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/mondrian/rolap/agg/Segment.java
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ SegmentDataset createDataset(
switch (type) {
case OBJECT:
case STRING:
case LONG:
return new DenseObjectSegmentDataset(axes, size);
case INT:
return new DenseIntSegmentDataset(axes, size);
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/mondrian/spi/impl/VerticaDialect.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,15 @@ public SqlStatement.Type getType(
{
// BIGINT->LONG should be the general rule, not just for Vertica,
// see MONDRIAN-1890
return metaData.getColumnType(columnIndex + 1) == Types.BIGINT
? SqlStatement.Type.LONG : super.getType(metaData, columnIndex);
int type = metaData.getColumnType(columnIndex + 1);

switch(type)
{
case Types.BIGINT: return SqlStatement.Type.LONG;
case Types.INTEGER: return SqlStatement.Type.LONG;
}

return super.getType(metaData, columnIndex);
}

}
Expand Down