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

Revert "Oracle Table function " #597

Merged
merged 1 commit into from
Mar 27, 2024
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 @@ -22,7 +22,6 @@
import org.apache.calcite.rel.AbstractRelNode;
import org.apache.calcite.rel.RelInput;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.RelShuttle;
import org.apache.calcite.rel.RelWriter;
import org.apache.calcite.rel.metadata.RelColumnMapping;
import org.apache.calcite.rel.metadata.RelMetadataQuery;
Expand Down Expand Up @@ -139,10 +138,6 @@ public abstract TableFunctionScan copy(
return inputs;
}

@Override public RelNode accept(RelShuttle shuttle) {
return shuttle.visit(this);
}

@Override public RelNode accept(RexShuttle shuttle) {
RexNode rexCall = shuttle.apply(this.rexCall);
if (rexCall == this.rexCall) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,11 @@ private Builder visitAggregate(Aggregate e, List<Integer> groupKeyList,
final List<SqlNode> groupByList =
generateGroupList(builder, selectList, e, groupKeyList);

ProjectExpansionUtil projectExpansionUtil = new ProjectExpansionUtil();
if (projectExpansionUtil.isJoinWithBasicCall(builder)) {
projectExpansionUtil.updateSelectIfColumnIsUsedInGroupBy(builder, groupByList);
}

return buildAggregate(e, builder, selectList, groupByList);
}
/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2074,26 +2074,6 @@ private SqlLibraryOperators() {
}
};

@LibraryOperator(libraries = {ORACLE})
public static final SqlFunction IN_STRING = new OracleSqlTableFunction(
"IN_STRING",
SqlKind.OTHER_FUNCTION,
ReturnTypes.TO_ARRAY,
null,
OperandTypes.STRING,
SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION
);

@LibraryOperator(libraries = {ORACLE})
public static final SqlFunction IN_NUMBER = new OracleSqlTableFunction(
"IN_NUMBER",
SqlKind.OTHER_FUNCTION,
ReturnTypes.TO_ARRAY,
null,
OperandTypes.STRING,
SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION
);

@LibraryOperator(libraries = {SPARK})
public static final SqlFunction TIMESTAMPADD_DATABRICKS =
new SqlFunction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14051,27 +14051,6 @@ private RexNode createRexForQuantile(RelBuilder builder) {
assertThat(toSql(root, DatabaseProduct.BIG_QUERY.getDialect()), isLinux(expectedBiqQuery));
}

@Test public void testOracleTableFunctions() {
final RelBuilder builder = relBuilder();
final RelNode inStringRel = builder
.functionScan(SqlLibraryOperators.IN_STRING, 0,
builder.literal("abc"))
.build();
final RelNode inNumberRel = builder
.functionScan(SqlLibraryOperators.IN_NUMBER, 0,
builder.literal(2))
.build();

final String inStringSql = "SELECT *\n"
+ "FROM TABLE(IN_STRING('abc'))";

final String inNumberSql = "SELECT *\n"
+ "FROM TABLE(IN_NUMBER(2))";

assertThat(toSql(inStringRel, DatabaseProduct.ORACLE.getDialect()), isLinux(inStringSql));
assertThat(toSql(inNumberRel, DatabaseProduct.ORACLE.getDialect()), isLinux(inNumberSql));
}

@Test public void testForImplicitCastingForDateColumn() {
final String query = "select \"employee_id\" "
+ "from \"foodmart\".\"employee\" "
Expand Down
Loading