Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-11578

Why does DataFusion throw a Tokio 0.2 runtime error?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 3.0.0, 4.0.0
    • None
    • Rust - DataFusion
    • None

    Description

      thread 'tests::simple_join' panicked at 'must be called from the context of a Tokio 0.2.x runtime configured with either `basic_scheduler` or `threaded_scheduler`'.

      Unable to find source-code formatter for language: rust. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
          #[tokio::test]
          async fn simple_join() -> Result<()> {
              let schema1 = Arc::new(Schema::new(vec![
                  Field::new("a", DataType::Utf8, false),
                  Field::new("b", DataType::Int32, false),
              ]));
              let schema2 = Arc::new(Schema::new(vec![
                  Field::new("c", DataType::Utf8, false),
                  Field::new("d", DataType::Int32, false),
              ]));
      
              // define data.
              let batch1 = RecordBatch::try_new(
                  schema1.clone(),
                  vec![
                      Arc::new(StringArray::from(vec!["a", "b", "c", "d"])),
                      Arc::new(Int32Array::from(vec![1, 10, 10, 100])),
                  ],
              )?;
              // define data.
              let batch2 = RecordBatch::try_new(
                  schema2.clone(),
                  vec![
                      Arc::new(StringArray::from(vec!["a", "b", "c", "d"])),
                      Arc::new(Int32Array::from(vec![1, 10, 10, 100])),
                  ],
              )?;
      
              let mut ctx = ExecutionContext::new();
      
              let table1 = MemTable::try_new(schema1, vec![vec![batch1]])?;
              let table2 = MemTable::try_new(schema2, vec![vec![batch2]])?;
      
              ctx.register_table("t1", Box::new(table1));
              ctx.register_table("t2", Box::new(table2));
      
              let sql = concat!(
                  "SELECT a, b, d ",
                  "FROM t1 JOIN t2 ON a = c ",
                  "ORDER BY b ASC ",
                  "LIMIT 3"
              );
      
              let plan = ctx.create_logical_plan(&sql)?;
              let plan = ctx.optimize(&plan)?;
              let plan = ctx.create_physical_plan(&plan)?;
      
              let batches = collect(plan).await?;
              let formatted = arrow::util::pretty::pretty_format_batches(&batches).unwrap();
              let actual_lines: Vec<&str> = formatted.trim().lines().collect();
      
              let expected = vec![
                  "+---+----+----+",
                  "| a | b  | d  |",
                  "+---+----+----+",
                  "| a | 1  | 1  |",
                  "| b | 10 | 10 |",
                  "| c | 10 | 10 |",
                  "+---+----+----+",
              ];
      
              assert_eq!(expected, actual_lines);
      
              Ok(())
          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            gangliao GANG LIAO
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: