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

Followup: Register OpenSearchTypeSystem to OpenSearchTypeFactory #3349

Merged
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
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
Loading