Code Monkey home page Code Monkey logo

Comments (6)

osopardo1 avatar osopardo1 commented on June 30, 2024

From recent findings, we can skip the push down filters step, since the filters needed are already present in OTreeIndex matchingFiles method

dataFilters: Seq[Expression]): Seq[AddFile] = {

A result from doing:

val df = spark.read.format("qbeast").load("/tmp/qbeast_table")
df.filter("user_id > 537764969").explain(true)

Shows the user_id filter as part of the DataFilters on the last step:

== Physical Plan ==
*(1) Filter (isnotnull(user_id#1762) AND (user_id#1762 >= 537764969))
+- *(1) ColumnarToRow
   +- FileScan parquet [event_time#1755,event_type#1756,product_id#1757,category_id#1758L,category_code#1759,brand#1760,price#1761,user_id#1762,user_session#1763] Batched: true, ...
DataFilters: [isnotnull(user_id#1762), (user_id#1762 >= 537764969)],...
Format: Parquet, Location: OTreeIndex[file:/tmp/qb-testing6614606061063411331], PartitionFilters: [], PushedFilters: [IsNotNull(user_id), GreaterThanOrEqual(user_id,537764969)], ReadSchema: struct<event_time:string,event_type:string,product_id:int,category_id:bigint,category_code:string...

from qbeast-spark.

alexeiakimov avatar alexeiakimov commented on June 30, 2024

Just curiosity, what will be in the DataFilters collection if the original filter uses OR instead of AND?

from qbeast-spark.

osopardo1 avatar osopardo1 commented on June 30, 2024

Good question! My guess is that they would not appear in DataFilters, but I will check it.

from qbeast-spark.

osopardo1 avatar osopardo1 commented on June 30, 2024

They are all present as a single Expression:

DataFilters: [(((user_id#1762 >= 537764969) OR ((user_id#1762 < 666666666) AND (product_id#1757 >= 6789009)))

from qbeast-spark.

alexeiakimov avatar alexeiakimov commented on June 30, 2024

So if we want a precise filtering we still need to work with AST, right?

from qbeast-spark.

osopardo1 avatar osopardo1 commented on June 30, 2024

Correct. For now, I think we should work only with conjunctions. There are functions in Spark that we can reproduce for splitting predicates, as Delta and other partition-aware formats do.
But maybe @cugni has other hints

Edited: In fact, for a query with only conjunctive predicates, Spark itself already separates them in different Expressions.

from qbeast-spark.

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.