Skip to content

[SPARK-20749][SQL][FOLLOW-UP] Override prettyName for bit_length and octet_length #20358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -141,7 +141,7 @@ statement
(LIKE? pattern=STRING)? #showTables
| SHOW TABLE EXTENDED ((FROM | IN) db=identifier)?
LIKE pattern=STRING partitionSpec? #showTable
| SHOW DATABASES (LIKE? pattern=STRING)? #showDatabases
| SHOW DATABASES (LIKE? pattern=STRING)? #showDatabases
Copy link
Member

Choose a reason for hiding this comment

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

Nit: seems unrelated?

| SHOW TBLPROPERTIES table=tableIdentifier
('(' key=tablePropertyKey ')')? #showTblProperties
| SHOW COLUMNS (FROM | IN) tableIdentifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,8 @@ case class BitLength(child: Expression) extends UnaryExpression with ImplicitCas
case BinaryType => defineCodeGen(ctx, ev, c => s"($c).length * 8")
}
}

override def prettyName: String = "bit_length"
}

/**
Expand Down Expand Up @@ -1735,6 +1737,8 @@ case class OctetLength(child: Expression) extends UnaryExpression with ImplicitC
case BinaryType => defineCodeGen(ctx, ev, c => s"($c).length")
}
}

override def prettyName: String = "octet_length"
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ struct<(7 % 2):int,(7 % 0):int,(0 % 2):int,(7 % CAST(NULL AS INT)):int,(CAST(NUL
-- !query 51
select BIT_LENGTH('abc')
-- !query 51 schema
struct<bitlength(abc):int>
struct<bit_length(abc):int>
-- !query 51 output
24

Expand All @@ -449,7 +449,7 @@ struct<length(abc):int>
-- !query 54
select OCTET_LENGTH('abc')
-- !query 54 schema
struct<octetlength(abc):int>
struct<octet_length(abc):int>
-- !query 54 output
3

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 29
-- Number of queries: 27


-- !query 0
Expand Down Expand Up @@ -307,21 +307,22 @@ struct<t1a:string>
val1c
val1d

-- !query 22

-- !query 20
SELECT count(t1a)
FROM t1 RIGHT JOIN t2
ON t1d = t2d
WHERE t1a < (SELECT max(t2a)
FROM t2
WHERE t2c = t1c
GROUP BY t2c)
-- !query 22 schema
-- !query 20 schema
struct<count(t1a):bigint>
-- !query 22 output
-- !query 20 output
7


-- !query 23
-- !query 21
SELECT t1a
FROM t1
WHERE t1b <= (SELECT max(t2b)
Expand All @@ -332,14 +333,14 @@ AND t1b >= (SELECT min(t2b)
FROM t2
WHERE t2c = t1c
GROUP BY t2c)
-- !query 23 schema
-- !query 21 schema
struct<t1a:string>
-- !query 23 output
-- !query 21 output
val1b
val1c


-- !query 24
-- !query 22
SELECT t1a
FROM t1
WHERE t1a <= (SELECT max(t2a)
Expand All @@ -353,14 +354,14 @@ WHERE t1a >= (SELECT min(t2a)
FROM t2
WHERE t2c = t1c
GROUP BY t2c)
-- !query 24 schema
-- !query 22 schema
struct<t1a:string>
-- !query 24 output
-- !query 22 output
val1b
val1c


-- !query 25
-- !query 23
SELECT t1a
FROM t1
WHERE t1a <= (SELECT max(t2a)
Expand All @@ -374,9 +375,9 @@ WHERE t1a >= (SELECT min(t2a)
FROM t2
WHERE t2c = t1c
GROUP BY t2c)
-- !query 25 schema
-- !query 23 schema
struct<t1a:string>
-- !query 25 output
-- !query 23 output
val1a
val1a
val1b
Expand All @@ -387,7 +388,7 @@ val1d
val1d


-- !query 26
-- !query 24
SELECT t1a
FROM t1
WHERE t1a <= (SELECT max(t2a)
Expand All @@ -401,16 +402,16 @@ WHERE t1a >= (SELECT min(t2a)
FROM t2
WHERE t2c = t1c
GROUP BY t2c)
-- !query 26 schema
-- !query 24 schema
struct<t1a:string>
-- !query 26 output
-- !query 24 output
val1a
val1b
val1c
val1d


-- !query 27
-- !query 25
SELECT t1a
FROM t1
WHERE t1a <= (SELECT max(t2a)
Expand All @@ -424,22 +425,22 @@ WHERE t1a >= (SELECT min(t2a)
FROM t2
WHERE t2c = t1c
GROUP BY t2c)
-- !query 27 schema
-- !query 25 schema
struct<t1a:string>
-- !query 27 output
-- !query 25 output
val1a


-- !query 28
-- !query 26
SELECT t1a
FROM t1
GROUP BY t1a, t1c
HAVING max(t1b) <= (SELECT max(t2b)
FROM t2
WHERE t2c = t1c
GROUP BY t2c)
-- !query 28 schema
-- !query 26 schema
struct<t1a:string>
-- !query 28 output
-- !query 26 output
val1b
val1c