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

[CALCITE-6605] Lattice SQL supports complex column expressions #3987

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

YiwenWu
Copy link
Contributor

@YiwenWu YiwenWu commented Sep 30, 2024

/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-6605">[CALCITE-6605]
* Lattice SQL supports complex column expressions </a>. */
@Test void testExpressionLatticeSql() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can add some blank lines or a method to make the test sample code more readable.🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added description for tests.

return new SqlImplementor.SimpleContext(dialect, fieldFuncRef[0])
.toSql(null, ((DerivedColumn) column).e);
}
throw new UnsupportedOperationException();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably should have some more descriptive error

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be called when lattice column generates sql.

final Column column = columns.get(i);
column.toSql(w);

Originally, for DerivedColumn, the UnsupportedOperationException will be thrown directly. This PR will obtain the corresponding column based on index and return the field object.

Currently there are only two types of columns: BaseColumn, DerivedColumn, theoretically no exception will be thrown. But in order to avoid extreme cases that are not covered, the logic of throwing exceptions before is also retained.

Copy link

sonarcloud bot commented Oct 2, 2024

@mihaibudiu mihaibudiu added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Oct 4, 2024
@mihaibudiu mihaibudiu merged commit ed6c33e into apache:main Oct 29, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM-will-merge-soon Overall PR looks OK. Only minor things left.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants