Repository: influxdata/influxdb
File: influxdb3_py_api/src/system_py.rs (Rust)

Code before:
                            }
                            _ => {
                                return Err(PyValueError::new_err(format!(
                                    "Unsupported data type: {:?}",
                                    array.data_type()
                                )))
                            }
                        }
                    }
                    rows.push(row.into());
                }
            }

            let list = PyList::new(py, rows)?.unbind();
            Ok(list)
        })
    }
}

impl PyPluginCallApi {
    fn write_to_logger(&self, level: LogLevel, log_line: String) {
        if let Some(logger) = &self.logger {
            let processing_engine_log = ProcessingEngineLog::new(
                logger.sys_event_store.time_provider().now(),
                level,
                logger.trigger_name.clone(),
                log_line,
            );
            logger.sys_event_store.record(processing_engine_log);
        }
    }
}

// constant for the process writes call site string
const PROCESS_WRITES_CALL_SITE: &str = "process_writes";

const PROCESS_SCHEDULED_CALL_SITE: &str = "process_scheduled_call";

const PROCESS_REQUEST_CALL_SITE: &str = "process_request";

const LINE_BUILDER_CODE: &str = r#"
from typing import Optional
from collections import OrderedDict

class InfluxDBError(Exception):
    """Base exception for InfluxDB-related errors"""
    pass

class InvalidMeasurementError(InfluxDBError):
    """Raised when measurement name is invalid"""
    pass

Review comment (suggestion):
Can this be changed to `Arc<str>`? Would prefer to not be cloning a bunch of repeated strings.

Code after:
                                    .expect("unexpected datatype");

                                let values = col.values();
                                let values = values
                                    .as_any()
                                    .downcast_ref::<StringArray>()
                                    .expect("unexpected datatype");

                                let val = values.value(row_idx).to_string();
                                row.set_item(field_name, val)?;
                            }
                            _ => {
                                return Err(PyValueError::new_err(format!(
                                    "Unsupported data type: {:?}",
                                    array.data_type()
                                )))
                            }
                        }
                    }
                    rows.push(row.into());
                }
            }

            let list = PyList::new(py, rows)?.unbind();
            Ok(list)
        })
    }
}

impl PyPluginCallApi {
    fn write_to_logger(&self, level: LogLevel, log_line: String) {
        if let Some(logger) = &self.logger {
            logger.log(level, log_line);
        }
    }
}

// constant for the process writes call site string
const PROCESS_WRITES_CALL_SITE: &str = "process_writes";

const PROCESS_SCHEDULED_CALL_SITE: &str = "process_scheduled_call";

const PROCESS_REQUEST_CALL_SITE: &str = "process_request";

const LINE_BUILDER_CODE: &str = r#"
from typing import Optional
from collections import OrderedDict

class InfluxDBError(Exception):
    """Base exception for InfluxDB-related errors"""
    pass