This is an automated email from the ASF dual-hosted git repository.
houqp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new 91a677c python: fix generated table name in dataframe creation (#1078)
91a677c is described below
commit 91a677c074e968be21fa4ef304de4b918dbb5a92
Author: QP Hou <[email protected]>
AuthorDate: Mon Oct 11 21:50:43 2021 -0700
python: fix generated table name in dataframe creation (#1078)
---
.github/workflows/python_test.yaml | 2 +-
python/src/context.rs | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/python_test.yaml
b/.github/workflows/python_test.yaml
index b2d8551..5419adb 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 4d48556..4c47058 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>();