Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.plugin.clp;

import com.facebook.presto.spi.relation.RowExpression;

import java.util.Optional;

/**
* Represents the result of converting a Presto RowExpression into a CLP-compatible KQL query. In
* every case, `kqlQuery` represents the part of the RowExpression that could be converted to a
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to update this docstring? We have renamed the kqlQuery to pushDownExpression

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* KQL expression, and `remainingExpression` represents the part that could not be converted.
*/
public class ClpExpression
{
// Optional KQL query string representing the fully or partially translatable part of the expression.
private final Optional<String> kqlQuery;

// The remaining (non-translatable) portion of the RowExpression, if any.
private final Optional<RowExpression> remainingExpression;

public ClpExpression(String kqlQuery, RowExpression remainingExpression)
{
this.kqlQuery = Optional.ofNullable(kqlQuery);
this.remainingExpression = Optional.ofNullable(remainingExpression);
}

/**
* Creates an empty ClpExpression (no KQL definition, no remaining expression).
*/
public ClpExpression()
{
this(null, null);
}

/**
* Creates a ClpExpression from a fully translatable KQL string.
*
* @param kqlQuery
*/
public ClpExpression(String kqlQuery)
{
this(kqlQuery, null);
}

/**
* Creates a ClpExpression from a non-translatable RowExpression.
*
* @param remainingExpression
*/
public ClpExpression(RowExpression remainingExpression)
{
this(null, remainingExpression);
}
Comment on lines +58 to +66
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Add description to @param tag.

The JavaDoc has an empty @param tag without description.

     /**
      * Creates a ClpExpression from a non-translatable RowExpression.
      *
-     * @param remainingExpression
+     * @param remainingExpression the non-translatable RowExpression
      */
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Creates a ClpExpression from a non-translatable RowExpression.
*
* @param remainingExpression
*/
public ClpExpression(RowExpression remainingExpression)
{
this(null, remainingExpression);
}
/**
* Creates a ClpExpression from a non-translatable RowExpression.
*
* @param remainingExpression the non-translatable RowExpression
*/
public ClpExpression(RowExpression remainingExpression)
{
this(null, remainingExpression);
}
🤖 Prompt for AI Agents
In presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpExpression.java
around lines 57 to 65, the JavaDoc for the constructor has an empty @param tag
for remainingExpression. Add a clear description to the @param tag explaining
what remainingExpression represents, such as "the non-translatable RowExpression
to create the ClpExpression from."


public Optional<String> getKqlQuery()
{
return kqlQuery;
}

public Optional<RowExpression> getRemainingExpression()
{
return remainingExpression;
}
}
Loading
Loading