Skip to content

ARROW-3845: [Gandiva] [GLib] Add GGandivaNode#3006

Closed
shiro615 wants to merge 20 commits intoapache:masterfrom
shiro615:glib-add-ggandiva-node
Closed

ARROW-3845: [Gandiva] [GLib] Add GGandivaNode#3006
shiro615 wants to merge 20 commits intoapache:masterfrom
shiro615:glib-add-ggandiva-node

Conversation

@shiro615
Copy link
Contributor

This PR adds Node classes to create GGandivaExpression with the specified GGandivaNode.

@shiro615 shiro615 force-pushed the glib-add-ggandiva-node branch from 096b924 to 6f15863 Compare November 21, 2018 02:14
@shiro615 shiro615 changed the title ARROW-3845: [Gandiva] [GLib] Add GGandivaNode [WIP] ARROW-3845: [Gandiva] [GLib] Add GGandivaNode Nov 21, 2018
@shiro615 shiro615 force-pushed the glib-add-ggandiva-node branch from 25a1d99 to a4deb08 Compare November 21, 2018 03:37
@shiro615 shiro615 changed the title [WIP] ARROW-3845: [Gandiva] [GLib] Add GGandivaNode ARROW-3845: [Gandiva] [GLib] Add GGandivaNode Nov 21, 2018
@codecov-io
Copy link

codecov-io commented Nov 21, 2018

Codecov Report

Merging #3006 into master will increase coverage by 1.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3006      +/-   ##
==========================================
+ Coverage   86.65%   87.67%   +1.01%     
==========================================
  Files         491      424      -67     
  Lines       69513    64073    -5440     
==========================================
- Hits        60239    56173    -4066     
+ Misses       9182     7900    -1282     
+ Partials       92        0      -92
Impacted Files Coverage Δ
python/pyarrow/public-api.pxi 54.34% <0%> (-0.73%) ⬇️
rust/src/record_batch.rs
go/arrow/array/table.go
rust/src/array.rs
go/arrow/math/uint64_amd64.go
go/arrow/internal/testing/tools/bool.go
go/arrow/array/bufferbuilder.go
go/arrow/internal/bitutil/bitutil.go
go/arrow/memory/memory_avx2_amd64.go
go/arrow/array/null.go
... and 65 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e6bf41...c166c8f. Read the comment docs.

Copy link
Contributor Author

@shiro615 shiro615 left a comment

Choose a reason for hiding this comment

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

Thank you for your support.
I’ve read each commit for details. This looks good.


#define GGANDIVA_NODE_GET_PRIVATE(object) \
static_cast<GGandivaNodePrivate *>( \
ggandiva_node_get_instance_private( \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is that because G_TYPE_INSTANCE_GET_PRIVATE has been deprecated since version 2.58?
I'll send follow-up pull requests to remove G_TYPE_INSTANCE_GET_PRIVATE in other classes.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. Go ahead!

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

Thanks!
It looks almost good. Can you check my comments?

</part>

<part id="tree-expression-builder">
<title>Tree Expression Builder</title>
Copy link
Member

Choose a reason for hiding this comment

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

How about "Expression Tree"? We hide tree expression builder in implementation. So it's better that we also hide it in document.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. I've changed it.

* @input_fields: (element-type GArrowField): The input fields.
* @output_field: A #GArrowField to be output.
* @node: The node in the expression tree.
* @field: A #GArrowField to be output.
Copy link
Member

Choose a reason for hiding this comment

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

Can you use root_node and result_field here?
Parameter name is important to describe parameter value.

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've renamed it.

arrow_input_fields,
arrow_output_field);
gandiva::TreeExprBuilder::MakeExpression(gandiva_node,
arrow_field);
Copy link
Member

Choose a reason for hiding this comment

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

We need to keep a reference to GArrowField.
See f36ad38 how to implement it.

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've implemented it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And I’ve implemented to keep a reference to GGandivaNode.
Please review again.


#define GGANDIVA_NODE_GET_PRIVATE(object) \
static_cast<GGandivaNodePrivate *>( \
ggandiva_node_get_instance_private( \
Copy link
Member

Choose a reason for hiding this comment

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

Yes. Go ahead!

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

We need more name changes.
Can you check my comments?

PROP_EXPRESSION
PROP_EXPRESSION = 1,
PROP_NODE,
PROP_FIELD
Copy link
Member

Choose a reason for hiding this comment

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

root_node and return_field are better like the constructor parameter names.

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've changed it to use PROP_ROOT_NODE and PROP_RESULT_FIELD.

* @function: The function name in the expression.
* @input_fields: (element-type GArrowField): The input fields.
* @output_field: A #GArrowField to be output.
* @root_node: The node in the expression tree.
Copy link
Member

Choose a reason for hiding this comment

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

"The root node for the expression." may be better.

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've changed it.

* @input_fields: (element-type GArrowField): The input fields.
* @output_field: A #GArrowField to be output.
* @root_node: The node in the expression tree.
* @result_field: A #GArrowField to be output.
Copy link
Member

Choose a reason for hiding this comment

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

"The name and type of returned value as #GArrowField." may be better.

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've changed it.

*
* Returns: (transfer full): The expression tree with a root node,
* Returns: The expression tree with a root node,
* and a result field.
Copy link
Member

Choose a reason for hiding this comment

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

We can use simply "A newly created #GGandivaExpression" here.

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've changed it.

arrow_input_fields.push_back(arrow_input_field);
}
auto arrow_output_field = garrow_field_get_raw(output_field);
auto gandiva_node = ggandiva_node_get_raw(root_node);
Copy link
Member

Choose a reason for hiding this comment

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

gandiva_root_node is better.

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've fixed it.

}
auto arrow_output_field = garrow_field_get_raw(output_field);
auto gandiva_node = ggandiva_node_get_raw(root_node);
auto arrow_field = garrow_field_get_raw(result_field);
Copy link
Member

Choose a reason for hiding this comment

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

arrow_result_field is better.

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've fixed it.

GGandivaExpression *
ggandiva_expression_new_raw(std::shared_ptr<gandiva::Expression> *gandiva_expression)
ggandiva_expression_new_raw(std::shared_ptr<gandiva::Expression> *gandiva_expression,
GGandivaNode *node,
Copy link
Member

Choose a reason for hiding this comment

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

root_node is better.

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've fixed it.

ggandiva_expression_new_raw(std::shared_ptr<gandiva::Expression> *gandiva_expression)
ggandiva_expression_new_raw(std::shared_ptr<gandiva::Expression> *gandiva_expression,
GGandivaNode *node,
GArrowField *field)
Copy link
Member

Choose a reason for hiding this comment

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

result_field is better.

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've fixed it.

GList *input_fields,
GArrowField *output_field);
GGandivaExpression *ggandiva_expression_new(GGandivaNode *node,
GArrowField *field);
Copy link
Member

Choose a reason for hiding this comment

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

We need to change here too: root_node and return_field.

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've fixed it.

@shiro615
Copy link
Contributor Author

Oh... Thanks for your comments.
I'll try to address them to unify some names.

@shiro615
Copy link
Contributor Author

I think I've addressed them.
Please review again.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1
Thanks! I'll merge this.

@kou kou closed this in 2591454 Nov 22, 2018
@shiro615 shiro615 deleted the glib-add-ggandiva-node branch November 22, 2018 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants