Skip to content

Conversation

@10110346
Copy link
Contributor

@10110346 10110346 commented Apr 20, 2017

What changes were proposed in this pull request?

  1. add instructions of 'cast' function When using 'show functions' and 'desc function cast'
    command in spark-sql
  2. Modify the instructions of functions,such as
    boolean,tinyint,smallint,int,bigint,float,double,decimal,date,timestamp,binary,string

How was this patch tested?

Before modification:
spark-sql>desc function boolean;
Function: boolean
Class: org.apache.spark.sql.catalyst.expressions.Cast
Usage: boolean(expr AS type) - Casts the value expr to the target data type type.

After modification:
spark-sql> desc function boolean;
Function: boolean
Class: org.apache.spark.sql.catalyst.expressions.Cast
Usage: boolean(expr) - Casts the value expr to the target data type boolean.

spark-sql> desc function cast
Function: cast
Class: org.apache.spark.sql.catalyst.expressions.Cast
Usage: cast(expr AS type) - Casts the value expr to the target data type type.

Copy link
Contributor

Choose a reason for hiding this comment

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

will this work with our pattern matches in the query optimizer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No,it will not

Copy link
Member

Choose a reason for hiding this comment

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

Revert these unrelated changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

has reverted

Copy link
Member

Choose a reason for hiding this comment

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

Revert these unrelated changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

has reverted

@10110346 10110346 force-pushed the wip_lx_0418 branch 2 times, most recently from 3d66dcd to 240a989 Compare April 25, 2017 01:34
@10110346 10110346 changed the title [SPARK-20403][SQL][Documentation]Modify the instructions of some functions, and add instructions of 'cast' function [SPARK-20403][SQL][Documentation]Modify the instructions of some functions May 6, 2017
@10110346
Copy link
Contributor Author

10110346 commented May 6, 2017

I have tested all of them(boolean,tinyint,smallint,int,bigint,float,double,decimal,date,timestamp,binary,string), they can work properly. @srowen @rxin @HyukjinKwon

@10110346 10110346 changed the title [SPARK-20403][SQL][Documentation]Modify the instructions of some functions [SPARK-20403][SQL]Modify the instructions of some functions May 10, 2017
Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

For me, I don't think this is a proper approach (adding classes to fix a documentation).

@HyukjinKwon
Copy link
Member

Would there be other better ways, for example, fixing it in DescribeFunctionCommand or just hijacking the usage within castAlias?

@10110346
Copy link
Contributor Author

10110346 commented May 11, 2017

@HyukjinKwon I agree with you,i will try ,thanks.

@10110346
Copy link
Contributor Author

I have updated it , and test passed
please review it again,thanks @srowen @rxin @HyukjinKwon

@gatorsmile
Copy link
Member

LGTM except one comment:

Please add the test cases to the end of file cast.sql

DESC FUNCTION boolean;
DESC FUNCTION EXTENDED boolean;

You can generate the result file by

SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/test-only *SQLQueryTestSuite"

@10110346
Copy link
Contributor Author

10110346 commented May 19, 2017

@gatorsmile I have added test cases to the file cast.sql ,
could you help trigger tests
thanks.

@kiszk
Copy link
Member

kiszk commented May 19, 2017

Jenkins, test this please

@10110346
Copy link
Contributor Author

10110346 commented May 22, 2017

@ueshin @kiszk Test is not started, could you help trigger it again?

@gatorsmile
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented May 22, 2017

Test build #77201 has finished for PR 17698 at commit e09dc2a.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

10110346 added 2 commits May 23, 2017 08:58
Signed-off-by: liuxian <liu.xian3@zte.com.cn>
command in spark-sql
Signed-off-by: liuxian <liu.xian3@zte.com.cn>
@10110346 10110346 force-pushed the wip_lx_0418 branch 2 times, most recently from 6ce4220 to 7edfed5 Compare May 23, 2017 01:41
@SparkQA
Copy link

SparkQA commented May 23, 2017

Test build #77213 has finished for PR 17698 at commit 6ce4220.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 23, 2017

Test build #77214 has finished for PR 17698 at commit 7edfed5.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 23, 2017

Test build #77217 has finished for PR 17698 at commit 10be7eb.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@ueshin
Copy link
Member

ueshin commented May 23, 2017

@10110346 Hi, you can use the command @gatorsmile mentioned above to generate the result file.

boolean,tinyint,smallint,int,bigint,float,double,decimal,date,timestamp,binary,string
Signed-off-by: liuxian <liu.xian3@zte.com.cn>
@SparkQA
Copy link

SparkQA commented May 23, 2017

Test build #77241 has finished for PR 17698 at commit 51949d7.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@10110346
Copy link
Contributor Author

Test passed, thanks. @ueshin @gatorsmile

@gatorsmile
Copy link
Member

LGTM

asfgit pushed a commit that referenced this pull request May 25, 2017
## What changes were proposed in this pull request?
1.    add  instructions of  'cast'  function When using 'show functions'  and 'desc function cast'
       command in spark-sql
2.    Modify the  instructions of functions,such as
     boolean,tinyint,smallint,int,bigint,float,double,decimal,date,timestamp,binary,string

## How was this patch tested?
Before modification:
spark-sql>desc function boolean;
Function: boolean
Class: org.apache.spark.sql.catalyst.expressions.Cast
Usage: boolean(expr AS type) - Casts the value `expr` to the target data type `type`.

After modification:
spark-sql> desc function boolean;
Function: boolean
Class: org.apache.spark.sql.catalyst.expressions.Cast
Usage: boolean(expr) - Casts the value `expr` to the target data type `boolean`.

spark-sql> desc function cast
Function: cast
Class: org.apache.spark.sql.catalyst.expressions.Cast
Usage: cast(expr AS type) - Casts the value `expr` to the target data type `type`.

Author: liuxian <liu.xian3@zte.com.cn>

Closes #17698 from 10110346/wip_lx_0418.

(cherry picked from commit 197f901)
Signed-off-by: Xiao Li <gatorsmile@gmail.com>
@gatorsmile
Copy link
Member

Thanks! Merging to master/2.2

@asfgit asfgit closed this in 197f901 May 25, 2017
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.

8 participants