How to use the apache-arrow.ArrowType.Bool function in apache-arrow

To help you get started, we’ve selected a few apache-arrow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github grafana / grafana / packages / grafana-data / src / dataframe / arrow / ArrowDataFrame.ts View on Github external
const fields: Field[] = [];

  for (let i = 0; i < table.numCols; i++) {
    const col = table.getColumnAt(i);
    if (col) {
      const schema = table.schema.fields[i];
      let type = FieldType.other;
      const values: Vector = col;
      switch ((schema.typeId as unknown) as ArrowType) {
        case ArrowType.Decimal:
        case ArrowType.Int:
        case ArrowType.FloatingPoint: {
          type = FieldType.number;
          break;
        }
        case ArrowType.Bool: {
          type = FieldType.boolean;
          break;
        }
        case ArrowType.Timestamp: {
          type = FieldType.time;
          break;
        }
        default:
          console.log('UNKNOWN Type:', schema);
      }
      // console.log(' field>', schema.metadata);

      fields.push({
        name: col.name,
        type,
        config: {}, // TODO, pull from metadata