Skip to content

Commit

Permalink
feat: decimal encode to string in JSON.
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun committed Feb 23, 2023
1 parent 080953b commit 9a57bcd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/query/formats/src/field_encoder/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

use common_expression::types::array::ArrayColumn;
use common_expression::types::decimal::DecimalColumn;
use common_expression::types::ValueType;
use common_expression::Column;
use common_io::constants::FALSE_BYTES_LOWER;
Expand Down Expand Up @@ -87,4 +88,11 @@ impl FieldEncoderRowBased for FieldEncoderJSON {
self.nested.write_tuple(columns, row_index, &mut buf, false);
self.write_string_inner(&buf, out_buf, raw)
}

fn write_decimal(&self, column: &DecimalColumn, row_index: usize, out_buf: &mut Vec<u8>) {
let data = column.index(row_index).unwrap().to_string();
out_buf.push(b'"');
out_buf.extend_from_slice(data.as_bytes());
out_buf.push(b'"');
}
}

0 comments on commit 9a57bcd

Please sign in to comment.