Git Product home page Git Product logo

Comments (5)

dharanad avatar dharanad commented on August 23, 2024

hello @jayzhan211 , i would like to work on this. QQ: Is this issue any straight as it sounds or there is more to it?

from datafusion.

jayzhan211 avatar jayzhan211 commented on August 23, 2024

hello @jayzhan211 , i would like to work on this. QQ: Is this issue any straight as it sounds or there is more to it?

A little more than it. Ideally we need to update map capacity in provider with the number of references. But, I think you can try it.

let references = self.resolve_table_references(&statement)?;
let mut provider = SessionContextProvider {
state: self,
tables: HashMap::with_capacity(references.len()),
};
for reference in references {
let resolved = &self.resolve_table_ref(reference);
if let Entry::Vacant(v) = provider.tables.entry(resolved.to_string()) {
if let Ok(schema) = self.schema_for_ref(resolved.clone()) {
if let Some(table) = schema.table(&resolved.table).await? {
v.insert(provider_as_source(table));
}
}
}
}
let query = self.build_sql_query_planner(&provider);

from datafusion.

dharanad avatar dharanad commented on August 23, 2024

take

from datafusion.

dharanad avatar dharanad commented on August 23, 2024

hello @jayzhan211 , i would like to work on this. QQ: Is this issue any straight as it sounds or there is more to it?

A little more than it. Ideally we need to update map capacity in provider with the number of references. But, I think you can try it.

let references = self.resolve_table_references(&statement)?;
let mut provider = SessionContextProvider {
state: self,
tables: HashMap::with_capacity(references.len()),
};
for reference in references {
let resolved = &self.resolve_table_ref(reference);
if let Entry::Vacant(v) = provider.tables.entry(resolved.to_string()) {
if let Ok(schema) = self.schema_for_ref(resolved.clone()) {
if let Some(table) = schema.table(&resolved.table).await? {
v.insert(provider_as_source(table));
}
}
}
}
let query = self.build_sql_query_planner(&provider);

Do you mean something like this

        let mut provider = SessionContextProvider {
            state: self,
            tables: HashMap::with_capacity(references.len() + self.user_defined_sql_planners.len()),
        };

If yes, why is required ? I this that we are already updating the capacity with reference count. If i misinterpreted it can you please elaborate more ?

from datafusion.

alamb avatar alamb commented on August 23, 2024

Update here is I think the current formulation is about as optimal as we can get it:

let user_defined_sql_planners: Vec<Arc<dyn UserDefinedSQLPlanner>> = vec![
Arc::new(functions::core::planner::CoreFunctionPlanner::default()),
// register crate of array expressions (if enabled)
#[cfg(feature = "array_expressions")]
Arc::new(functions_array::planner::ArrayFunctionPlanner),
#[cfg(feature = "array_expressions")]
Arc::new(functions_array::planner::FieldAccessPlanner),
#[cfg(feature = "datetime_expressions")]
Arc::new(functions::datetime::planner::ExtractPlanner),

(namely to make a Vec with a size known at compile time

from datafusion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.