Skip to content

Commit

Permalink
Followup: Register OpenSearchTypeSystem to OpenSearchTypeFactory (#3349)
Browse files Browse the repository at this point in the history
Signed-off-by: Lantao Jin <ltjin@amazon.com>
  • Loading branch information
LantaoJin authored Feb 26, 2025
1 parent 4ba78d3 commit db22f1c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
import org.opensearch.sql.data.model.ExprValueUtils;
import org.opensearch.sql.data.type.ExprCoreType;
import org.opensearch.sql.data.type.ExprType;
import org.opensearch.sql.executor.OpenSearchTypeSystem;
import org.opensearch.sql.storage.Table;

/** This class is used to create RelDataType and map RelDataType to Java data type */
public class OpenSearchTypeFactory extends JavaTypeFactoryImpl {
public static final OpenSearchTypeFactory TYPE_FACTORY =
new OpenSearchTypeFactory(RelDataTypeSystem.DEFAULT);
new OpenSearchTypeFactory(OpenSearchTypeSystem.INSTANCE);

private OpenSearchTypeFactory(RelDataTypeSystem typeSystem) {
super(typeSystem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ public class OpenSearchTypeSystem extends RelDataTypeSystemImpl {

private OpenSearchTypeSystem() {}

@Override
public RelDataType deriveAvgAggType(RelDataTypeFactory typeFactory, RelDataType argumentType) {
switch (argumentType.getSqlTypeName()) {
case INTEGER:
case BIGINT:
return typeFactory.createSqlType(SqlTypeName.DOUBLE);

default:
return super.deriveSumType(typeFactory, argumentType);
if (SqlTypeName.INT_TYPES.contains(argumentType.getSqlTypeName())) {
return typeFactory.createTypeWithNullability(
typeFactory.createSqlType(SqlTypeName.DOUBLE), false);
} else {
return argumentType;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BANK;

import java.io.IOException;
import org.junit.Ignore;
import org.junit.jupiter.api.Test;

/** testSortXXAndXX could fail. TODO Remove this @Ignore when the issue fixed. */
// @Ignore
@Ignore
public class CalcitePPLSortIT extends CalcitePPLIntegTestCase {

@Override
Expand Down

0 comments on commit db22f1c

Please sign in to comment.