fixed data type when getting the data from the chunk
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include <duckdb.h>
|
#include <duckdb.h>
|
||||||
|
#include <math.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -27,7 +28,7 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
//Test query
|
//Test query
|
||||||
duckdb_result result;
|
duckdb_result result;
|
||||||
duckdb_query(conn, "SELECT * from \"Engine RPM\";\n", &result);
|
duckdb_query(conn, "SELECT * from \"Ambient Temperature\";\n", &result);
|
||||||
int32_t iterations = 0;
|
int32_t iterations = 0;
|
||||||
int32_t number_of_data_points = 0;
|
int32_t number_of_data_points = 0;
|
||||||
|
|
||||||
@@ -44,13 +45,13 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
//first column
|
//first column
|
||||||
duckdb_vector col1 = duckdb_data_chunk_get_vector(data_chunk, 0);
|
duckdb_vector col1 = duckdb_data_chunk_get_vector(data_chunk, 0);
|
||||||
int32_t *col1_data = (int32_t *) duckdb_vector_get_data(col1);
|
float_t *col1_data = (float_t *) duckdb_vector_get_data(col1);
|
||||||
uint64_t *col1_validity = duckdb_vector_get_validity(col1);
|
uint64_t *col1_validity = duckdb_vector_get_validity(col1);
|
||||||
|
|
||||||
for (idx_t row = 0; row < row_count; row++) {
|
for (idx_t row = 0; row < row_count; row++) {
|
||||||
number_of_data_points++;
|
number_of_data_points++;
|
||||||
if(duckdb_validity_row_is_valid(col1_validity, row)){
|
if(duckdb_validity_row_is_valid(col1_validity, row)){
|
||||||
printf("%d, ", col1_data[row]);
|
printf("%f, ", col1_data[row]);
|
||||||
}else{
|
}else{
|
||||||
printf("NULL");
|
printf("NULL");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user