Skip to content

Fix C++ client DATE 1000-01-01 query crash#18096

Open
hongzhi-gao wants to merge 1 commit into
apache:masterfrom
hongzhi-gao:fix/cpp-client-date-1000-01-01
Open

Fix C++ client DATE 1000-01-01 query crash#18096
hongzhi-gao wants to merge 1 commit into
apache:masterfrom
hongzhi-gao:fix/cpp-client-date-1000-01-01

Conversation

@hongzhi-gao

Copy link
Copy Markdown
Contributor

Description

Fix C++ client crash when querying DATE 1000-01-01: EMPTY_DATE_INT (10000101) was wrongly treated as NULL during decode, but it is also the valid encoding for 1000-01-01, causing C API parseDateExpressionToInt to throw.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR
  • iotdb-client/client-cpp/src/session/Date.cpp
  • iotdb-client/client-cpp/src/include/Common.h
  • iotdb-client/client-cpp/src/session/SessionC.cpp
  • iotdb-client/client-cpp/test/cpp/sessionIT.cpp
  • iotdb-client/client-cpp/test/cpp/sessionCIT.cpp

Test plan

  • session_tests.exe "[dateMinYear]" passed
  • session_c_tests.exe "[c_dateMinYear]" passed
  • Full session_tests and session_c_tests passed against local IoTDB

Stop treating EMPTY_DATE_INT as a null sentinel when decoding query results, since it encodes the valid date 1000-01-01 and caused C API reads to throw in parseDateExpressionToInt.
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.

1 participant