Skip to content

Conversation

@fernst
Copy link
Contributor

@fernst fernst commented Jul 19, 2022

No description provided.

@fernst fernst marked this pull request as ready for review August 17, 2022 18:13
@fernst fernst requested review from albertshau and tivv August 17, 2022 18:13
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Type;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why was this import removed?

public static final String SQL_INPUT_FIELDS = "fields";
public static final String SQL_INPUT_SCHEMA = "schema";
private static final Type LIST_OF_STRINGS_TYPE = new TypeToken<ArrayList<String>>() {
private static final java.lang.reflect.Type LIST_OF_STRINGS_TYPE = new TypeToken<ArrayList<String>>() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this fully qualified import is needed. There are no conflicting class names.

if (condition.length() == 0) {
condition.append(filter);
} else {
condition.append(" and (").append(filter).append(")");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: WHERE is uppercase, AND should be as well.


String partitionFilter = "TIMESTAMP(`_PARTITIONTIME`) >= TIMESTAMP(\"2000-01-01\") and " +
"TIMESTAMP(`_PARTITIONTIME`) < TIMESTAMP(\"2000-01-01\")";
expectedQuery = String.format("SELECT %s FROM `%s.%s.%s` WHERE %s and (%s)", String.join(",", fieldList),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: The expected query should be a fully defined string, not something that is built using code. This ensures that a bug doesn't also propagate to the test itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can use the debugger to print the expectedQuery value and replace the string here.

// Add output for SQL Engine Direct read
ImmutableMap.Builder<String, String> arguments = new ImmutableMap.Builder<>();

List<String> fieldNames = configuredSchema.getFields().stream().map(f -> f.getName()).collect(Collectors.toList());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We had to make a change on the BQ sink to only configure the Pushdown sink when a schema is configured in #1120

Can you add the same here? Essentially, if configuredSchema is null, don't initialize the pushdown sink. Realistically, I don't see how pushdown execution would even work if the schema is not known at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants