761417898 opened a new pull request, #560:
URL: https://github.com/apache/tsfile/pull/560

   ### Camel Algorithm Implementation
   #### Core Strategy
   Splits double-precision floats into integer and decimal components:
   
   - Integer part: Stable differences → Differential encoding
   - Decimal part: High volatility → Optimized XOR compression
   
   #### INTEGER ENCODING (Algorithm 1)
   
   1. First value: Store as raw 64-bit block
   2. Subsequent values:
   
   ```
   Calculate diff = current_int - previous_int
   |diff| ≤ 1 → Encode as (diff+1) in 2 bits
   |diff| > 1 →
     diff < 8 → '0' prefix + 3-bit value
     diff ≥ 8 → '1' prefix + 16-bit value
   ```
   #### DECIMAL ENCODING (Algorithm 2)
   
   - Calculate decimal places l (stored in 2 bits. e.g., 3.141 → l=3)
   - Compute dxor reference:  dxor = value.decimal - (2^-l * 
floor(value.decimal / 2^-l))
      Example: For value=1.234 (l=3), dxor=1.234 - 0.125=1.109 → XOR yields 
**​more trailing zeros​ than Gorilla's approach**.
   - XOR: v ↔ dxor → Extract center bits (Store ​only center bits​ (length=l) + 
dxor)
   - **Extra optimization**: Gorilla fallback
   When l > threshold (e.g., 15+): Revert to Gorilla's XOR-with-prior 
method.Prevents overflow in dxor calculations
   
   #### ENGINEERING IMPROVEMENTS
   - BitStream integration: WriteVarInt for compact integer storage
   - Safety mechanism: Gorilla fallback prevents overflows


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@tsfile.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to