databendlabs / databend

๐——๐—ฎ๐˜๐—ฎ, ๐—”๐—ป๐—ฎ๐—น๐˜†๐˜๐—ถ๐—ฐ๐˜€ & ๐—”๐—œ. Modern alternative to Snowflake. Cost-effective and simple for massive-scale analytics. https://databend.com
https://docs.databend.com
Other
7.85k stars 750 forks source link

fix: hilbert_index function panic #16393

Closed zhyass closed 2 months ago

zhyass commented 2 months ago

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

  1. Width must be less than or equal to 64.
  2. Dimension must between 2 and 5.
mysql> SELECT hilbert_index([to_binary('6tkz2eT'), to_binary('3wnehCt')], 17165323156917005607);
ERROR 1105 (HY000): BadArguments. Code: 1006, Text = error: 
  --> SQL:1:8
  |
1 | SELECT hilbert_index([to_binary('6tkz2eT'), to_binary('3wnehCt')], 17165323156917005607)
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Width must be less than or equal to 64 while evaluating function `hilbert_index([36746B7A326554, 33776E65684374], 17165323156917005607)` in expr `hilbert_index([36746B7A326554, 33776E65684374], 17165323156917005607)`

mysql> SELECT to_hex(hilbert_index([hilbert_key(1), hilbert_key(1), hilbert_key(1), hilbert_key(1),hilbert_key(1), hilbert_key(1)], 1));
ERROR 1105 (HY000): BadArguments. Code: 1006, Text = error: 
  --> SQL:1:15
  |
1 | SELECT to_hex(hilbert_index([hilbert_key(1), hilbert_key(1), hilbert_key(1), hilbert_key(1),hilbert_key(1), hilbert_key(1)], 1))
  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dimension must between 2 and 5 while evaluating function `hilbert_index([01, 01, 01, 01, 01, 01], 1)` in expr `hilbert_index([01, 01, 01, 01, 01, 01], 1)`, during run expr: `to_hex(hilbe

mysql> SELECT to_hex(hilbert_index([hilbert_key(1)], 1));
ERROR 1105 (HY000): BadArguments. Code: 1006, Text = error: 
  --> SQL:1:15
  |
1 | SELECT to_hex(hilbert_index([hilbert_key(1)], 1))
  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dimension must between 2 and 5 while evaluating function `hilbert_index([01], 1)` in expr `hilbert_index([01], 1)`, during run expr: `to_hex(hilbert_index([01], 1))`

Tests

Type of change


This change isโ€‚Reviewable