Skip to content

Apache DataFusion SQL Query Engine

python: fix generated table name in dataframe creation (#1078)

QP Hou91a677c074e9
diff --git a/.github/workflows/python_test.yaml b/.github/workflows/python_test.yaml
index b2d8551460..5419adb388 100644
--- a/.github/workflows/python_test.yaml
+++ b/.github/workflows/python_test.yaml
@@ -56,7 +56,7 @@ jobs:
source venv/bin/activate
cd python
maturin develop
- pytest -v .
+ RUST_BACKTRACE=1 pytest -v .
env:
CARGO_HOME: "/home/runner/.cargo"
CARGO_TARGET_DIR: "/home/runner/target"
diff --git a/python/src/context.rs b/python/src/context.rs
index 4d48556595..4c47058190 100644
--- a/python/src/context.rs
+++ b/python/src/context.rs
@@ -83,8 +83,9 @@ impl ExecutionContext {
errors::wrap(MemTable::try_new(partitions[0][0].schema(), partitions))?;
// generate a random (unique) name for this table
- let name = rand::thread_rng()
- .sample_iter(&Alphanumeric)
+ // table name cannot start with numeric digit
+ let name = std::iter::once('c')
+ .chain(rand::thread_rng().sample_iter(&Alphanumeric))
.take(10)
.collect::<String>();