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 Plugin returns double instead of date type for functions NOW() and CURDATE() [BUG] #260

Closed
ghost opened this issue Nov 2, 2021 · 5 comments
Labels
new-engine-gap tdvt Tableau test framework

Comments

@ghost
Copy link

ghost commented Nov 2, 2021

Describe the bug
Calling NOW() and CURDATE() returns NULL for the JDBC driver while calling NOW() and CURDATE() on the SQL Plugin returns the expected results

To Reproduce
Steps to reproduce the behavior:

  1. Load the calcs table on to the server
  2. Run a query with NOW() or CURDATE() to the SQL Plugin for example curl -XPOST http://localhost:9200/_plugins/_sql -u admin:admin --insecure -H 'Content-Type: application/json' -d '{"query": "SELECT CURDATE() FROM calcs LIMIT 1"}' for Windows Subsystem for Linux

Expected behavior
The output should be of some date type like date or datetime

Actual behavior
The output is of type double.

Screenshot
image

Host/Environment (please complete the following information):

  • OS: Windows 10
  • Version 21H1
@ghost ghost added Beta bug Something isn't working untriaged labels Nov 2, 2021
@ghost ghost changed the title JDBC driver returns null for functions NOW() and CURDATE() [BUG] SQL Plugin returns double instead of date type for functions NOW() and CURDATE() [BUG] Nov 2, 2021
@Yury-Fridlyand
Copy link
Collaborator

See also #259. Perhaps this bug could be fixed in scope of #259.

@chloe-zh
Copy link
Contributor

The new engine has not supported these functions, looks like the functions are executed in old engine. Should add such support in new query engine to address this issue

@chloe-zh chloe-zh added new-engine-gap and removed bug Something isn't working Beta untriaged labels Nov 13, 2021
@chloe-zh
Copy link
Contributor

related issue: #48

@ghost
Copy link
Author

ghost commented Nov 19, 2021

This issue affects TDVT tests:

  • exprtests/standard\setup.date.now.txt
  • exprtests/standard\setup.date.today.txt
  • exprtests/standard\setup.date.math.txt

@dai-chen
Copy link
Collaborator

I think this is already fixed along with the new impl in v2 engine. Tested in OpenSearch playground as below:

POST _plugins/_sql
{
 "query": "select now(), curdate()"
}

{
 "schema": [
   {
     "name": "now()",
     "type": "datetime"
   },
   {
     "name": "curdate()",
     "type": "date"
   }
 ],
 "datarows": [
   [
     "2022-12-14 03:27:48",
     "2022-12-14"
   ]
 ],
 "total": 1,
 "size": 1,
 "status": 200
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-engine-gap tdvt Tableau test framework
Projects
None yet
Development

No branches or pull requests

4 participants