Issue Details (XML | Word | Printable)

Key: DERBY-2365
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Kim Haase
Reporter: Tomohito Nakayama
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Brushing up pages for MAX and MIN in Derby Reference Manual

Created: 21/Feb/07 01:53 PM   Updated: 17/Nov/09 08:56 AM
Return to search
Component/s: Documentation
Affects Version/s: 10.3.1.4
Fix Version/s: 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works DERBY-2365-2.diff 2007-02-22 07:47 PM Kim Haase 5 kB
Zip Archive Licensed for inclusion in ASF works DERBY-2365-2.zip 2007-03-01 10:15 PM Kim Haase 4 kB
File Licensed for inclusion in ASF works DERBY-2365-3.diff 2007-03-01 10:15 PM Kim Haase 5 kB
File Licensed for inclusion in ASF works DERBY-2365.diff 2007-02-21 05:54 PM Kim Haase 1 kB
Zip Archive Licensed for inclusion in ASF works DERBY-2365.zip 2007-02-22 07:47 PM Kim Haase 4 kB
HTML File Licensed for inclusion in ASF works rrefsqlj27781.html 2007-02-21 05:54 PM Kim Haase 5 kB
Environment:

Issue & fix info: Patch Available
Resolution Date: 05/Mar/07 04:04 PM


 Description  « Hide
* Description of rules for trailing blank spaces
In this part, next sentence of an example exists.

For example, if the values 'z' and 'z ' are both stored in a column, you cannot control which one will be returned as the maximum, because a blank space has no value.

Because blank space is value, I think "because a blank space has no value" is not appropriate.

I think it should be as "because a blank space is an special value".


* Mistaken information for LONG VARCHAR data type
Now MAX / MIN are not allowed for LONG VARCHAR in Derby.
However the manual mentions they are allowed.


* mistaken maximum for MIN
There exists next sentence in page for MIN :
> The type's comparison rules determine the maximum value.

Here, maximum should be minimum.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Tomohito Nakayama added a comment - 21/Feb/07 02:01 PM
Mistaken ....
"because a blank space is a special value"

Bryan Pendleton added a comment - 21/Feb/07 03:13 PM
Perhaps:

   "because one or more trailing blank spaces at the end of a character string do not distinguish it from the same string without the trailing blanks".

Does a wording like that make the meaning any clearer?

Tomohito Nakayama added a comment - 21/Feb/07 03:26 PM
Problem is that it is very difficult to translate this kind of vague expression ...
Sometimes translating them straightly results in unreadable expression in Japanese.

It can be clearer when it is translated into Japanese ...


Tomohito Nakayama added a comment - 21/Feb/07 03:36 PM
"No value" may be recognized as "value which may be ignored" in English, I think .
But in sence of Japanese word usage, no value is just null.

Then the sentence can be directly translated as "because a blank space is null" ...

// This may be nonsence because this is English and not Japanese ...

Tomohito Nakayama added a comment - 21/Feb/07 03:40 PM
By the way, is the meaning of the sentence different ,
if it was replaced as "because a blank space is a special value" ?

If so , I can translate the sentence as if it was replaced without replacing in English.

Sorry for confusing discussion ...

Kim Haase added a comment - 21/Feb/07 03:57 PM
Would this be less ambiguous?

"...because a string that has one or more trailing blank spaces is treated as identical to the same string that does not have trailing blank spaces."

I know it's a bit clumsy. But a phrase beginning with "without" can be either adverbial or adjectival, so it took me a while to figure out if the "without" in Bryan's suggestion appled to the noun "string" or to the verb phrase.

I think that "because a blank space is a special value" doesn't really explain the situation.

Tomohito Nakayama added a comment - 21/Feb/07 04:11 PM
I think we are too thinking about *value* itself .....

How about "because they are of equal in comparison" ?

Daniel John Debrunner added a comment - 21/Feb/07 04:28 PM
how about:

 "because trailing spaces are ignored for character comparisions"

PS. Can long varchar be used in a MAX?

Kim Haase added a comment - 21/Feb/07 04:30 PM
Yes, that puts it much more simply and clearly -- I think it would be more correct to say

  "because the two strings compare as equal"

Kim Haase added a comment - 21/Feb/07 04:37 PM
Dan's phrasing is better (I was responding to the previous post, not his).

("comparisons" is the correct spelling)

Tomohito Nakayama added a comment - 21/Feb/07 04:46 PM
I see.
I will translate Dan's phrase into Japanese.

Kim Haase added a comment - 21/Feb/07 05:54 PM
Attaching DERBY-2365.diff file and HTML output file rrefsqlj27781.html, with the corrected wording.

Bryan Pendleton added a comment - 21/Feb/07 11:14 PM
Thanks Kim! The diff and HTML page look good to me.

As long as we're working on this page, does anybody know the answer to Dan's question about LONG VARCHAR? Is that datatype allowable for a MAX?

Bryan Pendleton added a comment - 21/Feb/07 11:16 PM
OK, I tried it, and I think LONG VARCHAR is *not* supported for MAX:

ij> create table D2365 (a int, b varchar (20), c char(10), d long varchar);
0 rows inserted/updated/deleted
ij> select max(a) from d2365;
1
-----------
NULL

1 row selected
ij> select max(b) from d2365;
1
--------------------
NULL

1 row selected
ij> select max(c) from d2365;
1
----------
NULL

1 row selected
ij> select max(d) from d2365;
ERROR 42Y22: Aggregate MAX cannot operate on type LONG VARCHAR.

Kim, what do you think about revising your patch to remove the reference to LONG VARCHAR as well?

Kim Haase added a comment - 21/Feb/07 11:38 PM
Yes, I'll be glad to remove the reference to LONG VARCHAR. Should I say explicitly that it is not supported?

I wonder if there are any other unsupported builtin data types? The topic says MAX works "on expressions that evaluate to built-in data types (including CHAR, VARCHAR, DATE, TIME, CHAR FOR BIT DATA, etc.)".

Hm, I wonder if MIN needs to be fixed too?? Well, I guess that would be a separate issue.

Bryan Pendleton added a comment - 21/Feb/07 11:47 PM
I think we should just remove the reference to LONG VARCHAR from that one paragraph.

MIN does indeed appear to have the same situation.

     ij> select min(d) from d2365;
     ERROR 42Y22: Aggregate MIN cannot operate on type LONG VARCHAR.

I think we could go ahead and address that now, if you want. I don't know that a separate issue is necessary; the basic issue here involves the paragraph on trailing space handling and it's the same paragraph in both doc pages. Although, curiously, the page for MIN has slightly different text:

     " For CHAR, VARCHAR, and LONG VARCHAR, the number of blank spaces
       at the end of the value can affect the result."


Tomohito Nakayama added a comment - 22/Feb/07 01:32 PM
Do I rename this issue as "brushing up pages for MAX / MIN in Derby Reference Manual" ?

Tomohito Nakayama added a comment - 22/Feb/07 01:47 PM
I found another problem in page for MIN.

There exists next sentence :
The type's comparison rules determine the maximum value.

Here, maximum should be minimum.

Tomohito Nakayama added a comment - 22/Feb/07 01:50 PM
I came to feel it would be good to cluster brushing up issue for those.
I will rename this issue.

Kim Haase added a comment - 22/Feb/07 04:03 PM
Bryan, thank you for those suggestions about the MAX and MIN pages, and Tomohito, thanks for renaming this issue -- that is the right thing to do.

Should I change the language in MIN about blank spaces to match the language in MAX?

Tomohito Nakayama added a comment - 22/Feb/07 04:20 PM
Reading page for MIN,
I feel that similar description for trailing blank spaces should be in the page for MIN as the page for MAX.

// It may be verbose to have similar description in each pages ,
// but I think that verboseness is prefered in the reference manual.

Kim Haase added a comment - 22/Feb/07 07:47 PM
Attaching DERBY-2365-2.diff and DERBY-2365.zip with the changes to the MIN and MAX function descriptions. I kept finding more places where the two files were inconsistent for no obvious reason, so I've made them consistent where I can. There's one difference where I'm not sure which word is correct, though:

MAX is an aggregate function that evaluates the maximum of the expression over a set of values ...
MIN is an aggregate function that evaluates the minimum of an expression over a set of rows ...

Which should it be, values or rows? They may both be correct, but we should pick one.

(I'll change "the expression" to "an expression" for MAX, too. I just noticed that!)

Kim Haase added a comment - 01/Mar/07 10:15 PM
I think I figured it out -- I made the first sentence of MAX consistent with the first sentences of the other aggregate functions ("the maximum of an expression over a set of rows").

Sorry about the odd numbering: the final patch is DERBY-2365-3.diff and DERBY-2365-2.zip. Please let me know if anything still needs fixing. I hope this is ready to commit now.

Tomohito Nakayama added a comment - 03/Mar/07 01:56 PM
I think there are no problem for this patch.

Sending src/ref/rrefsqlj27781.dita
Sending src/ref/rrefsqlj33520.dita
Transmitting file data ..
Committed revision 514156.

Kim Haase added a comment - 05/Mar/07 04:03 PM
Thank you very much! I'll mark the issue resolved, then.