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

[BUG] getColumnTypeName for timestamp depends on cursor on/off #90

Open
Yury-Fridlyand opened this issue Jun 12, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Yury-Fridlyand
Copy link
Collaborator

What is the bug?

getColumnTypeName for timestamp depends whether cursor feature is active

How can one reproduce the bug?

Steps to reproduce the behavior:

  1. Create an index and a doc:
curl -s -H 'Content-Type: application/json' -XPUT "http://localhost:9200/date_type_index?pretty" -d '{"mappings": {"properties": {"release_date": {"type": "date" }}}}'
curl -s -H 'Content-Type: application/json' -XPOST "http://localhost:9200/date_type_index/_doc?pretty" -d '{"release_date": "2022-11-16"}'
  1. Query it without cursor:
Connection conn = driver.connect(connStr, properties);
Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("select * from date_type_index");
ResultSetMetaData rsmd = rs.getMetaData();
String typeName = rsmd.getColumnTypeName("release_date");
  1. typeName is TIMESTAMP
  2. Query it with cursor:
Connection conn = driver.connect(connStr, properties);
Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(5);
ResultSet rs = stmt.executeQuery("select * from date_type_index");
ResultSetMetaData rsmd = rs.getMetaData();
String typeName = rsmd.getColumnTypeName("release_date");
  1. typeName is DATE

What is the expected behavior?

It should be always timestamp since SQL plugin reports this type:

{
  "schema": [
    {
      "name": "release_date",
      "type": "timestamp"
    }
  ],
  "datarows": [
    [
      "2022-11-16 00:00:00"
    ]
  ],
  "total": 1,
  "size": 1,
  "status": 200
}

What is your host/environment?

  • OpenSearch 2.5
  • JDBC 5e8d914 @ main

Do you have any screenshots?

N/A

Do you have any additional context?

Thanks @akuzin1 for reporting that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant