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

allow type casting in static schema #729

Merged

Conversation

nikhilsinhaparseable
Copy link
Contributor

if field defined as float,
below values (examples) can be accepted -
100,-100.45, 100.23, "200.45"

Fixes #639 .

Description


This PR has:

  • been tested to ensure log ingestion and log query works.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added documentation for new or modified features or behaviors.

if field defined as float,
below values (examples) can be accepted -
100,-100.45, 100.23, "200.45"
Copy link
Member

@nitisht nitisht left a comment

Choose a reason for hiding this comment

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

LGTM!

@nitisht nitisht merged commit c11641f into parseablehq:main Mar 30, 2024
6 checks passed
nikhilsinhaparseable added a commit to nikhilsinhaparseable/parseable that referenced this pull request Apr 20, 2024
if field is defined as float,
below values (examples) can be accepted -
100,-100.45, 100.23, "200.45"
@aleimu
Copy link

aleimu commented Nov 13, 2024

When the Schema Type is Dynamic, after JSON serialization, the float loses precision and becomes an int type value. When storing such a value back into the dynamic database, it causes a type error. How can this issue be resolved?

POST  /api/v1/ingest  HTTP/1.1
HOST   : 192.168.33.10:8002
HEADERS:
        Authorization: Basic 111111=
        Content-Type: application/json
        User-Agent: go-resty/2.15.3 (https://github.com/go-resty/resty)
        X-P-Stream: charge_task_record_test_2
BODY   :
[
   {
      "id": 111,
      "action": "test",
      "user_id": 0,
      "soc": 1,
      "mileage": 123
   }
]

------------------------------------------------------------------------------
~~~ RESPONSE ~~~
STATUS       : 400 Bad Request
PROTO        : HTTP/1.1
RECEIVED AT  : 2024-11-13T10:36:40.978560864+08:00
TIME DURATION: 2.326225ms
HEADERS      :
        Content-Type: text/plain; charset=utf-8
        Date: Wed, 13 Nov 2024 02:36:40 GMT
        Vary: accept-encoding, Origin, Access-Control-Request-Method, Access-Control-Request-Headers
BODY         :
Invalid Request: Could not process this event due to mismatch in datatype
==============================================================================
sock file [/var/qlog_platform.sock] not found, uds log ignored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inquiry on Data Type Compatibility and Specification in Ingest API
3 participants