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

SQL: fall back to using the field name for column label #38842

Merged
merged 4 commits into from
Feb 14, 2019

Conversation

astefan
Copy link
Contributor

@astefan astefan commented Feb 13, 2019

This PR adds a simple fall back mechanism for the column label defined in ResultSetMetaData so that when asked for a column label we always return the field name.
This PR does not provide the complete implementation of the column label definition; this will be addressed in a follow up issue since it involves more changes internally in ES-SQL (we do not keep around both the original value and the alias of a field so we can use both in JDBC).

This should fix issues with libraries (Ruby's Sequel used in the Logstash jdbc input plugin) that use the column label to discover the names to be used in the results.

Fixes #38831.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

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

LGTM. Left a comment.

new JdbcColumnInfo("test_keyword", EsType.KEYWORD, EMPTY, EMPTY, EMPTY, EMPTY, 0),
new JdbcColumnInfo("test_integer", EsType.INTEGER, EMPTY, EMPTY, EMPTY, EMPTY, 11),
new JdbcColumnInfo("test_double", EsType.DOUBLE, EMPTY, EMPTY, EMPTY, EMPTY, 25)
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add an example like new JdbcColumnInfo("test_long", EsType.DOUBLE, EMPTY, EMPTY, EMPTY, "long", 25) to make clear that the label overrides the name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Extended the test. Thanks.

@astefan
Copy link
Contributor Author

astefan commented Feb 13, 2019

@elasticmachine run elasticsearch-ci/2

@jakelandis jakelandis added v6.6.2 and removed v6.6.1 labels Feb 13, 2019
Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

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

LGTM

@astefan astefan merged commit 0567bf2 into elastic:master Feb 14, 2019
@astefan astefan deleted the 38831_fix branch February 14, 2019 10:42
astefan added a commit that referenced this pull request Feb 14, 2019
astefan added a commit that referenced this pull request Feb 14, 2019
astefan added a commit that referenced this pull request Feb 14, 2019
astefan added a commit that referenced this pull request Feb 14, 2019
astefan added a commit to astefan/elasticsearch that referenced this pull request Feb 14, 2019
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Feb 14, 2019
* elastic/master:
  Remove immediate operation retry after mapping update (elastic#38873)
  Remove mentioning of types from bulk API docs (elastic#38896)
  SQL: change JDBC setup URL in the documentation (elastic#38564)
  Skip BWC tests in checkPart1 and checkPart2 (elastic#38730)
  Enable silent FollowersCheckerTest (elastic#38851)
  Update TESTING.asciidoc with platform specific instructions (elastic#38802)
  Use consistent view of realms for authentication (elastic#38815)
  Stabilize RareClusterState (elastic#38671)
  Increase Timeout in UnicastZenPingTests (elastic#38893)
  Do not recommend installing vagrant-winrm elastic#38887
  _cat/indices with Security, hide names when wildcard (elastic#38824)
  SQL: fall back to using the field name for column label (elastic#38842)
  Fix LocalIndexFollowingIT#testRemoveRemoteConnection() test (elastic#38709)
  Remove joda time mentions in documentation (elastic#38720)
  Add enabled status for token and api key service (elastic#38687)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL: JDBC meta-data is always using an empty string for column label
5 participants